From 81ffb7197bbf92629d2cc16e43b56408ff42e318 Mon Sep 17 00:00:00 2001 From: nospoonuser Date: Sun, 27 May 2018 10:42:07 +0200 Subject: [PATCH] Added Service to generate SSH Key. Pretty banners. Language fix. --- scripts/bootstrap.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 0cb25cc..5d644b7 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -5,6 +5,7 @@ source $(dirname $0)/functions.sh echo "Build live" +BUILD_TIME=$(date +%Y-%m-%dT%H:%M) CHROOT=${WORKDIR}/chroot startstage bootstrap @@ -31,11 +32,16 @@ chroot $CHROOT apt -y install systemd #install live-boot chroot $CHROOT apt-get -y install live-boot +DEFAULT_PACKAGES=console-setup + #install additional packages if [ -n "${PACKAGES}" ]; then - chroot $CHROOT apt-get -y install ${PACKAGES} + DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ + LC_ALL=C LANGUAGE=C LANG=C chroot $CHROOT apt-get -y install ${DEFAULT_PACKAGES} ${PACKAGES} fi +echo "LANG=de_DE.UTF-8" >> $CHROOT/etc/default/locale + if [ "${LIVE_AUTOLOGIN}" == "true" ]; then requiredir "$CHROOT/etc/systemd/system/getty@tty1.service.d/" @@ -68,7 +74,32 @@ umount $CHROOT/proc/ umount $CHROOT/sys/ umount $CHROOT/dev/ + +if [ -x $CHROOT/usr/sbin/sshd ];then + +cat > $CHROOT/etc/systemd/system/regenerate_ssh_host_keys.service << EOF +[Unit] +Description=Regenerate SSH host keys +Before=ssh.service + +[Service] +Type=oneshot +ExecStartPre=-/bin/sh -c "/bin/rm -f -v /etc/ssh/ssh_host_*_key*" +ExecStart=/usr/bin/ssh-keygen -A -v +ExecStartPost=/bin/systemctl disable regenerate_ssh_host_keys + +[Install] +WantedBy=multi-user.target +EOF +[ -e ${CHROOT}/etc/systemd/system/multi-user.target.wants/regenerate_ssh_host_keys.service ] || ln -s ../regenerate_ssh_host_keys.service ${CHROOT}/etc/systemd/system/multi-user.target.wants/regenerate_ssh_host_keys.service + +fi + #final changes echo "${LIVE_HOSTNAME}" > $CHROOT/etc/hostname +echo "${LIVE_NAME} Build@${BUILD_TIME} \\l" > $CHROOT/etc/issue +echo "${LIVE_NAME} Build@${BUILD_TIME}" > $CHROOT/etc/issue.net +echo "" >> $CHROOT/etc/legal + endstage bootstrap