From b24e6815628d216f54a7fb57c82a74370258d50d Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 13 Nov 2014 15:29:21 +0100 Subject: [PATCH] migrate post-boot cleanup to systemd --- .../late_commands.d/post_boot_cleanup | 55 +++++++++++++++---- 1 file changed, 43 insertions(+), 12 deletions(-) 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 -- 2.39.2