summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-08-19 08:06:36 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-08-19 09:20:40 +0000
commitf7359323e5caf8f532f9ec528b7b8934c4911d92 (patch)
treee9dc6e60070486cf789159b75101fd64efe70bb0
parentCopying build-scripts as create-scripts to refactor and unify get and build s... (diff)
downloadcompute-tools-f7359323e5caf8f532f9ec528b7b8934c4911d92.tar.xz
compute-tools-f7359323e5caf8f532f9ec528b7b8934c4911d92.zip
Avoid passing create command parameter to scripts in container create command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-xlibexec/container/create6
-rwxr-xr-xshare/create-scripts/debconf29
-rwxr-xr-xshare/create-scripts/debootstrap29
3 files changed, 9 insertions, 55 deletions
diff --git a/libexec/container/create b/libexec/container/create
index 13a3bc8..e12fa00 100755
--- a/libexec/container/create
+++ b/libexec/container/create
@@ -30,6 +30,8 @@ MACHINES="/var/lib/machines"
SCRIPTS="/usr/share/${SOFTWARE}/create-scripts"
CONFIG_TEMPLATE="/usr/share/${SOFTWARE}/config/container.conf.in"
+SCRIPT_OPTIONS=""
+
Parameters ()
{
GETOPT_LONGOPTIONS="name:,cnt.auto:,cnt.container-server:,cnt.overlay:,cnt.overlay-options:,cnt.start:,bind:,bind-ro:,capability:,drop-capability:,script:,verbose,"
@@ -50,6 +52,7 @@ Parameters ()
case "${1}" in
-n|--name)
NAME="${2}"
+ SCRIPT_OPTIONS="${SCRIPT_OPTIONS} --name ${NAME}"
shift 2
;;
@@ -105,6 +108,7 @@ Parameters ()
-v|--verbose)
VERBOSE="true"
+ SCRIPT_OPTIONS="${SCRIPT_OPTIONS} --verbose"
shift 1
;;
@@ -272,7 +276,7 @@ sed -e "s|@CNT_AUTO@|${CNT_AUTO}|g" \
"${CONFIG_TEMPLATE}" > "${CONFIG}/${NAME}.conf"
# Run
-"${SCRIPTS}/${SCRIPT}" $(echo "${@}" | sed -e 's| -- | |')
+"${SCRIPTS}/${SCRIPT}" ${SCRIPT_OPTIONS} $(echo "${@}" | awk -F\ \-\-\ '{ print $2 }')
# Post hooks
for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}"
diff --git a/share/create-scripts/debconf b/share/create-scripts/debconf
index 39856ae..24a3d71 100755
--- a/share/create-scripts/debconf
+++ b/share/create-scripts/debconf
@@ -33,8 +33,8 @@ MACHINES="/var/lib/machines"
Parameters ()
{
- GETOPT_LONGOPTIONS="bind:,bind-ro:,script:,name:,preseed-file:"
- GETOPT_OPTIONS="b:,s:,n:,p:"
+ GETOPT_LONGOPTIONS="name:,preseed-file:"
+ GETOPT_OPTIONS="n:,p:"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${SCRIPT} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -49,31 +49,6 @@ Parameters ()
while true
do
case "${1}" in
- -b|--bind)
- # ignore
- shift 2
- ;;
-
- --bind-ro)
- # ignore
- shift 2
- ;;
-
- --cnt.auto)
- # ignore
- shift 2
- ;;
-
- --cnt.container-server)
- # ignore
- shift 2
- ;;
-
- -s|--script)
- # ignore
- shift 2
- ;;
-
-n|--name)
NAME="${2}"
shift 2
diff --git a/share/create-scripts/debootstrap b/share/create-scripts/debootstrap
index 4c047ee..01345f9 100755
--- a/share/create-scripts/debootstrap
+++ b/share/create-scripts/debootstrap
@@ -30,8 +30,8 @@ MACHINES="/var/lib/machines"
Parameters ()
{
- GETOPT_LONGOPTIONS="bind:,bind-ro:,script:,name:,architecture:,distribution:,mirror:,password:"
- GETOPT_OPTIONS="b:,s:,n:,a:,d:,m:,p:"
+ GETOPT_LONGOPTIONS="name:,architecture:,distribution:,mirror:,password:"
+ GETOPT_OPTIONS="n:,a:,d:,m:,p:"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${SCRIPT} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -46,31 +46,6 @@ Parameters ()
while true
do
case "${1}" in
- -b|--bind)
- # ignore
- shift 2
- ;;
-
- --bind-ro)
- # ignore
- shift 2
- ;;
-
- --cnt.auto)
- # ignore
- shift 2
- ;;
-
- --cnt.container-server)
- # ignore
- shift 2
- ;;
-
- -s|--script)
- # ignore
- shift 2
- ;;
-
-n|--name)
NAME="${2}"
shift 2