X-Git-Url: https://git.madduck.net/code/vinst.git/blobdiff_plain/56ebc8501fd24ca8a2d1c7ecb224d7e667a26b86..fae448a5aa16aa50bbc5cf0fafd692d487754d18:/preseed/buster/commands/late_commands.d/post_boot_cleanup 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