Fix for running /etc/rc.local on Fedora

With systemd rc.local lives in /etc/rc.d and is only run
if the rc-local service is enabled.

This change creates a /etc/rc.d/rc.local symlink, and modifies img-functions
prepare_first_boot to tolerate an initially missing /etc/rc.local.

Fixes bug #1179674

Change-Id: I7e6102b62224950c1de5d48205dc4feff60f9389
This commit is contained in:
Steve Baker 2013-05-14 11:48:58 +12:00
parent 6b44b6d274
commit c6da246b73
2 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,4 @@
#!/bin/bash
ln -s /etc/rc.local /etc/rc.d/rc.local
systemctl enable rc-local.service

View File

@ -129,7 +129,9 @@ function prepare_first_boot () {
check_break before-first-boot run_in_target bash
if [ -d ${TMP_HOOKS_PATH}/first-boot.d ] ; then
sudo cp -t $TMP_MOUNT_PATH/etc/ -a $TMP_HOOKS_PATH/first-boot.d
run_in_target mv /etc/rc.local /etc/rc.local.REAL
if [ -f $TMP_MOUNT_PATH/etc/rc.local ] ; then
run_in_target mv /etc/rc.local /etc/rc.local.REAL
fi
sudo dd of=$TMP_MOUNT_PATH/etc/rc.local <<EOF
#!/bin/bash
set -e
@ -140,7 +142,10 @@ chmod 0600 /var/log/first-boot.d.log
run-parts /etc/first-boot.d >> /var/log/first-boot.d.log 2>&1
rm -fr /etc/first-boot.d
mv /etc/rc.local.REAL /etc/rc.local
rm -f /etc/rc.local
if [ -f /etc/rc.local.REAL ] ; then
mv /etc/rc.local.REAL /etc/rc.local
fi
exit 0
EOF
run_in_target chmod 755 /etc/rc.local