Skip to content
Snippets Groups Projects
Commit 638422e1 authored by Thomas Woerner's avatar Thomas Woerner
Browse files

infra/image/shcontainer: Fix processing of multi item CAP_DEFAULTS

readarray expects to get an item per line to be added to the array.

Printing one item per line with printf fixes this to get the proper
formatting for "${CAP_DEFAULTS[@]}" as a valid input for readarray.
parent 43237652
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
SCRIPTDIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")" SCRIPTDIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")"
TOPDIR="$(readlink -f "${SCRIPTDIR}/../..")" TOPDIR="$(readlink -f "${SCRIPTDIR}/../..")"
# shellcheck disable=SC1091
. "${SCRIPTDIR}/shdefaults" . "${SCRIPTDIR}/shdefaults"
# shellcheck disable=SC1091 # shellcheck disable=SC1091
...@@ -15,7 +16,8 @@ container_create() { ...@@ -15,7 +16,8 @@ container_create() {
shift 2 shift 2
declare -a extra_opts declare -a extra_opts
readarray -t extra_opts < \ readarray -t extra_opts < \
<(sed -e "s/-/--cap-drop=/g" -e "s/+/--cap-add=/g" <<< "${CAP_DEFAULTS[@]}") <(sed -e "s/-/--cap-drop=/g" -e "s/+/--cap-add=/g" \
<<< "$(printf '%s\n' "${CAP_DEFAULTS[@]}")")
for opt in "$@" for opt in "$@"
do do
[ -z "${opt}" ] && continue [ -z "${opt}" ] && continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment