X-Git-Url: https://git.madduck.net/code/vinst.git/blobdiff_plain/c4c55ce4a7853887d746ab8ad7471bf947b1bafc..9e1c6791342fb991a4b7e8d67b37a56765312322:/preseed/stretch/commands/late_commands.d/post_boot_cleanup diff --git a/preseed/stretch/commands/late_commands.d/post_boot_cleanup b/preseed/stretch/commands/late_commands.d/post_boot_cleanup new file mode 100755 index 0000000..4d03f20 --- /dev/null +++ b/preseed/stretch/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