mirror of
https://github.com/docker-mailserver/docker-mailserver
synced 2024-10-18 19:29:45 +02:00
Update setup.sh
Add script options -z and -Z to handle SELinux environments.
This commit is contained in:
parent
c22c25d623
commit
8665803253
17
setup.sh
17
setup.sh
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user