diff --git a/customize_iso.sh b/customize_iso.sh index ad36c5c..30f9076 100755 --- a/customize_iso.sh +++ b/customize_iso.sh @@ -93,10 +93,6 @@ main() { OFFLINE=1 shift ;; - -v|--verbose) - VERBOSITY=1 - shift - ;; *) echo "ERROR: unknown option: $1" usage @@ -199,7 +195,7 @@ EOF echo "ERROR: local-apt-repository is required in wanted file for offline mode" exit 1 else - cat > ${myfiles}/local-apt-repository.sh <<"EOEF" + cat > "${myfiles}"/local-apt-repository.sh <<"EOEF" #!/usr/bin/env bash echo "### Activate apt cdrom" sed --expression "s/^[#]*deb cdrom:/deb [trusted=yes] cdrom:/" /etc/apt/sources.list diff --git a/incremental_backup.sh b/incremental_backup.sh new file mode 100644 index 0000000..c491c34 --- /dev/null +++ b/incremental_backup.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# to backup added deb files in a local directory +# scan current directory and list all deb files present +# and check if there is new deb files added by the customize_iso script on the host who build the iso (local,distant,vm) +# if new files, copy them to local directory + +# usage +# copy script to local backup directory +# adjust vars +# execute + +debpath=${HOME}/myfiles +user=user +host=host +hostbackuppath=. + +find ${hostbackuppath} -name "*.deb" -print > /tmp/deblist + +while IFS= read -r -d '' package +do + if ! grep --quiet "$(basename "${package}")" /tmp/deblist + then + echo "scp ${user}@${host}:${package} ${hostbackuppath}/" + scp ${user}@${host}:"${package}" "${hostbackuppath}/" + fi +done < <(ssh ${user}@${host} "find ${debpath} -name "*.deb" -print0") diff --git a/lfs.sh b/lfs.sh index b9406bf..cd36f99 100644 --- a/lfs.sh +++ b/lfs.sh @@ -55,7 +55,7 @@ LFS_STRIP_BINARIES=true LFS_NETWORKSAMEASHOST=true # bypass network configuration for full offline build LFS_NETWORKOFFLINE=true -# bypass linux config validation by taking linux config from host +# bypass linux config validation by taking linux config from repository LFS_LINUXCONFIGPROVIDED=true EOCF diff --git a/lfs32dev.conf b/lfs32dev.conf new file mode 100644 index 0000000..aec592a --- /dev/null +++ b/lfs32dev.conf @@ -0,0 +1,9 @@ +ISOFILE=$HOME/debian-12.14.0-i386-netinst.iso +PRESEED=$HOME/preseedvmlfsdev.cfg +NEWFLAVOR=vmlfsdev +MYFILES=$HOME/myfiles +WANTED=$HOME/wanted-lfs.txt +SUGGESTED=false +POPCON=false +EXTRA_SCRIPT=$HOME/lfsdev.sh +OFFLINE=1 \ No newline at end of file diff --git a/lfs64dev.conf b/lfs64dev.conf new file mode 100644 index 0000000..bee1ce4 --- /dev/null +++ b/lfs64dev.conf @@ -0,0 +1,9 @@ +ISOFILE=$HOME/debian-13.5.0-amd64-netinst.iso +PRESEED=$HOME/preseedvmlfsdev.cfg +NEWFLAVOR=vmlfsdev +MYFILES=$HOME/myfiles +WANTED=$HOME/wanted-lfs.txt +SUGGESTED=false +POPCON=false +EXTRA_SCRIPT=$HOME/lfsdev.sh +OFFLINE=1 \ No newline at end of file diff --git a/lfsdev.sh b/lfsdev.sh new file mode 100644 index 0000000..656f59f --- /dev/null +++ b/lfsdev.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +cat > "${HOME}"/myfiles/lfs-postinstall.sh <<"EOPF" +#!/usr/bin/env bash + +if ! dpkg -l |grep local-apt-repository +then + echo "ERROR: execute local-apt-repository.sh first" +fi + +if ! mount |grep cdrom +then + mount /dev/sr0 +fi + +if ! mount |grep cdrom +then + echo "ERROR: insert cdrom" + exit 1 +fi + +cat > /etc/sudoers.d/lfsdev <<"EOF" +lfsdev ALL = NOPASSWD: /usr/bin/chown * /mnt/lfsdev* +lfsdev ALL = NOPASSWD: /usr/bin/mount * /mnt/lfsdev* +lfsdev ALL = NOPASSWD: /usr/bin/install * /mnt/lfsdev* +lfsdev ALL = NOPASSWD: /usr/sbin/chroot /mnt/lfsdev* +EOF + +apt --yes install texinfo m4 bison gawk make patch python3 xz-utils gcc g++ build-essential + +mv --verbose /etc/bash.bashrc /etc/bash.bashrc.NOUSE +pushd /bin || return 1 + if [[ $(readlink sh) =~ ^dash$ ]] + then + rm --verbose sh + ln --symbolic --verbose bash sh + fi +popd || return 1 + +cat > /home/lfsdev/.lfsdevbuild_config <<"EOCF" +# build directory +LFS=/mnt/lfsdev +# location of local package sources +LFS_PACKAGE_DIR=/home/lfsdev/packages +# Number of processors to use +LFS_NPROC=1 +# Bypass step by step validation until a breakpoint +LFS_BREAKPOINT=110300 +# strip binaries or not +LFS_STRIP_BINARIES=true +# bypass network config validation by taking network config from host +LFS_NETWORKSAMEASHOST=true +# bypass network configuration for full offline build +LFS_NETWORKOFFLINE=true +# bypass linux config validation by taking linux config from host +LFS_LINUXCONFIGPROVIDED=true +EOCF + +chown lfsdev:lfsdev /home/lfsdev/.lfsbuild_config + +EOPF \ No newline at end of file diff --git a/preseedvmlfsdev.cfg b/preseedvmlfsdev.cfg new file mode 100644 index 0000000..578f3b7 --- /dev/null +++ b/preseedvmlfsdev.cfg @@ -0,0 +1,94 @@ +#_preseed_V1 +### Locale configuration +d-i debian-installer/locale string fr_FR.UTF-8 +#d-i debian-installer/language string fr +#d-i debian-installer/country string FR +d-i keyboard-configuration/xkb-keymap select fr(latin9) +#d-i keyboard-configuration/toggle select No toggling +d-i keyboard-configuration/layoutcode string fr +d-i keyboard-configuration/modelcode string pc105 +d-i keyboard-configuration/variantcode string latin9 +### Network configuration +d-i netcfg/enable boolean true +# If you want to force a hostname, regardless of what either the DHCP +# server returns or what the reverse DNS entry for the IP is, uncomment +# and adjust the following line. +# d-i netcfg/hostname string somehost +### account configuration +d-i passwd/root-password password shadow +d-i passwd/root-password-again password shadow +d-i passwd/user-fullname string lfsdev +d-i passwd/username string lfsdev +d-i passwd/user-uid string 1000 +d-i passwd/user-password password shadow +d-i passwd/user-password-again password shadow +#d-i passwd/user-default-groups string audio cdrom video +### Clock and time zone setup +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Paris +# Controls whether to use NTP to set the clock during the install +#d-i clock-setup/ntp boolean true +# NTP server to use. The default is almost always fine here. +#d-i clock-setup/ntp-server string ntp.example.com +### Partitioning +d-i partman-auto/method string regular +d-i partman-auto/disk string /dev/vda +d-i partman-auto/expert_recipe string \ + root-lfsdev :: \ + 3000 4000 5000 ext4 \ + $primary{ } $bootable{ } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + label{ debian } \ + . \ + 10000 30000 100000 ext4 \ + $primary{} \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /mnt/lfsdev } \ + label{ lfs } \ + . \ + 512 1000 1500 linux-swap \ + method{ swap } format{ } \ + . +#d-i partman-partitioning/confirm_write_new_label boolean true +#d-i partman/choose_partition select finish +#d-i partman/confirm boolean true +#d-i partman/confirm_nooverwrite boolean true +### Base system installation +### Apt setup +d-i apt-setup/use_mirror boolean false +d-i apt-setup/cdrom/set-first boolean false +d-i apt-cdrom-setup apt-setup/cdrom/set-next boolean false +d-i apt-cdrom-setup apt-setup/disable-cdrom-entries boolean false +# URL to the public key of the local repository; you must provide a key or +# apt will complain about the unauthenticated repository and so the +# sources.list line will be left commented out. +#d-i apt-setup/local0/key string http://local.server/key +# By default the installer requires that repositories be authenticated +# using a known gpg key. This setting can be used to disable that +# authentication. Warning: Insecure, not recommended. +#d-i debian-installer/allow_unauthenticated boolean true +d-i base-installer/install-recommends boolean false +### Package selection +# Or choose to not get the tasksel dialog displayed at all (and don't install +# any packages): +#d-i pkgsel/run_tasksel boolean false +# Individual additional packages to install +d-i pkgsel/include string sudo openssh-server +# Whether to upgrade packages after debootstrap. +# Allowed values: none, safe-upgrade, full-upgrade +d-i pkgsel/upgrade select none +popularity-contest popularity-contest/participate boolean false +### Boot loader installation +# Grub is the boot loader (for x86). +d-i grub-installer/with_other_os boolean true +d-i grub-installer/bootdev string /dev/vda +### Post install +# This command is run just before the install finishes, but when there is +# still a usable /target directory. You can chroot to /target and use it +# directly, or use the apt-install and in-target commands to easily install +# packages and run commands in the target system. +#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh +# d-i preseed/late_command string apt-install sudo build-essential gawk texinfo \ No newline at end of file diff --git a/wanted-lfs.txt b/wanted-lfs.txt index c822582..c30ed61 100644 --- a/wanted-lfs.txt +++ b/wanted-lfs.txt @@ -7,4 +7,8 @@ texinfo gcc g++ qemu-guest-agent -gpm \ No newline at end of file +gpm +htop +tmux +rsync +vim \ No newline at end of file