mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-16 23:31:20 +01:00
Merge pull request #1221 from JRGTH/cp_cmd_update
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
usage() {
|
usage() {
|
||||||
error_notify "Usage: bastille cp [option(s)] TARGET HOST_PATH JAIL_PATH"
|
error_notify "Usage: bastille cp [option(s)] TARGET HOST_PATH JAIL_PATH"
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
-q | --quiet Suppress output.
|
-q | --quiet Suppress output.
|
||||||
@@ -65,7 +65,7 @@ while [ "$#" -gt 0 ]; do
|
|||||||
case ${_opt} in
|
case ${_opt} in
|
||||||
q) OPTION="-a" ;;
|
q) OPTION="-a" ;;
|
||||||
x) enable_debug ;;
|
x) enable_debug ;;
|
||||||
*) error_exit "[ERROR]: Unknown Option: \"${1}\"" ;;
|
*) error_exit "[ERROR]: Unknown Option: \"${1}\"" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
@@ -91,15 +91,22 @@ set_target "${TARGET}"
|
|||||||
for _jail in ${JAILS}; do
|
for _jail in ${JAILS}; do
|
||||||
|
|
||||||
info "\n[${_jail}]:"
|
info "\n[${_jail}]:"
|
||||||
|
|
||||||
host_path="${HOST_PATH}"
|
host_path="${HOST_PATH}"
|
||||||
jail_path="$(echo ${bastille_jailsdir}/${_jail}/root/${JAIL_PATH} | sed 's#//#/#g')"
|
jail_path="$(echo ${bastille_jailsdir}/${_jail}/root/${JAIL_PATH} | sed 's#//#/#g')"
|
||||||
|
|
||||||
if ! cp "${OPTION}" "${host_path}" "${jail_path}"; then
|
# Workaround to properly copy host resolv.conf to jail if the host file is a symlink.
|
||||||
|
if [ "${host_path}" = "${bastille_resolv_conf}" ] && [ -L "${host_path}" ]; then
|
||||||
|
_option="${OPTION}L"
|
||||||
|
else
|
||||||
|
_option="${OPTION}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! cp "${_option}" "${host_path}" "${jail_path}"; then
|
||||||
ERRORS=$((ERRORS + 1))
|
ERRORS=$((ERRORS + 1))
|
||||||
error_continue "[ERROR]: CP failed: ${host_path} -> ${jail_path}"
|
error_continue "[ERROR]: CP failed: ${host_path} -> ${jail_path}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${ERRORS}" -ne 0 ]; then
|
if [ "${ERRORS}" -ne 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user