Update setup.sh

Add script options -z and -Z to handle SELinux environments.
This commit is contained in:
omarc1492 2020-10-30 10:43:31 -05:00 committed by GitHub
parent c22c25d623
commit 8665803253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 3 deletions

View File

@ -27,7 +27,7 @@ function _unset_vars
{
unset CDIR CRI INFO IMAGE_NAME CONTAINER_NAME DEFAULT_CONFIG_PATH
unset USE_CONTAINER WISHED_CONFIG_PATH CONFIG_PATH VOLUME USE_TTY
unset SCRIPT
unset SCRIPT USING_SELINUX
}
function _get_current_directory
@ -55,6 +55,7 @@ WISHED_CONFIG_PATH=
CONFIG_PATH=
VOLUME=
USE_TTY=
USING_SELINUX=
function _check_root
{
@ -116,6 +117,14 @@ OPTIONS:
-h Show this help dialogue
-z Allow container access to the bind mount content
that is shared among multiple containers
on a SELinux-enabled host.
-Z Allow container access to the bind mount content
that is private and unshared with other containers
on a SELinux-enabled host.
SUBCOMMANDS:
email:
@ -184,7 +193,7 @@ function _docker_image
fi
${CRI} run --rm \
-v "${CONFIG_PATH}":/tmp/docker-mailserver \
-v "${CONFIG_PATH}":/tmp/docker-mailserver"${USING_SELINUX}" \
"${USE_TTY}" "${IMAGE_NAME}" "${@}"
fi
}
@ -240,7 +249,7 @@ function _main
fi
local OPTIND
while getopts ":c:i:p:h" OPT
while getopts ":c:i:p:hzZ" OPT
do
case ${OPT} in
c) CONTAINER_NAME="${OPTARG}" ; USE_CONTAINER=true ;; # container specified, connect to running instance
@ -259,6 +268,8 @@ function _main
fi
;;
h) _usage ; return ;;
z) USING_SELINUX=":z" ;;
Z) USING_SELINUX=":Z" ;;
*) echo "Invalid option: -${OPTARG}" >&2 ;;
esac
done