From 41757e9acf184629b76ff88016e5ec37633e5e93 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 25 Oct 2019 15:28:15 +0200 Subject: [SSPS] Fix check for rc-local; bail out on error; remove systemd check --- satellit_installer/includes/10-script_dropper.inc | 42 +++++++++++------------ 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'satellit_installer') diff --git a/satellit_installer/includes/10-script_dropper.inc b/satellit_installer/includes/10-script_dropper.inc index e9802ea..512b4cf 100644 --- a/satellit_installer/includes/10-script_dropper.inc +++ b/satellit_installer/includes/10-script_dropper.inc @@ -18,7 +18,7 @@ drop_script() { } drop_keychanger_rclocal() { - if grep -q "Deleting old ssh keys" /etc/rc.local; then + if grep -q -F "/root/installer/rclocal_script.sh" /etc/rc.local; then echo "# ssh key changer already in rc.local; doing nothing." else echo @@ -26,34 +26,32 @@ drop_keychanger_rclocal() { cp -p /etc/rc.local /etc/rc.local.sik cat > /etc/rc.local <<-HIERDOK #!/bin/bash - echo "rc.local started: $(date "+%Y-%m-%d %H:%m:%S")" >> /root/init.log + echo "rc.local created: $(date "+%Y-%m-%d %H:%m:%S")" >> /root/init.log echo "Starting /root/installer/rclocal_script.sh..." >> /root/init.log /root/installer/rclocal_script.sh exit 0 HIERDOK chmod +x /etc/rc.local fi - if [ "$SYSTEMD" ]; then - cat > /etc/systemd/system/rc-local.service <<-DORTDOK - [Unit] - Description=/etc/rc.local Compatibility - ConditionFileIsExecutable=/etc/rc.local - After=network.target mysql.service - - [Service] - Type=forking - ExecStart=/etc/rc.local start - TimeoutSec=0 - RemainAfterExit=yes - SysVStartPriority=99 - - [Install] - WantedBy=multi-user.target - DORTDOK + cat > /etc/systemd/system/rc-local.service <<-DORTDOK + [Unit] + Description=/etc/rc.local Compatibility + ConditionFileIsExecutable=/etc/rc.local + After=network.target mysql.service + + [Service] + Type=forking + ExecStart=/etc/rc.local start + TimeoutSec=0 + RemainAfterExit=yes + SysVStartPriority=99 + + [Install] + WantedBy=multi-user.target + DORTDOK - systemctl reenable rc-local >/dev/null - [ $? -ne 0 ] && echo "Warning - could not enable systemd service rc-local!" - fi + systemctl daemon-reload + systemctl reenable rc-local || perror "Could not enable systemd service rc-local!" } drop_firstrun_script () { -- cgit v1.2.3-55-g7522