summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/initramfs/distro-specs/ubuntu/functions-default28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/initramfs/distro-specs/ubuntu/functions-default b/src/initramfs/distro-specs/ubuntu/functions-default
index 1fdbf6bb..51027c90 100644
--- a/src/initramfs/distro-specs/ubuntu/functions-default
+++ b/src/initramfs/distro-specs/ubuntu/functions-default
@@ -80,6 +80,34 @@ initial_boot () {
:
}
+upstart_set_starton () {
+ local script="$1"
+ local starton="$2"
+ local file_not_found="f"
+
+ if [ -e /mnt/etc/init.inactive/${script}.conf ]; then
+ local script_path=/mnt/etc/init.inactive/${script}.conf
+ elif [ -e /mnt/etc/init/${script}.conf ]; then
+ local script_path=/mnt/etc/init/${script}.conf
+ else
+ local file_not_found="t"
+ fi
+
+ if [ "$file_not_found" = "f" ]; then
+ # replace multi-line dependencies with ##starton##
+ sed -n '1h;1!H;${;g;s/start on[\t ]*([^)]*)/start on ##starton##/g;p;}' \
+ -i $script_path
+ # replace single-line dependencies with ##starton##
+ sed -e 's/start on.*$/start on ##starton##/' \
+ -i $script_path
+ # replace placeholder with our new value
+ sed -e "s,##starton##,$starton,"
+ -i $script_path
+ else
+ error "Script: ${script} does not exist. Skipping modification.." nonfatal}
+ fi
+}
+
# runlevel linker - mostly deprecated in the old form because of new upstart
# mechanism (with backward compatibility)
rllinker () {