summaryrefslogtreecommitdiffstats
path: root/system-config/examples/live-config-foobar/components/9000-foobar
diff options
context:
space:
mode:
Diffstat (limited to 'system-config/examples/live-config-foobar/components/9000-foobar')
-rwxr-xr-xsystem-config/examples/live-config-foobar/components/9000-foobar67
1 files changed, 67 insertions, 0 deletions
diff --git a/system-config/examples/live-config-foobar/components/9000-foobar b/system-config/examples/live-config-foobar/components/9000-foobar
new file mode 100755
index 0000000..136943b
--- /dev/null
+++ b/system-config/examples/live-config-foobar/components/9000-foobar
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+## live-config-foobar(7) - Additional Configuration Components for live systems
+## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
+## Copyright (C) 2015 John Doe <john@example.org>
+##
+## live-config-foobar comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+Cmdline ()
+{
+ # Boot parameters can be acted up either this way...
+ if ! echo ${LIVE_CONFIG_CMDLINE} | grep -qs "example.foobar" && \
+ ! echo ${LIVE_CONFIG_CMDLINE} | grep -qs "foobar"
+ then
+ return
+ fi
+
+ # ...or if you want to specify certain options:
+ for _PARAMETER in ${LIVE_CONFIG_CMDLINE}
+ do
+ case "${_PARAMETER}" in
+ example.foobar=*|foobar=*)
+ EXAMPLE_FOOBAR="${_PARAMETER#*foobar=}"
+ ;;
+ esac
+ done
+}
+
+Init ()
+{
+ # Checking if package is installed or already configured
+ if [ ! -e /var/lib/dpkg/info/foobar.list ] || \
+ [ -e /var/lib/live/config/foobar ]
+ then
+ exit 0
+ fi
+
+ echo -n " foobar"
+}
+
+Config ()
+{
+ # Configuring foobar either this way...
+ if [ -n "${EXAMPLE_FOOBAR}" ]
+ then
+ sleep 1
+ fi
+
+ # ...or if you want to specify certain options:
+ case "${EXAMPLE_FOOBAR}" in
+ foo)
+ sleep 1
+ ;;
+ esac
+
+ # Creating state file
+ touch /var/lib/live/config/foobar
+}
+
+Cmdline
+Init
+Config