From c6da246b73cb7bba545850b1bba141ed91cb29bd Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Tue, 14 May 2013 11:48:58 +1200 Subject: [PATCH] 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 --- elements/fedora/install.d/01-rc-local | 4 ++++ lib/img-functions | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100755 elements/fedora/install.d/01-rc-local diff --git a/elements/fedora/install.d/01-rc-local b/elements/fedora/install.d/01-rc-local new file mode 100755 index 00000000..5d35b220 --- /dev/null +++ b/elements/fedora/install.d/01-rc-local @@ -0,0 +1,4 @@ +#!/bin/bash + +ln -s /etc/rc.local /etc/rc.d/rc.local +systemctl enable rc-local.service diff --git a/lib/img-functions b/lib/img-functions index 0edf4177..51444171 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -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 <> /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