Compare commits
1 Commits
4d0220f129
...
f2143633c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2143633c5 |
@@ -75,7 +75,6 @@ EOF
|
||||
|
||||
# Unset vars
|
||||
unset _array
|
||||
declare -a _quiet=(">" "/dev/null" "2>&1")
|
||||
|
||||
# Parse input and set switches using getopt
|
||||
if _input=$(getopt -o +c:i:r:a:ndsh -l container:,image:,release:,ephemeral,recreate,no-sh,debug,array:,silent,help -- "$@"); then
|
||||
@@ -102,7 +101,6 @@ EOF
|
||||
;;
|
||||
--debug)
|
||||
_debug="true"
|
||||
unset _quiet
|
||||
echo "Debugging on!"
|
||||
;;
|
||||
--array|-a)
|
||||
@@ -143,6 +141,8 @@ EOF
|
||||
declare -a _cmd_array
|
||||
_program="$1"
|
||||
_cmd_array=("$@")
|
||||
|
||||
[[ -n $_debug ]] && echo "_cmd_array:" "${_cmd_array[@]}"
|
||||
}
|
||||
|
||||
|
||||
@@ -153,8 +153,6 @@ EOF
|
||||
if [[ -z $_no_sh ]]; then
|
||||
_cmd_array=("sh" "-c" "${_cmd_array[@]}")
|
||||
fi
|
||||
|
||||
[[ -n $_debug ]] && echo "_cmd_array:" "${_cmd_array[@]}"
|
||||
}
|
||||
|
||||
|
||||
@@ -166,20 +164,11 @@ EOF
|
||||
}
|
||||
|
||||
|
||||
_toolboxCreate () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
toolbox create -c "$_cname" "${_image[@]}" "${_release[@]}" "${_quiet[@]}"
|
||||
|
||||
}
|
||||
|
||||
|
||||
_toolboxRemove () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
toolbox rm "$_cname" "${_quiet[@]}"
|
||||
toolbox rm "$_cname"
|
||||
}
|
||||
|
||||
|
||||
@@ -191,6 +180,14 @@ EOF
|
||||
}
|
||||
|
||||
|
||||
_toolboxCreate () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
toolbox create -c "$_cname" "${_image[@]}" "${_release[@]}"
|
||||
}
|
||||
|
||||
|
||||
__main () {
|
||||
|
||||
# Get input
|
||||
@@ -204,18 +201,15 @@ EOF
|
||||
|
||||
# Check if container exists
|
||||
if _toolboxExists; then
|
||||
if [[ -n $_recreate ]]; then # First remove container if --recreate
|
||||
_toolboxRemove
|
||||
fi
|
||||
[[ -n $_recreate ]] && _toolboxRemove
|
||||
else
|
||||
_toolboxCreate
|
||||
fi
|
||||
|
||||
_toolboxRun
|
||||
|
||||
if [[ -n $_ephemeral ]]; then
|
||||
_toolboxRemove
|
||||
fi
|
||||
[[ -n $_ephemeral ]] && _toolboxRemove
|
||||
|
||||
}
|
||||
|
||||
# Allow this function to be executed directly
|
||||
|
||||
Reference in New Issue
Block a user