Adding support for customizable components directory in /etc/live/debconfig.conf...
authorDaniel Baumann <mail@daniel-baumann.ch>
Mon, 11 Nov 2013 15:06:10 +0000 (16:06 +0100)
committerDaniel Baumann <mail@daniel-baumann.ch>
Mon, 11 Nov 2013 15:08:06 +0000 (16:08 +0100)
components/components
frontend/live-debconfig

index 4630895..a89a849 100755 (executable)
 
 set -e
 
+for _FILE in /etc/live/debconfig.conf /etc/live/debconfig/*
+do
+       if [ -e "${_FILE}" ]
+       then
+               . "${_FILE}"
+       fi
+done
+
+LIVE_COMPONENTS_DIRECTORY="${LIVE_COMPONENTS_DIRECTORY:-/lib/live/debconfig}"
+
 DEBCONF_SYSTEMRC="/var/lib/live/debconfig/systemrc"
 export DEBCONF_SYSTEMRC
 
@@ -17,7 +27,7 @@ export DEBCONF_SYSTEMRC
 
 _CMDLINE="${@}"
 
-_COMPONENTS="$(cd /lib/live/debconfig && for _COMPONENT in $(ls ????-* | grep -v '\.templates$' | sed -e 's|[0-9][0-9][0-9][0-9]-||g' | sort); do echo -n "${_COMPONENT}, "; done | sed -e 's|, $||')"
+_COMPONENTS="$(cd ${LIVE_COMPONENTS_DIRECTORY} && for _COMPONENT in $(ls ????-* | grep -v '\.templates$' | sed -e 's|[0-9][0-9][0-9][0-9]-||g' | sort); do echo -n "${_COMPONENT}, "; done | sed -e 's|, $||')"
 
 if [ -n "${_COMPONENTS}" ]
 then
index 1c7bd0f..7bfabd8 100755 (executable)
 
 set -e
 
+for _FILE in /etc/live/debconfig.conf /etc/live/debconfig/*
+do
+       if [ -e "${_FILE}" ]
+       then
+               . "${_FILE}"
+       fi
+done
+
+LIVE_COMPONENTS_DIRECTORY="${LIVE_COMPONENTS_DIRECTORY:-/lib/live/debconfig}"
+
 Cmdline ()
 {
        for _PARAMETER in ${_CMDLINE}
@@ -34,12 +44,12 @@ Cmdline ()
 
                        --debconfig)
                                # Run all components
-                               _COMPONENTS="$(cd /lib/live/debconfig && ls ????-* | grep -v '\.templates$')"
+                               _COMPONENTS="$(cd ${LIVE_COMPONENTS_DIRECTORY} && ls ????-* | grep -v '\.templates$')"
                                ;;
 
                        --nodebconfig=*)
                                # Don't run requested components
-                               _COMPONENTS="$(cd /lib/live/debconfig && ls ????-* | grep -v '\.templates$')"
+                               _COMPONENTS="$(cd ${LIVE_COMPONENTS_DIRECTORY} && ls ????-* | grep -v '\.templates$')"
                                LIVE_NODEBCONFIGS="${_PARAMETER#*nodebconfig=}"
                                ;;
 
@@ -161,7 +171,14 @@ Main ()
        done
 
        # Show debconf components dialog
-       /lib/live/debconfig/components ${_COMPONENTS}
+       for _FILE in "${LIVE_COMPONENTS_DIRECTORY}"/components /lib/live/debconfig/components
+       do
+               if [ -e "${_FILE}" ]
+               then
+                       "${LIVE_COMPONENTS_DIRECTORY}"/components ${_COMPONENTS}
+                       break
+               fi
+       done
 
        . /var/lib/live/debconfig/components
        rm -f /var/lib/live/debconfig/components
@@ -171,12 +188,12 @@ Main ()
 
        for _COMPONENT in ${_COMPONENTS}
        do
-               if ls /lib/live/debconfig/????-${_COMPONENT} > /dev/null
+               if ls "${LIVE_COMPONENTS_DIRECTORY}"/????-${_COMPONENT} > /dev/null
                then
                        [ "${LIVE_DEBUG}" = "true" ] && echo "[$(date +'%F %T')] live-debconfig: ${_COMPONENT}" >> /var/log/live/debconfig.log
-                       /lib/live/debconfig/????-${_COMPONENT}
+                       "${LIVE_COMPONENTS_DIRECTORY}"/????-${_COMPONENT}
                else
-                       echo "W: ${_COMPONENT} - no such component in /lib/live/debconfig, skipping."
+                       echo "W: ${_COMPONENT} - no such component in ${LIVE_COMPONENTS_DIRECTORY}, skipping."
                fi
        done
 }