From fae448a5aa16aa50bbc5cf0fafd692d487754d18 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 27 Apr 2020 02:48:15 +0200 Subject: [PATCH] change to buster --- di-update | 2 +- preseed/buster/commands/early_command | 2 + preseed/buster/commands/late_command | 4 + .../late_commands.d/debconf_readline_low | 10 ++ .../late_commands.d/enable_serial_console | 15 ++ .../late_commands.d/post_boot_cleanup | 46 ++++++ .../commands/late_commands.d/srv-home_symlink | 7 + preseed/buster/preseed.cfg | 134 ++++++++++++++++++ vinst | 4 +- 9 files changed, 221 insertions(+), 3 deletions(-) create mode 100755 preseed/buster/commands/early_command create mode 100755 preseed/buster/commands/late_command create mode 100755 preseed/buster/commands/late_commands.d/debconf_readline_low create mode 100755 preseed/buster/commands/late_commands.d/enable_serial_console create mode 100755 preseed/buster/commands/late_commands.d/post_boot_cleanup create mode 100755 preseed/buster/commands/late_commands.d/srv-home_symlink create mode 100644 preseed/buster/preseed.cfg diff --git a/di-update b/di-update index 05e4586..bfd2dee 100755 --- a/di-update +++ b/di-update @@ -5,7 +5,7 @@ set -eu : ${SUBDIR:=debian/dists/%SUITE%/main/installer-%ARCH%/current/images} : ${ARCHS:=amd64} -: ${SUITES:=stretch} +: ${SUITES:=buster} #: ${MIRROR_jessie:=http://d-i.debian.org} #: ${SUBDIR_jessie:=daily-images/%ARCH%/daily/} diff --git a/preseed/buster/commands/early_command b/preseed/buster/commands/early_command new file mode 100755 index 0000000..8f26221 --- /dev/null +++ b/preseed/buster/commands/early_command @@ -0,0 +1,2 @@ +#!/bin/sh +# pwd is / diff --git a/preseed/buster/commands/late_command b/preseed/buster/commands/late_command new file mode 100755 index 0000000..3f843be --- /dev/null +++ b/preseed/buster/commands/late_command @@ -0,0 +1,4 @@ +#!/bin/sh +cp -r /commands/late_commands.d /target +in-target run-parts /late_commands.d +rm -r /target/late_commands.d diff --git a/preseed/buster/commands/late_commands.d/debconf_readline_low b/preseed/buster/commands/late_commands.d/debconf_readline_low new file mode 100755 index 0000000..936ac8c --- /dev/null +++ b/preseed/buster/commands/late_commands.d/debconf_readline_low @@ -0,0 +1,10 @@ +#!/bin/sh + +echo "Configuring debconf for readline/low" +export DEBCONF_FRONTEND=noninteractive +apt-get install --no-install-recommends -y libterm-readline-gnu-perl +debconf-set-selections <<_eof +debconf debconf/priority select low +debconf debconf/frontend select readline +debconf debconf/frontend seen false +_eof diff --git a/preseed/buster/commands/late_commands.d/enable_serial_console b/preseed/buster/commands/late_commands.d/enable_serial_console new file mode 100755 index 0000000..47768c0 --- /dev/null +++ b/preseed/buster/commands/late_commands.d/enable_serial_console @@ -0,0 +1,15 @@ +#!/bin/sh +echo "Enabling the serial console..." +if [ -f /etc/default/grub ]; then + #683124/#769406 requires the cmdline patch, and #444026 is for GRUB_TERMINAL: + sed -i -e '/^GRUB_CMDLINE_LINUX=/s/"$/ console=tty0 console=ttyS0,115200n8&/' \ + -e '/^GRUB_CMDLINE_LINUX=/s/=" /="/' \ + -e '/^GRUB_TERMINAL=/s/serial/"& console"/' \ + /etc/default/grub + update-grub +fi +if [ -f /etc/inittab ]; then + sed -i '/ttyS0/s/^#//;/ttyS0/s/9600 vt100/115200 linux/' /etc/inittab +else + echo "Not setting up a TTY on the serial port, presumably systemd will..." +fi diff --git a/preseed/buster/commands/late_commands.d/post_boot_cleanup b/preseed/buster/commands/late_commands.d/post_boot_cleanup new file mode 100755 index 0000000..4d03f20 --- /dev/null +++ b/preseed/buster/commands/late_commands.d/post_boot_cleanup @@ -0,0 +1,46 @@ +#!/bin/sh + +if [ -f /etc/inittab ]; then + + SCRIPT=/etc/init.d/post_boot_cleanup + SYMLINK=/etc/rcS.d/S99post_boot_cleanup + + cat >> $SCRIPT <<-_eof + #!/bin/sh + sed -i -e '/getty.*tty[12]/s/^#//' /etc/inittab + telinit q + update-rc.d ${SCRIPT##*/} remove + rm $SCRIPT + _eof + + chmod 755 $SCRIPT + update-rc.d ${SCRIPT##*/} start S 99 . + +else + + SCRIPT=/usr/local/sbin/post_boot_cleanup + UNIT=/etc/systemd/system/multi-user.target.wants/post_boot_cleanup.service + + cat >> $SCRIPT <<-_eof + #!/bin/sh + echo "Running post-install cleanup jobs..." >&2 + touch /itworked + rm $SCRIPT $UNIT + _eof + chmod 755 $SCRIPT + + cat >> $UNIT <<-_eof + [Unit] + Description=post-install cleanups + ConditionFileIsExecutable=$SCRIPT + After=multi-user.target + + [Service] + Type=idle + ExecStart=$SCRIPT + TimeoutSec=0 + RemainAfterExit=yes + SysVStartPriority=99 + _eof + +fi diff --git a/preseed/buster/commands/late_commands.d/srv-home_symlink b/preseed/buster/commands/late_commands.d/srv-home_symlink new file mode 100755 index 0000000..56911e7 --- /dev/null +++ b/preseed/buster/commands/late_commands.d/srv-home_symlink @@ -0,0 +1,7 @@ +#!/bin/sh +echo "Making /home a bind-mount of /srv/home..." +mkdir -m755 /srv/home +cat >>/etc/fstab <<_eof +/srv/home /home auto defaults,bind 0 0 +_eof +mount --bind /srv/home /home diff --git a/preseed/buster/preseed.cfg b/preseed/buster/preseed.cfg new file mode 100644 index 0000000..1385c30 --- /dev/null +++ b/preseed/buster/preseed.cfg @@ -0,0 +1,134 @@ +d-i debian-installer/locale string en_NZ + +d-i keyboard-configuration/xkb-keymap select us +d-i keyboard-configuration/layoutcode string us + +d-i netcfg/choose_interface select auto +d-i netcfg/dhcp_options select Configure network manually +d-i netcfg/confirm_static boolean true +d-i netcfg/wireless_wep string +# prevent rDNS discovery +d-i netcfg/get_hostname seen true +d-i netcfg/get_domain seen true + +d-i hw-detect/load_firmware boolean true + +d-i mirror/country string manual +d-i mirror/protocol string http +d-i mirror/http/hostname string ftp.ch.debian.org +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string +d-i mirror/suite string buster + +d-i anna/choose_modules string network-console +d-i network-console/password password r00tme +d-i network-console/password-again password r00tme +d-i network-console/start boolean true +d-i di-utils-shell/do-shell boolean true + +d-i passwd/make-user boolean false +d-i passwd/root-password-crypted password $6$lifGZQZ9$OVYc/Z26ilx1DLCOyPSy1/xOz5o.f6weCgMHYXQZ9EE38DYt0xJBd1Z83/KMWhDyeNmKxp0TUqpJN6w.MT72// + +d-i time/zone string Europe/Berlin + +d-i clock-setup/utc boolean true +d-i clock-setup/ntp boolean true + +d-i partman-basicfilesystems/choose_label string gpt +d-i partman-basicfilesystems/default_label string gpt +d-i partman-partitioning/choose_label string gpt +d-i partman-partitioning/default_label string gpt +d-i partman/choose_label string gpt +d-i partman/default_label string gpt + +#d-i partman-partitioning/confirm_write_new_label boolean true +#d-i partman-partitioning/unknown_label boolean true + +d-i partman-auto/disk string /dev/vda +d-i partman-auto/method string lvm + +d-i partman-md/device_remove_md boolean true +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +#d-i partman-auto-lvm/new_vg_name string + +d-i partman-auto/expert_recipe string madduck :: \ + 1 1 1 free \ + $gptonly{ } \ + $primary{ } \ + method{ biosgrub } \ + . \ + 8192 32768 -1 ext3 \ + $defaultignore{ } \ + $primary{ } \ + method{ lvm } \ + . \ + 128 1024 200% linux-swap \ + $lvmok{ } lv_name{ swap } \ + method{ swap } format{ } \ + . \ + 3072 6144 10240 ext3 \ + $lvmok{ } lv_name{ root } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } label{ root } \ + options/relatime{ noatime } \ + . \ + 2048 4096 8192 ext3 \ + $lvmok{ } lv_name{ var } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } label{ var } \ + options/relatime{ relatime } \ + options/user_xattr{ user_xattr } \ + . \ + 512 10240 -1 ext3 \ + $lvmok{ } lv_name{ srv } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /srv } label{ srv } \ + options/nodev{ nodev } \ + options/nosuid{ nosuid } \ + options/relatime{ relatime } \ + options/user_xattr{ user_xattr } \ + . \ + 512 768 1024 ext3 \ + $lvmok{ } lv_name{ tmp } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /tmp } label{ tmp } \ + options/nodev{ nodev } \ + options/nosuid{ nosuid } \ + options/relatime{ relatime } \ + options/user_xattr{ user_xattr } \ + . +d-i partman-auto/choose_recipe select madduck +d-i partman-auto-lvm/no_boot boolean true + +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +d-i apt-setup/non-free boolean false +d-i apt-setup/contrib boolean false +d-i base-installer/install-recommends boolean false + +popularity-contest popularity-contest/participate boolean false + +tasksel tasksel/first multiselect + +#d-i pkgsel/include string openssh-server libterm-readline-gnu-perl + +d-i grub-installer/only_debian boolean true +d-i grub-installer/choose_bootdev select manually +d-i grub-installer/bootdev text /dev/vda + +d-i finish-install/reboot_in_progress note + +d-i debian-installer/exit/poweroff boolean false +d-i debian-installer/exit/halt boolean false + +d-i preseed/early_command string tar -xf /commands.tar && rm /commands.tar && [ ! -x /commands/early_command ] || log-output -t early_command /commands/early_command +d-i preseed/late_command string [ ! -x /commands/late_command ] || log-output -t late_command /commands/late_command diff --git a/vinst b/vinst index ca6015a..88ce585 100755 --- a/vinst +++ b/vinst @@ -8,7 +8,7 @@ DISK=20 CPUS=1 STORAGE_POOL=default QEMU_URI=qemu:///system -SUITE=stretch +SUITE=buster CONSOLE='console=tty0 console=ttyS0,115200n8' DEBUG=0 WIPE=0 @@ -219,7 +219,7 @@ virt-install --connect=$QEMU_URI \ --graphics=vnc \ --serial=pty \ --watchdog i6300esb,action=reset \ - --os-variant=debianwheezy \ + --os-variant=debian10 \ --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \ --initrd-inject=$tmpdir/commands.tar \ --extra-args="$extra_kargs" \ -- 2.39.2