2 # Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/15-initsetup
3 # Purpose: configure init system for the live-system
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
14 fcopy -i -B -v -r /etc/systemd
16 echo "Enabling user '$USERNAME' for autologin"
17 sed -i "s/\$USERNAME/$USERNAME/" "$target"/etc/systemd/system/getty@tty*.service.d/override.conf
21 for file in "${target}"/etc/systemd/system/getty@tty*.service.d ; do
22 service=$(basename "$file" .d)
23 $ROOTCMD systemctl enable "$service" || echo "failed to enable $service"
27 # FIXME - ssh-keygen isn't executed yet before ssh-bootoption + ssh services
28 $ROOTCMD systemctl enable ssh-bootoption.service || echo "failed to enable ssh-bootoption.service"
29 $ROOTCMD systemctl enable ssh-keygen.service || echo "failed to enable ssh-keygen.service"
31 # fails on overlayfs with
32 # "Failed to unmount transient /etc/machine-id file in our private namespace: Invalid argument"
33 $ROOTCMD systemctl mask systemd-machine-id-commit.service || echo "failed to mask $systemd-machine-id-commit.service"
35 # disable unwanted services
39 lvm2-lvmetad.service \
41 lvm2-lvmpolld.socket \
42 lvm2-monitor.service \
47 systemd-timesyncd.service \
50 $ROOTCMD systemctl disable ${service} || echo "failed to disable $service"
56 # * *proper* integration for grml-autoconfig
57 $ROOTCMD systemctl enable grml-autoconfig.service || echo "failed to enable grml-autoconfig.service"
58 ln -sf /etc/systemd/system/grml-autoconfig.service "${target}"/etc/systemd/system/multi-user.target.wants/grml-autoconfig.service
60 # * avoid startup of any LSB scripts; NOTE: jessie doesn't support that
61 # system-generators approach yet, only >=stretch
62 mkdir -p "${target}"/etc/systemd/system-generators/
63 ln -sf /dev/null "${target}"/etc/systemd/system-generators/systemd-sysv-generator
64 # -> revert /etc/systemd/system-generators/systemd-sysv-generator && systemctl daemon-reload during *bootup*
65 # + possibly move this into startup so it's always executed on bootup, even with persistency enabled
66 # where the change towards systemd-sysv-generator might persist across
67 # reboots -> LSB scripts executed on reboots
71 if ! [ -r "${target}"/etc/runlevel.conf ] ; then
72 echo 'Warning: /etc/runlevel.conf does not exist...'
73 echo '... assuming we do not have file-rc, skipping 15-initsetup'
77 # keep a backup of the original runlevel.conf file for reference
78 if [ -r "${target}"/etc/runlevel.conf.original ] ; then
79 # make sure to store old backup files if they differ as well
80 if ! cmp "${target}"/etc/runlevel.conf "${target}"/etc/runlevel.conf.original >/dev/null ; then
81 cp "${target}"/etc/runlevel.conf.original "${target}/etc/runlevel.conf.original.$(date +%Y%m%d_%k:%M:%S)"
85 cp "${target}"/etc/runlevel.conf "${target}"/etc/runlevel.conf.original
87 # provide Grml's default file-rc configuration
88 fcopy -v /etc/runlevel.conf
90 # provide Grml's inittab configuration
92 sed -i "s/\$USERNAME\$/${USERNAME}/" "${target}"/etc/inittab
94 # provide Grml's bootlocal init scripts
95 fcopy -v -mroot,root,0755 /etc/init.d/bootlocal.first
96 fcopy -v -mroot,root,0755 /etc/init.d/bootlocal.middle
97 fcopy -v -mroot,root,0755 /etc/init.d/bootlocal.last
100 if ifclass FILE_RC ; then
106 ## END OF FILE #################################################################
107 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2