removed [[ TEST ]] && action form for if [[ TEST ]]; then action; fi for compatibility
This commit is contained in:
@@ -85,7 +85,9 @@ function backtrace
|
||||
# Test and exit if not root (or any UID 0 user)
|
||||
check_root()
|
||||
{
|
||||
[[ $NO_ROOT_CHECK == true ]] && return 0
|
||||
if [[ $NO_ROOT_CHECK == true ]]; then
|
||||
return 0
|
||||
fi
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
prnt E "Ce script doit être démarré en tant que root. Arrêt."
|
||||
die 4 --force
|
||||
|
||||
@@ -23,9 +23,10 @@ export -f stdtime
|
||||
# (or any old files if runned several time on same file)
|
||||
backupdist()
|
||||
{
|
||||
[[ $# -lt 1 ]] &&
|
||||
prnt E "backupdist(): At least one argument is required." &&
|
||||
if [[ $# -lt 1 ]]; then
|
||||
prnt E "backupdist(): At least one argument is required."
|
||||
exit 11
|
||||
fi
|
||||
|
||||
for file in $@; do
|
||||
if [[ -f ${file} ]]; then
|
||||
@@ -53,14 +54,14 @@ installfile()
|
||||
local filelist=""
|
||||
local i=0
|
||||
|
||||
[[ $# -lt 2 ]] && (
|
||||
if [[ $# -lt 2 ]]; then
|
||||
prnt E "installfile(): At least two arguments are required."
|
||||
die 11
|
||||
)
|
||||
[[ $(echo $@ | grep "\*\|\?") ]] && (
|
||||
fi
|
||||
if [[ $(echo $@ | grep "\*\|\?") ]]; then
|
||||
prnt E "installfile(): Wildcards are not authorized."
|
||||
die 7
|
||||
)
|
||||
fi
|
||||
|
||||
for arg in $@; do
|
||||
if [[ -f $MYPATH/repo/hosts/$HOSTNAME/$arg ]]; then
|
||||
|
||||
@@ -24,7 +24,10 @@ export -f pkgupdt
|
||||
pkginst()
|
||||
{
|
||||
prnt I "Installation de paquets..."
|
||||
[[ $# -lt 1 ]] && prnt E "pkginst(): des paramètres sont requis." && exit 11
|
||||
if [[ $# -lt 1 ]]; then
|
||||
prnt E "pkginst(): des paramètres sont requis."
|
||||
exit 11
|
||||
fi
|
||||
if [[ ! $INSTALL_MODE == dev ]]; then
|
||||
$PKG_MAN $COM_INSTALL $@
|
||||
else
|
||||
@@ -51,7 +54,10 @@ export -f pkgupgd
|
||||
pkgrem()
|
||||
{
|
||||
prnt I "Désinstallation de paquets..."
|
||||
[[ $# -lt 1 ]] && prnt E "pkgrem(): des paramètres sont requis." && exit 11
|
||||
if [[ $# -lt 1 ]]; then
|
||||
prnt E "pkgrem(): des paramètres sont requis."
|
||||
exit 11
|
||||
fi
|
||||
if [[ ! $INSTALL_MODE == dev ]]; then
|
||||
$PKG_MAN $COM_REMOVE $@
|
||||
else
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
# Syntax exec_serv svcname command
|
||||
exec_serv()
|
||||
{
|
||||
[[ $# -lt 2 ]] && (
|
||||
if [[ $# -lt 2 ]]; then
|
||||
prnt E "exec_serv(): Erreur de syntaxe !"
|
||||
exit 11
|
||||
)
|
||||
fi
|
||||
|
||||
local svcname=$1 command=$2
|
||||
shift 2
|
||||
|
||||
@@ -76,8 +76,9 @@ show_version()
|
||||
local version=VER_$modname
|
||||
echo -e "\t$BWhite$modname${DEFAULTCOL}: $BGreen${!version}$DEFAULTCOL"
|
||||
done
|
||||
[[ $EUID -ne 0 ]] &&
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
echo -e "\n${BYellow}Attention :$DEFAULTCOL Ce script requiert les droits d'administration pour fonctionner."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,8 @@ read_commandline()
|
||||
done
|
||||
|
||||
# If those var are true at that point, something is wrong
|
||||
if [[ $want_logfile == true ]] || [[ $want_module == true ]] || [[ $want_conffile == true ]]; then
|
||||
if [[ $want_logfile == true ]] || [[ $want_module == true ]] ||
|
||||
[[ $want_conffile == true ]]; then
|
||||
syntax_error
|
||||
fi
|
||||
}
|
||||
@@ -149,28 +150,28 @@ process_commandline_and_vars()
|
||||
{
|
||||
# Check unconsistant parameters
|
||||
if [[ $CHECK_ONLY == true ]]; then
|
||||
[[ $JUMP == true ]] && (
|
||||
if [[ $JUMP == true ]]; then
|
||||
prnt E "Les options --check-only et --jump s'excluent mutuellement !"
|
||||
die 1 --force
|
||||
)
|
||||
[[ $KEEPGOING == true ]] && (
|
||||
fi
|
||||
if [[ $KEEPGOING == true ]]; then
|
||||
prnt E "Les options --keep-going et --check-only sont incompatible !"
|
||||
die 1 --force
|
||||
)
|
||||
fi
|
||||
fi
|
||||
if [[ $RESUME == true ]]; then
|
||||
[[ $CHECK_ONLY == true ]] && (
|
||||
if [[ $CHECK_ONLY == true ]]; then
|
||||
prnt E "La reprise n'a pas de sens avec --check-only."
|
||||
die 1 --force
|
||||
)
|
||||
[[ $MANUAL_MODULE_LIST ]] && (
|
||||
fi
|
||||
if [[ $MANUAL_MODULE_LIST ]]; then
|
||||
prnt E "Le mode reprise ne fonctionne pas avec une liste de modules passé manuellement."
|
||||
die 1 --force
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure module list
|
||||
if [[ $MANUAL_MODULE_LIST ]]; then
|
||||
if [[ -n $MANUAL_MODULE_LIST ]]; then
|
||||
prnt W "Une liste de modules manuelle sera utilisé."
|
||||
export MODULE_LIST=$(echo $MANUAL_MODULE_LIST | sed "s/,/ /g")
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user