Merge pull request #553 from frikilax/pkg_report_errors
PKG::ADDED:: return error code and print error message when 'bastille pkg' fails
This commit is contained in:
@@ -45,17 +45,32 @@ if [ $# -lt 1 ]; then
|
|||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
errors=0
|
||||||
|
|
||||||
for _jail in ${JAILS}; do
|
for _jail in ${JAILS}; do
|
||||||
info "[${_jail}]:"
|
info "[${_jail}]:"
|
||||||
bastille_jail_path=$(/usr/sbin/jls -j "${_jail}" path)
|
bastille_jail_path=$(/usr/sbin/jls -j "${_jail}" path)
|
||||||
if [ -f "/usr/sbin/mport" ]; then
|
if [ -f "/usr/sbin/mport" ]; then
|
||||||
jexec -l -U root "${_jail}" /usr/sbin/mport "$@"
|
if ! jexec -l -U root "${_jail}" /usr/sbin/mport "$@"; then
|
||||||
|
errors=1
|
||||||
|
fi
|
||||||
elif [ -f "${bastille_jail_path}/usr/bin/apt" ]; then
|
elif [ -f "${bastille_jail_path}/usr/bin/apt" ]; then
|
||||||
jexec -l "${_jail}" /usr/bin/apt "$@"
|
if ! jexec -l "${_jail}" /usr/bin/apt "$@"; then
|
||||||
|
errors=1
|
||||||
|
fi
|
||||||
elif [ "${USE_HOST_PKG}" = 1 ]; then
|
elif [ "${USE_HOST_PKG}" = 1 ]; then
|
||||||
/usr/sbin/pkg -j "${_jail}" "$@"
|
if ! /usr/sbin/pkg -j "${_jail}" "$@"; then
|
||||||
|
errors=1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
jexec -l -U root "${_jail}" /usr/sbin/pkg "$@"
|
if ! jexec -l -U root "${_jail}" /usr/sbin/pkg "$@"; then
|
||||||
|
errors=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ $errors -ne 0 ]; then
|
||||||
|
error_exit "Failed to apply on some jails, please check logs"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user