mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-16 07:15:49 +01:00
pkg: Add exit code check and return
This commit is contained in:
@@ -116,35 +116,25 @@ pkg_run_command() {
|
|||||||
bastille_jail_path="${bastille_jailsdir}/${_jail}/root"
|
bastille_jail_path="${bastille_jailsdir}/${_jail}/root"
|
||||||
|
|
||||||
if [ -f "/usr/sbin/mport" ]; then
|
if [ -f "/usr/sbin/mport" ]; then
|
||||||
if ! jexec -l -U root "${_jail}" /usr/sbin/mport "$@"; then
|
jexec -l -U root "${_jail}" /usr/sbin/mport "$@"
|
||||||
errors=1
|
|
||||||
fi
|
|
||||||
elif [ -f "${bastille_jail_path}/usr/bin/apt" ]; then
|
elif [ -f "${bastille_jail_path}/usr/bin/apt" ]; then
|
||||||
if ! jexec -l "${_jail}" /usr/bin/apt "$@"; then
|
jexec -l "${_jail}" /usr/bin/apt "$@"
|
||||||
errors=1
|
|
||||||
fi
|
|
||||||
elif [ "${USE_HOST_PKG}" -eq 1 ]; then
|
elif [ "${USE_HOST_PKG}" -eq 1 ]; then
|
||||||
if [ "${AUTO_YES}" -eq 1 ]; then
|
if [ "${AUTO_YES}" -eq 1 ]; then
|
||||||
_jail_cmd="env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg -j ${_jail} $@"
|
env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg -j ${_jail} $@
|
||||||
else
|
else
|
||||||
_jail_cmd="/usr/sbin/pkg -j ${_jail} $@"
|
/usr/sbin/pkg -j ${_jail} $@
|
||||||
fi
|
|
||||||
if ! ${_jail_cmd}; then
|
|
||||||
errors=1
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "${AUTO_YES}" -eq 1 ]; then
|
if [ "${AUTO_YES}" -eq 1 ]; then
|
||||||
_jail_cmd="jexec -l -U root ${_jail} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg $@"
|
jexec -l -U root ${_jail} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg $@
|
||||||
else
|
else
|
||||||
_jail_cmd="jexec -l -U root ${_jail} /usr/sbin/pkg $@"
|
jexec -l -U root ${_jail} /usr/sbin/pkg $@
|
||||||
fi
|
|
||||||
if ! ${_jail_cmd}; then
|
|
||||||
errors=1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
errors=0
|
bastille_check_exit_code "${_jail}" "$?"
|
||||||
|
}
|
||||||
|
|
||||||
for _jail in ${JAILS}; do
|
for _jail in ${JAILS}; do
|
||||||
|
|
||||||
@@ -171,8 +161,4 @@ for _jail in ${JAILS}; do
|
|||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
|
|
||||||
if [ $errors -ne 0 ]; then
|
bastille_return_exit_code
|
||||||
error_exit "[ERROR]: Failed to apply on some jails, please check logs"
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user