]> git.madduck.net Git - code/vinst.git/blob - preseed/stretch/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:

change to stretch suite
[code/vinst.git] / preseed / stretch / commands / late_commands.d / post_boot_cleanup
1 #!/bin/sh
2
3 if [ -f /etc/inittab ]; then
4
5   SCRIPT=/etc/init.d/post_boot_cleanup
6   SYMLINK=/etc/rcS.d/S99post_boot_cleanup
7
8   cat >> $SCRIPT <<-_eof
9   #!/bin/sh
10   sed -i -e '/getty.*tty[12]/s/^#//' /etc/inittab
11   telinit q
12   update-rc.d ${SCRIPT##*/} remove
13   rm $SCRIPT
14         _eof
15
16   chmod 755 $SCRIPT
17   update-rc.d ${SCRIPT##*/} start S 99 .
18
19 else
20
21   SCRIPT=/usr/local/sbin/post_boot_cleanup
22   UNIT=/etc/systemd/system/multi-user.target.wants/post_boot_cleanup.service
23
24   cat >> $SCRIPT <<-_eof
25         #!/bin/sh
26         echo "Running post-install cleanup jobs..." >&2
27         touch /itworked
28         rm $SCRIPT $UNIT
29         _eof
30   chmod 755 $SCRIPT
31
32   cat >> $UNIT <<-_eof
33         [Unit]
34         Description=post-install cleanups
35         ConditionFileIsExecutable=$SCRIPT
36         After=multi-user.target
37
38         [Service]
39         Type=idle
40         ExecStart=$SCRIPT
41         TimeoutSec=0
42         RemainAfterExit=yes
43         SysVStartPriority=99
44         _eof
45
46 fi