]> git.madduck.net Git - code/vinst.git/blobdiff - preseed/jessie/commands/late_commands.d/post_boot_cleanup

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not fetch hostname from rDNS
[code/vinst.git] / preseed / jessie / commands / late_commands.d / post_boot_cleanup
index f1fd8082ca795f851f7308eb4dc0a3e9f9ec27d3..4d03f2019d6845cc569700704158d58d296eb602 100755 (executable)
@@ -1,15 +1,46 @@
 #!/bin/sh
 
 #!/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/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