From: martin f. krafft Date: Thu, 13 Nov 2014 14:29:21 +0000 (+0100) Subject: migrate post-boot cleanup to systemd X-Git-Url: https://git.madduck.net/code/vinst.git/commitdiff_plain/b24e6815628d216f54a7fb57c82a74370258d50d?ds=sidebyside migrate post-boot cleanup to systemd --- 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