diff --git a/post-debootstrap-installer.sh b/post-debootstrap-installer.sh index 6431f99..6f862cc 100755 --- a/post-debootstrap-installer.sh +++ b/post-debootstrap-installer.sh @@ -21,20 +21,20 @@ apt-get -y install mdadm cryptsetup systemd systemd-sysv dropbear mdadm --examine --scan | perl -pe 's/.*\/dev\/md\/?([0-9]+) .*UUID\=(.+?) .*/ARRAY \/dev\/md$1 UUID=$2/' > /etc/mdadm/mdadm.conf # concat user keys for cryptsetup unlocking at boot -cat /authorized_keys/* > /etc/dropbear-initramfs/authorized_keys +cat /hardware-setup/authorized_keys/* > /etc/dropbear-initramfs/authorized_keys # after cryptsetup, mdadm, ... because of update-initramfs apt-get -y install linux-image-amd64 DEBIAN_FRONTEND=noninteractive apt-get -y install grub-pc -/grub.sh +/hardware-setup/grub.sh update-grub ### users apt-get -y install sudo -for key in /authorized_keys/*; do +for key in /hardware-setup/authorized_keys/*; do user=$(basename "$key") adduser --gecos '' --disabled-password "$user" @@ -50,7 +50,7 @@ done # add docker key apt-get -y install gnupg2 -apt-key add docker.key +apt-key add /hardware-setup/docker.key apt-get -y --purge autoremove gnupg2 echo 'deb https://download.docker.com/linux/debian buster stable' > /etc/apt/sources.list.d/docker.list diff --git a/setup.sh b/setup.sh index 82f95fd..9c26c04 100755 --- a/setup.sh +++ b/setup.sh @@ -40,27 +40,14 @@ mount -t sysfs none "$chroot/sys" mount -o bind /dev "$chroot/dev" -# copy fstab, crypttab, ... -cd config -cp -a * "$chroot" -cd .. - -# copy parted.sh, grub.sh, ... -cd "hardware/${1}" -cp -a * "$chroot" -cd ../.. - -# copy a couple of other files -cp -a docker.key \ - post-debootstrap-installer.sh \ - authorized_keys \ - "$chroot" - # set hostname echo "$2" > "$chroot/etc/hostname" -chroot "$chroot" /post-debootstrap-installer.sh -rm -r "$chroot/docker.key" \ - "$chroot/post-debootstrap-installer.sh" \ - "$chroot/authorized_keys" +# create hardware-setup copy for post-debootstrap +mkdir "$chroot/hardware-setup" +cp -a * "$chroot/hardware-setup" + +chroot "$chroot" /hardware-setup/post-debootstrap-installer.sh + +rm -r "$chroot/hardware-setup"