summaryrefslogtreecommitdiffstats
path: root/share/scripts/debconf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2018-07-24 15:16:08 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2018-07-27 02:49:12 +0000
commite3ffb010e83313d2f1686bc5a060a95eb4e160e6 (patch)
tree47a8db1ded8972278fea6b0d783d5de3f713fd7d /share/scripts/debconf
parentAdding reference to /var/cache/container-tools to container manpage. (diff)
downloadcompute-tools-e3ffb010e83313d2f1686bc5a060a95eb4e160e6.tar.xz
compute-tools-e3ffb010e83313d2f1686bc5a060a95eb4e160e6.zip
Adding support for multiple container and host commands in debconf container create script.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xshare/scripts/debconf25
-rwxr-xr-xshare/scripts/debconf.d/0003-debconf44
2 files changed, 69 insertions, 0 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 77a974a..a05b067 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -740,6 +740,18 @@ EOF
rm -f "${DIRECTORY}/.container-command"
fi
+
+ for NUMBER in $(seq 1 ${CONTAINER_COMMAND_NUMBER})
+ do
+ eval COMMAND="$`echo CONTAINER_COMMAND${NUMBER}`"
+
+ echo "${COMMAND}" > "${DIRECTORY}/.container-command"
+
+ chmod 0755 "${DIRECTORY}/.container-command"
+ Chroot "${DIRECTORY}" "sh /.container-command"
+
+ rm -f "${DIRECTORY}/.container-command"
+ done
}
Configure_network ()
@@ -988,6 +1000,19 @@ Commands ()
rm -f "${DIRECTORY}/.host-command"
fi
+ for NUMBER in $(seq 1 ${HOST_COMMAND_NUMBER})
+ do
+ eval COMMAND="$`echo HOST_COMMAND${NUMBER}`"
+
+ echo "${COMMAND}" > "${DIRECTORY}/.host-command"
+
+ cd "${DIRECTORY}"
+ sh "${DIRECTORY}/.host-command"
+ cd "${OLDPWD}"
+
+ rm -f "${DIRECTORY}/.host-command"
+ done
+
# Show root password in case its automatically set
case "${ROOT_RANDOM_PASSWORD}" in
true)
diff --git a/share/scripts/debconf.d/0003-debconf b/share/scripts/debconf.d/0003-debconf
index cb9ae2a..1d04adc 100755
--- a/share/scripts/debconf.d/0003-debconf
+++ b/share/scripts/debconf.d/0003-debconf
@@ -1025,6 +1025,28 @@ Internal_options ()
echo "CONTAINER_COMMAND=\"${CONTAINER_COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ NUMBER="1"
+
+ while db_get cnt-debconf/container-command${NUMBER} && [ "${RET}" ]
+ do
+ if db_get cnt-debconf/container-command${NUMBER}
+ then
+ eval CONTAINER_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty)
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+
+ CONTAINER_COMMAND_NUMBER="$((${NUMBER} - 1))"
+
+ echo "CONTAINER_COMMAND_NUMBER=\"${CONTAINER_COMMAND_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ for NUMBER in $(seq 1 ${CONTAINER_COMMAND_NUMBER})
+ do
+ eval COMMAND="$`echo CONTAINER_COMMAND${NUMBER}`"
+ echo "CONTAINER_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ done
+
if db_get cnt-debconf/host-command
then
HOST_COMMAND="${RET}" # string (w/ empty)
@@ -1032,6 +1054,28 @@ Internal_options ()
echo "HOST_COMMAND=\"${HOST_COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ NUMBER="1"
+
+ while db_get cnt-debconf/host-command${NUMBER} && [ "${RET}" ]
+ do
+ if db_get cnt-debconf/host-command${NUMBER}
+ then
+ eval HOST_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty)
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+
+ HOST_COMMAND_NUMBER="$((${NUMBER} - 1))"
+
+ echo "HOST_COMMAND_NUMBER=\"${HOST_COMMAND_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ for NUMBER in $(seq 1 ${HOST_COMMAND_NUMBER})
+ do
+ eval COMMAND="$`echo HOST_COMMAND${NUMBER}`"
+ echo "HOST_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ done
+
if db_get cnt-debconf/auto
then
CNT_AUTO="${RET:-true}" # string (w/o empty)