X-Git-Url: https://git.madduck.net/code/vinst.git/blobdiff_plain/10cac4edfc25c11d66c0950c22371c2f7a3fe615..b24e6815628d216f54a7fb57c82a74370258d50d:/preseed/jessie/commands/late_commands.d/post_boot_cleanup diff --git a/preseed/jessie/commands/late_commands.d/post_boot_cleanup b/preseed/jessie/commands/late_commands.d/post_boot_cleanup index f1fd808..569cfd8 100755 --- a/preseed/jessie/commands/late_commands.d/post_boot_cleanup +++ b/preseed/jessie/commands/late_commands.d/post_boot_cleanup @@ -1,15 +1,46 @@ #!/bin/sh -SCRIPT=/etc/init.d/post_boot_cleanup -SYMLINK=/etc/rcS.d/S99post_boot_cleanup +if [ -f /etc/inittab ]; then -cat >> $SCRIPT <<_eof -#!/bin/sh -sed -i -e '/getty.*tty[12]/s/^#//' /etc/inittab -telinit q -rm $SCRIPT -update-rc.d ${SCRIPT##*/} remove -_eof - -chmod 755 $SCRIPT -update-rc.d ${SCRIPT##*/} start S 99 . + 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/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