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 CDIR CRI INFO IMAGE_NAME CONTAINER_NAME DEFAULT_CONFIG_PATH
|
||||||
unset USE_CONTAINER WISHED_CONFIG_PATH CONFIG_PATH VOLUME USE_TTY
|
unset USE_CONTAINER WISHED_CONFIG_PATH CONFIG_PATH VOLUME USE_TTY
|
||||||
unset SCRIPT
|
unset SCRIPT USING_SELINUX
|
||||||
}
|
}
|
||||||
|
|
||||||
function _get_current_directory
|
function _get_current_directory
|
||||||
|
@ -55,6 +55,7 @@ WISHED_CONFIG_PATH=
|
||||||
CONFIG_PATH=
|
CONFIG_PATH=
|
||||||
VOLUME=
|
VOLUME=
|
||||||
USE_TTY=
|
USE_TTY=
|
||||||
|
USING_SELINUX=
|
||||||
|
|
||||||
function _check_root
|
function _check_root
|
||||||
{
|
{
|
||||||
|
@ -116,6 +117,14 @@ OPTIONS:
|
||||||
|
|
||||||
-h Show this help dialogue
|
-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:
|
SUBCOMMANDS:
|
||||||
|
|
||||||
email:
|
email:
|
||||||
|
@ -184,7 +193,7 @@ function _docker_image
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${CRI} run --rm \
|
${CRI} run --rm \
|
||||||
-v "${CONFIG_PATH}":/tmp/docker-mailserver \
|
-v "${CONFIG_PATH}":/tmp/docker-mailserver"${USING_SELINUX}" \
|
||||||
"${USE_TTY}" "${IMAGE_NAME}" "${@}"
|
"${USE_TTY}" "${IMAGE_NAME}" "${@}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -240,7 +249,7 @@ function _main
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local OPTIND
|
local OPTIND
|
||||||
while getopts ":c:i:p:h" OPT
|
while getopts ":c:i:p:hzZ" OPT
|
||||||
do
|
do
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
c) CONTAINER_NAME="${OPTARG}" ; USE_CONTAINER=true ;; # container specified, connect to running instance
|
c) CONTAINER_NAME="${OPTARG}" ; USE_CONTAINER=true ;; # container specified, connect to running instance
|
||||||
|
@ -259,6 +268,8 @@ function _main
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
h) _usage ; return ;;
|
h) _usage ; return ;;
|
||||||
|
z) USING_SELINUX=":z" ;;
|
||||||
|
Z) USING_SELINUX=":Z" ;;
|
||||||
*) echo "Invalid option: -${OPTARG}" >&2 ;;
|
*) echo "Invalid option: -${OPTARG}" >&2 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue