added noerror function to execute stuff outside of error control system
This commit is contained in:
@@ -81,6 +81,20 @@ function backtrace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Execute command outside of error control
|
||||||
|
noerror()
|
||||||
|
{
|
||||||
|
set +o errexit
|
||||||
|
trap - ERR
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
trap "error ${LINENO}" ERR
|
||||||
|
set -o errexit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Test and exit if not root (or any UID 0 user)
|
# Test and exit if not root (or any UID 0 user)
|
||||||
check_root()
|
check_root()
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ upgrade_dist()
|
|||||||
precheck_upgrade_dist()
|
precheck_upgrade_dist()
|
||||||
{
|
{
|
||||||
prnt I "Vérification du réseau..."
|
prnt I "Vérification du réseau..."
|
||||||
wget -q --tries=10 --timeout=20 --spider http://www.cnrs.fr
|
noerror wget -q --tries=10 --timeout=20 --spider http://www.cnrs.fr
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
prnt E "Réseau non fonctionnel ! Abandon."
|
prnt E "Réseau non fonctionnel ! Abandon."
|
||||||
die 160
|
die 160
|
||||||
|
|||||||
Reference in New Issue
Block a user