Intégration de la branche release-10.0.0

This commit is contained in:
Jephté Clain 2023-08-12 21:06:39 +04:00
commit 771bd1c563
14 changed files with 1174 additions and 453 deletions

View File

@ -1,3 +1,17 @@
## Version 10.0.0 du 12/08/2023-21:06
* `bfdf9b5` support système sans python2
* `108215f` maj registry pour devel
* `6ddb870` dkbuild: support profil nu
* `c0b130f` dkbuild: support profil jclain
* `ae20e49` modifs.mineures sans commentaires
* `2e5101d` ajout de lgrep
* `cff4833` ajout de ldiff
* `9c6e7a8` renommer less1 en lless
* `e9d52d8` ajout de less1 pour lire des fichiers latin1
* `d3d86c6` cssh: forcer la désactivation du verrouillage de la session
* `b761cb6` Sscreen: désactiver verrouillage de la session
## Version 9.16.0 du 15/06/2023-15:28 ## Version 9.16.0 du 15/06/2023-15:28
* `f36be0d` uscrontab: s'assurer que USER est défini * `f36be0d` uscrontab: s'assurer que USER est défini

View File

@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
# désactiver le verrouillage
export LOCKPRG=/bin/true
COULEUR_NORMALE=$'\e[0m' COULEUR_NORMALE=$'\e[0m'
COULEUR_ROUGE=$'\e[31;1m' COULEUR_ROUGE=$'\e[31;1m'
COULEUR_VERTE=$'\e[32;1m' COULEUR_VERTE=$'\e[32;1m'

View File

@ -1 +1 @@
9.16.0 10.0.0

5
cssh
View File

@ -23,13 +23,14 @@ eval "$vars"
[ "${#hosts[*]}" -gt 0 ] || die "Vous devez spécifier l'hôte sur lequel se connecter" [ "${#hosts[*]}" -gt 0 ] || die "Vous devez spécifier l'hôte sur lequel se connecter"
[ ${#args[*]} -gt 0 ] && cmd="$(qvals "${args[@]}"); " || cmd= [ ${#args[*]} -gt 0 ] && cmd="$(qvals "${args[@]}"); " || cmd=
cmd="$cmd$(<"$scriptdir/Sscreen")" cmd="$cmd
export LOCKPRG=/bin/true; $(<"$scriptdir/Sscreen")"
cmd="'${cmd//\'/\'\\\'\'}'" cmd="'${cmd//\'/\'\\\'\'}'"
for host in "${hosts[@]}"; do for host in "${hosts[@]}"; do
"$ssh" \ "$ssh" \
"${options[@]}" -qt "$host" -- \ "${options[@]}" -qt "$host" -- \
"[ -x /usr/local/nutools/Sscreen ] && exec /usr/local/nutools/Sscreen $(qvals "${args[@]}") || exit 123" "export LOCKPRG=/bin/true; [ -x /usr/local/nutools/Sscreen ] && exec /usr/local/nutools/Sscreen $(qvals "${args[@]}") || exit 123"
if [ $? -eq 123 ]; then if [ $? -eq 123 ]; then
# pas de Sscreen en face, le faire à la main # pas de Sscreen en face, le faire à la main
${exec:+exec} \ ${exec:+exec} \

View File

@ -912,6 +912,7 @@ SHARED_ARGS2=(
-P,--prod PROFILE=prod -P,--prod PROFILE=prod
-T,--test PROFILE=test -T,--test PROFILE=test
-E,--dtest PROFILE=dtest -E,--dtest PROFILE=dtest
-J,--jclain PROFILE=jclain
--devel PROFILE=devel --devel PROFILE=devel
-e:,--env: '$TMPENVIRON+=("$value_")' -e:,--env: '$TMPENVIRON+=("$value_")'
@ -1417,6 +1418,14 @@ function resolve_dists_profiles() {
} }
load_dkbuild load_dkbuild
if [ -z "$SETPROFILES_DONE" -a -n "$PROFILE" ]; then
# Si l'utilisateur spécifie un profil mais qu'aucun profil n'a été
# défini dans la configuration, considérer que c'est cet unique profil
# qui a été défini
SETPROFILES=("$PROFILE")
SETPROFILES_DONE=1
fi
## ensuite vérifier si on est dans la bonne distribution ## ensuite vérifier si on est dans la bonne distribution
edebug "Calcul de la distribution courante" edebug "Calcul de la distribution courante"
reset_functions reset_functions

33
ldiff Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname "$0")/lib/ulib/auto" || exit 1
function display_help() {
uecho "$scriptname: frontend de diff pour comparer deux fichiers encodés en latin1
USAGE
$scriptname [options] Lfile Rfile
OPTIONS
-u, -U, --unified N
-w, --ignore-all-space
-B, --ignore-blank-lines
options de diff qui sont reprises telles quelles"
}
diffopts=()
args=(
--help '$exit_with display_help'
-u '$diffopts+=(-u)'
-U:,--unified: '$diffopts+=(-U "$value_")'
-w,--ignore-all-space '$diffopts+=(-w)'
-B,--ignore-blank-lines '$diffopts+=(-B)'
)
parse_args "$@"; set -- "${args[@]}"
Lfile="$1"
Rfile="$2"
[ -n "$Lfile" -a -n "$Rfile" ] || die "vous devez spécifier les deux fichiers"
[ -d "$Lfile" -o -d "$Rfile" ] && die "il faut absolument comparer deux fichiers"
diff "${diffopts[@]}" <(iconv -f latin1 -t utf-8 "$Lfile") <(iconv -f latin1 -t utf-8 "$Rfile")

41
lgrep Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname "$0")/lib/ulib/auto" || exit 1
function display_help() {
uecho "$scriptname: frontend de grep pour lire des fichiers encodés en latin1
USAGE
$scriptname [options] files...
OPTIONS
options de grep qui sont reprises telles quelles"
}
grepopts=()
args=(
--help '$exit_with display_help'
-E,--extended-regexp '$grepopts+=(-E)'
-F,--fixed-strings '$grepopts+=(-F)'
-G,--basic-regexp '$grepopts+=(-G)'
-P,--perl-regexp '$grepopts+=(-P)'
-i,--ignore-case '$grepopts+=(-i)'
-v,--invert-match '$grepopts+=(-v)'
-L,--files-without-match '$grepopts+=(-L)'
-l,--files-with-matches '$grepopts+=(-l)'
-q,--quiet,--silent '$grepopts+=(-q)'
-s,--no-messages '$grepopts+=(-s)'
-H,--with-filename '$grepopts+=(-H)'
-h,--no-filename '$grepopts+=(-h)'
-a,--text '$grepopts+=(-a)'
-r,--recursive '$grepopts+=(-r)'
-R,--dereference-recursive '$grepopts+=(-R)'
)
parse_args "$@"; set -- "${args[@]}"
pattern="$1"
args=("${@:2}")
#XXX ajouter le support de -r, -h, -H, notamment si ${args[@]} contient un
# répertoire
iconv -f latin1 -t utf-8 "${args[@]}" | grep "${grepopts[@]}" "$pattern"

View File

@ -1,6 +1,8 @@
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
if profile prod test; then if profile jclain; then
setenv REGISTRY=docker.jclain.fr
elif profile prod test; then
setenv REGISTRY=docker.univ-reunion.fr setenv REGISTRY=docker.univ-reunion.fr
else else
setenv REGISTRY=docker.self setenv REGISTRY=docker.devel.self
fi fi

View File

@ -14,9 +14,10 @@ rm -f .nutools-devel
# supprimer fichiers de développement # supprimer fichiers de développement
rm -rf lib/pyulib/{build,devel,migrate,test} rm -rf lib/pyulib/{build,devel,migrate,test}
if progexists python2; then
# compiler les modules python de support # compiler les modules python de support
estep "Compilation des modules python" estep "Compilation des modules python"
progexists python2 && PYTHON=python2 || PYTHON=python PYTHON=python2
"$PYTHON" -m compileall lib/ulib/support/python "$PYTHON" -m compileall lib/ulib/support/python
#"$PYTHON" -m compileall lib/nulib/python #"$PYTHON" -m compileall lib/nulib/python
@ -27,6 +28,7 @@ done
ln -s lib/ulib/support/cgiupload.py ln -s lib/ulib/support/cgiupload.py
ln -s lib/ulib/support/cgiparams.py ln -s lib/ulib/support/cgiparams.py
ln -s lib/ulib/support/cgilsxml.py ln -s lib/ulib/support/cgilsxml.py
fi
# liens pour les scripts shell # liens pour les scripts shell
for i in cg cgs; do for i in cg cgs; do

View File

@ -5,6 +5,8 @@ source "$ULIBDIR/ulib" || exit 1
urequire DEFAULTS urequire DEFAULTS
cd "$scriptdir/../.." cd "$scriptdir/../.."
if progexists python2; then
log=/tmp/nutools-pyulib-install.log log=/tmp/nutools-pyulib-install.log
etitle -s "Installation des packages python" etitle -s "Installation des packages python"
enote "Le log de l'installation se trouve dans $log" enote "Le log de l'installation se trouve dans $log"
@ -14,6 +16,7 @@ eend
# setup.py laisse des fichiers avec les droits de root, et ces fichiers ne # setup.py laisse des fichiers avec les droits de root, et ces fichiers ne
# peuvent être supprimés par l'utilisateur qui lance uinst. Les supprimer ici. # peuvent être supprimés par l'utilisateur qui lance uinst. Les supprimer ici.
rm -rf lib/pyulib/build rm -rf lib/pyulib/build
fi
dest="@@dest@@" dest="@@dest@@"
for i in ulib ulibsh; do for i in ulib ulibsh; do

View File

@ -65,7 +65,15 @@ export TMPDIR="${TMPDIR:-${TMP:-${TEMP:-/tmp}}}"
[ -f /etc/debian_chroot ] && UTOOLS_CHROOT=1 [ -f /etc/debian_chroot ] && UTOOLS_CHROOT=1
[ -f /etc/nutoolsrc ] && . /etc/nutoolsrc [ -f /etc/nutoolsrc ] && . /etc/nutoolsrc
[ -f ~/.nutoolsrc ] && . ~/.nutoolsrc [ -f ~/.nutoolsrc ] && . ~/.nutoolsrc
true
UNAME_SYSTEM=`uname -s`
[ "${UNAME_SYSTEM#CYGWIN}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Cygwin
[ "${UNAME_SYSTEM#MINGW32}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Mingw
UNAME_MACHINE=`uname -m`
if [ -n "$UTOOLS_CHROOT" ]; then
[ -n "$UTOOLS_UNAME_SYSTEM" ] && eval "UNAME_SYSTEM=$UTOOLS_UNAME_SYSTEM"
[ -n "$UTOOLS_UNAME_MACHINE" ] && eval "UNAME_MACHINE=$UTOOLS_UNAME_MACHINE"
fi
##@inc]base.init ##@inc]base.init
##@inc[base.core ##@inc[base.core
## Fonctions de base: fondement ## Fonctions de base: fondement
@ -160,44 +168,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -224,6 +233,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -747,6 +798,19 @@ function yesval() {
is_yes "$1" && echo 1 is_yes "$1" && echo 1
} }
function setyesval() {
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
}
function normyesval() {
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
}
function normyesvals() {
local __nyv_yesvar
for __nyv_yesvar in "$@"; do
is_yes "${!__nyv_yesvar}" && _setv "$__nyv_yesvar" 1 || _setv "$__nyv_yesvar" ""
done
}
function setb() { function setb() {
local __s_var="$1"; shift local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then if [[ "$__s_var" == *=* ]]; then
@ -1049,44 +1113,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -1113,6 +1178,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -1625,7 +1732,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%::}" option_="${optdesc_%::}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -1635,7 +1742,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%:}" option_="${optdesc_%:}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -1644,7 +1751,7 @@ function __po_parse_optdescs() {
else else
option_="$optdesc_" option_="$optdesc_"
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "${2%%=*}="
flag_= flag_=
fi fi
@ -1958,44 +2065,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -2022,6 +2130,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -2534,7 +2684,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%::}" option_="${optdesc_%::}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -2544,7 +2694,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%:}" option_="${optdesc_%:}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -2553,7 +2703,7 @@ function __po_parse_optdescs() {
else else
option_="$optdesc_" option_="$optdesc_"
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "${2%%=*}="
flag_= flag_=
fi fi
@ -2988,44 +3138,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -3052,6 +3203,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -3602,6 +3795,19 @@ function yesval() {
is_yes "$1" && echo 1 is_yes "$1" && echo 1
} }
function setyesval() {
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
}
function normyesval() {
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
}
function normyesvals() {
local __nyv_yesvar
for __nyv_yesvar in "$@"; do
is_yes "${!__nyv_yesvar}" && _setv "$__nyv_yesvar" 1 || _setv "$__nyv_yesvar" ""
done
}
function setb() { function setb() {
local __s_var="$1"; shift local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then if [[ "$__s_var" == *=* ]]; then
@ -3664,6 +3870,17 @@ function quote_form() { _qform "$@"; }
function quoted_form() { qform "$@"; } function quoted_form() { qform "$@"; }
function set_array_cmd() {
if [ $# -eq 1 ]; then echo_seta "$1"
elif [ "$2" == @ ]; then echo_seta "$1" "${@:3}"
else eval "echo_seta \"\$1\" \"\${$2[@]}\""
fi
}
function set_array() {
eval "$(set_array_cmd "$@")"
}
if [ -n "$BASH_VERSINFO" -a "${BASH_VERSINFO[0]}" -lt 4 ]; then if [ -n "$BASH_VERSINFO" -a "${BASH_VERSINFO[0]}" -lt 4 ]; then
urequire base.string urequire base.string
function strlower() { tr A-Z a-z <<<"$*"; } function strlower() { tr A-Z a-z <<<"$*"; }
@ -3718,30 +3935,22 @@ if [ -n "$BASH_VERSINFO" -a "${BASH_VERSINFO[0]}" -lt 4 ]; then
} }
fi fi
##@inc]base.compat ##@inc]base.compat
uprovide base ##@inc[base.deprecated
urequire base.init base.core base.string base.num base.bool base.array base.quote base.split base.args base.tools base.compat ## Fonctions dépréciées
uprovide base.deprecated
UNAME_SYSTEM=`uname -s`
[ "${UNAME_SYSTEM#CYGWIN}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Cygwin function set_array_cmd() {
[ "${UNAME_SYSTEM#MINGW32}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Mingw if [ $# -eq 1 ]; then echo_seta2 "$1"
UNAME_MACHINE=`uname -m` elif [ "$2" == @ ]; then echo_seta "$1" "${@:3}"
if [ -n "$UTOOLS_CHROOT" ]; then else eval "echo_seta \"\$1\" \"\${$2[@]}\""
[ -n "$UTOOLS_UNAME_SYSTEM" ] && eval "UNAME_SYSTEM=$UTOOLS_UNAME_SYSTEM"
[ -n "$UTOOLS_UNAME_MACHINE" ] && eval "UNAME_MACHINE=$UTOOLS_UNAME_MACHINE"
fi fi
}
function set_array() {
eval "$(set_array_cmd "$@")"
}
function setyesval() {
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
}
function normyesval() {
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
}
function normyesvals() {
local __nyv_yesvar
for __nyv_yesvar in "$@"; do
is_yes "${!__nyv_yesvar}" && _setv "$__nyv_yesvar" 1 || _setv "$__nyv_yesvar" ""
done
}
function quote_in() { function quote_in() {
sed 's/\\/\\\\/g sed 's/\\/\\\\/g
s/"/\\"/g s/"/\\"/g
@ -3764,27 +3973,11 @@ function quoted_sargs() {
done done
recho "$s" recho "$s"
} }
##@inc]base.deprecated
uprovide base
urequire base.init base.core base.string base.num base.bool base.array base.quote base.split base.args base.tools base.compat
urequire base.deprecated
function set_array_cmd() {
[ $# -eq 1 ] && set -- "$1" "$1"
local __sac_s __sac_v __sac_f
__sac_s="$1=("; shift
if [ "$1" == "@" ]; then
shift
else
eval "set -- \"\${$1[@]}\""
fi
__sac_f=1
for __sac_v in "$@"; do
[ -n "$__sac_f" ] && __sac_f= || __sac_s="$__sac_s "
__sac_s="$__sac_s$(qvalm "$__sac_v")"
done
__sac_s="$__sac_s)"
echo "$__sac_s"
}
function set_array() {
eval "$(set_array_cmd "$@")"
}
function array_count() { function array_count() {
eval "echo \${#$1[*]}" eval "echo \${#$1[*]}"
} }
@ -4070,22 +4263,25 @@ function get_time_fr() {
} }
function parse_date() { function parse_date() {
local value="$1" type="${2:-date}" local value="$1" type="${2:-date}"
local now="$(awk 'BEGIN { print mktime(strftime("%Y %m %d 00 00 00 +0400")) }')" local now="$(awk 'BEGIN { print mktime(strftime("%Y %m %d 00 00 00")) }')"
case "$value" in case "$value" in
=*) value="${value#=}";;
+*) value="$(($now + ${value#+} * 86400))";; +*) value="$(($now + ${value#+} * 86400))";;
-*) value="$(($now - ${value#-} * 86400))";;
*) value="$(<<<"$value" awk -F/ '{ *) value="$(<<<"$value" awk -F/ '{
nd = strftime("%d"); nm = strftime("%m"); ny = strftime("%Y") nd = strftime("%d"); nm = strftime("%m"); ny = strftime("%Y")
d = $1 + 0; if (d < 1) d = nd; d = $1 + 0; if (d < 1) d = nd;
m = $2 + 0; if (m < 1) m = nm; m = $2 + 0; if (m < 1) m = nm;
if ($3 == "") y = ny; if ($3 == "") y = ny;
else { y = $3 + 0; if (y < 100) y = y + 2000; } else { y = $3 + 0; if (y < 100) y = y + 2000; }
print mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d)); print mktime(sprintf("%04i %02i %02i 00 00 00", y, m, d));
}')";; }')";;
esac esac
case "$type" in case "$type" in
d|date) awk '{ print strftime("%d/%m/%Y", $0 + 0) }' <<<"$value";; d|date) awk '{ print strftime("%d/%m/%Y", $0 + 0) }' <<<"$value";;
l|ldap) awk '{ print strftime("%Y%m%d%H%M%S+0400", $0 + 0) }' <<<"$value";; l|ldap) awk '{ print strftime("%Y%m%d%H%M%S+0400", $0 + 0) }' <<<"$value";;
m|mysql) awk '{ print strftime("%Y-%m-%d", $0 + 0) }' <<<"$value";; m|mysql) awk '{ print strftime("%Y-%m-%d", $0 + 0) }' <<<"$value";;
t|ts|timestamp) echo "$value";;
*) recho "$value";; *) recho "$value";;
esac esac
} }
@ -4197,6 +4393,18 @@ function ppath() {
recho "$path" recho "$path"
} }
function ppath2() {
local path="$1" cwd="$2"
path="$(abspath "$path")" # essayer de normaliser le chemin
[ -n "$cwd" ] || cwd="$(pwd)"
[ "$path" = "$cwd" ] && path="../$(basename -- "$path")"
[ "$cwd" != "/" -a "$cwd" != "$HOME" ] && path="${path#$cwd/}"
[ "${path#$HOME/}" != "$path" ] && path="~${path#$HOME}"
recho "$path"
}
function relpath() { function relpath() {
local p="$(abspath "$1" "$3")" cwd="$2" local p="$(abspath "$1" "$3")" cwd="$2"
if [ -z "$cwd" ]; then if [ -z "$cwd" ]; then
@ -4465,13 +4673,13 @@ function testdiff() {
! quietdiff "$@" ! quietdiff "$@"
} }
function testupdated() { function testupdated() {
if [ -f "$2" ]; then if [ -n "$3" ]; then return 0
testdiff "$1" "$2" elif [ -f "$2" ]; then testdiff "$1" "$2"
else else return 0
return 0
fi fi
} }
function testnewer() { function testnewer() {
[ -n "$3" ] && return 0
test ! -e "$2" -o "$1" -nt "$2" test ! -e "$2" -o "$1" -nt "$2"
} }
function ps_all() { function ps_all() {
@ -4481,7 +4689,9 @@ function progexists() {
test -n "$1" -a -x "$(which "$1" 2>/dev/null)" test -n "$1" -a -x "$(which "$1" 2>/dev/null)"
} }
function has_python() { function has_python() {
progexists python progexists python2 && return 0
progexists python && return 0
return 1
} }
function has_gawk() { function has_gawk() {
progexists gawk progexists gawk
@ -4694,10 +4904,23 @@ s/[\xE2\x80\x90\xE2\x80\x91\xE2\x80\x92\xE2\x80\x93\xE2\x80\x94\xE2\x80\x95]/-/g
s/[]/\x27/g s/[]/\x27/g
s/[«»“”]/"/g s/[«»“”]/"/g
s/[\xC2\xA0\xE2\x80\x87\xE2\x80\xAF\xE2\x81\xA0]/ /g s/[\xC2\xA0\xE2\x80\x87\xE2\x80\xAF\xE2\x81\xA0]/ /g
s/[\xE2\x80\xA6]/.../g
s/[œ]/oe/g s/[œ]/oe/g
s/[Œ]/OE/g s/[Œ]/OE/g
s/[æ]/ae/g s/[æ]/ae/g
s/[Æ]/AE/g s/[Æ]/AE/g
s/a\xCC\x80/à/g
s/e\xCC\x81/é/g; s/e\xCC\x80/è/g; s/e\xCC\x82/ê/g; s/e\xCC\x88/ë/g
s/i\xCC\x88/ï/g; s/i\xCC\x82/î/g
s/o\xCC\x82/ô/g; s/o\xCC\x88/ö/g
s/u\xCC\x88/ü/g; s/u\xCC\x82/û/g
s/c\xCC\xA7/ç/g
s/A\xCC\x80/À/g
s/E\xCC\x81/É/g; s/E\xCC\x80/È/g; s/E\xCC\x82/Ê/g; s/E\xCC\x88/Ë/g
s/I\xCC\x88/Ï/g; s/I\xCC\x82/Î/g
s/O\xCC\x82/Ô/g; s/O\xCC\x88/Ö/g
s/U\xCC\x88/Ü/g; s/U\xCC\x82/Û/g
s/C\xCC\xA7/Ç/g
' '
} }
function _noaccents() { function _noaccents() {
@ -4831,6 +5054,7 @@ function is_archive() {
name="${name%.jar}" name="${name%.jar}"
name="${name%.war}" name="${name%.war}"
name="${name%.ear}" name="${name%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && name="${name%.sh}"
[ "$name" != "$1" ] [ "$name" != "$1" ]
} }
function extract_archive() { function extract_archive() {
@ -4850,6 +5074,12 @@ function extract_archive() {
cd "$destdir" cd "$destdir"
jar xf "$arch" "$@" jar xf "$arch" "$@"
) || return ) || return
elif [ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && endswith "$arch" .sh; then
(
arch="$(abspath "$arch")"
cd "$destdir"
"${BASH:-/bin/sh}" "$arch" --tar xf "$@"
) || return
else else
return 1 return 1
fi fi
@ -4865,6 +5095,7 @@ function get_archive_basename() {
basename="${basename%.jar}" basename="${basename%.jar}"
basename="${basename%.war}" basename="${basename%.war}"
basename="${basename%.ear}" basename="${basename%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && basename="${basename%.sh}"
echo "$basename" echo "$basename"
} }
function get_archive_appname() { function get_archive_appname() {
@ -4878,6 +5109,7 @@ function get_archive_appname() {
appname="${appname%.jar}" appname="${appname%.jar}"
appname="${appname%.war}" appname="${appname%.war}"
appname="${appname%.ear}" appname="${appname%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && appname="${appname%.sh}"
echo "$appname" | awk '{ echo "$appname" | awk '{
if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) { if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) {
print substr($0, 1, RSTART - 1) print substr($0, 1, RSTART - 1)
@ -5119,6 +5351,12 @@ function unquote_html(s) {
gsub(/&amp;/, "\\&", s) gsub(/&amp;/, "\\&", s)
return s return s
} }
function qawk(s) {
gsub(/\\/, "\\\\", s)
gsub(/"/, "\\\"", s)
gsub(/\n/, "\\n", s)
return "\"" s "\""
}
function qval(s) {'" function qval(s) {'"
gsub(/'/, \"'\\\\''\", s) gsub(/'/, \"'\\\\''\", s)
return \"'\" s \"'\" return \"'\" s \"'\"
@ -5202,6 +5440,12 @@ function __parse_date_fr(date, parts, y, m, d) {
m = int(parts[2]) m = int(parts[2])
d = int(parts[1]) d = int(parts[1])
return mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d)) return mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d))
} else if (match(date, /([0-9][0-9]?)\/([0-9][0-9]?)\/([0-9][0-9])/, parts)) {
basey = int(strftime("%Y")); basey = basey - basey % 100
y = basey + int(parts[3])
m = int(parts[2])
d = int(parts[1])
return mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d))
} }
return -1 return -1
} }
@ -5846,7 +6090,7 @@ function pidfile_check() {
} }
function page_maybe() { function page_maybe() {
if isatty; then if isatty; then
less -XF "$@" less -XFR "$@"
else else
cat cat
fi fi
@ -6558,7 +6802,7 @@ function ask_any() {
lf="$(strlower "$f")" lf="$(strlower "$f")"
[ "$r" == "$lf" ] && return $i [ "$r" == "$lf" ] && return $i
if [ -z "$defi" ]; then if [ -z "$defi" ]; then
[[ "$f" =~ [A-Z] ]] && defi="$i" [ -z "${f/[A-Z]/}" ] && defi="$i"
fi fi
if [ "$lf" == o ]; then if [ "$lf" == o ]; then
case "$r" in o|y|1|v|t) return $i;; esac case "$r" in o|y|1|v|t) return $i;; esac
@ -6572,7 +6816,8 @@ function ask_any() {
else else
i=0 i=0
while [ $i -lt $count ]; do while [ $i -lt $count ]; do
[[ "${format:$i:1}" =~ [A-Z] ]] && return $i f="${format:$i:1}"
[ -z "${f/[A-Z]/}" ] && return $i
i=$(($i + 1)) i=$(($i + 1))
done done
return 0 return 0
@ -7098,18 +7343,36 @@ SYSDIST_ALIASES=(
10.7=lion 10.6=snowleopard 10.5=leopard 10.4=tiger 10.3=panther 10.7=lion 10.6=snowleopard 10.5=leopard 10.4=tiger 10.3=panther
) )
debianlike_SYSVERS=() debianlike_SYSVERS=()
debian_SYSVERS=(stretch jessie wheezy squeeze lenny etch) debian_SYSVERS=(
ubuntu_SYSVERS=(oneiric natty maverick lucid karmic jaunty intrepid hardy) forky trixie bookworm bullseye buster stretch jessie wheezy squeeze lenny etch
)
ubuntu_SYSVERS=(
mantic lunar kinetic jammy
impish hirsute groovy focal
eoan disco cosmic bionic
artful zesty yakkety xenial
wily vivid utopic trusty
saucy raring quantal precise
oneiric natty maverick lucid
karmic jaunty intrepid hardy
)
redhatlike_SYSVERS=() redhatlike_SYSVERS=()
ol_SYSVERS=(ol7 ol6 redhat7 redhat6) ol_SYSVERS=(ol8 ol7 ol6 redhat8 redhat7 redhat6)
rhel_SYSVERS=(rhel7 rhel6 rhel5 rhel4 redhat7 redhat6 redhat5 redhat4) rhel_SYSVERS=(rhel8 rhel7 rhel6 rhel5 rhel4 redhat8 redhat7 redhat6 redhat5 redhat4)
fedora_SYSVERS=(fedora14 fedora13 fedora12 fedora11) fedora_SYSVERS=(fedora14 fedora13 fedora12 fedora11)
centos_SYSVERS=(centos7 centos6 centos5 centos4 redhat7 redhat6 redhat5 redhat4) centos_SYSVERS=(centos7 centos6 centos5 centos4 redhat7 redhat6 redhat5 redhat4)
suse_SYSVERS=() suse_SYSVERS=()
gentoo_SYSVERS=() gentoo_SYSVERS=()
SYSVER_ALIASES=( SYSVER_ALIASES=(
9=stretch 8=jessie 7=wheezy 6=squeeze 5=lenny 4=etch 14=forky 13=trixie 12=bookworm 11=bullseye 10=buster 9=stretch 8=jessie 7=wheezy 6=squeeze 5=lenny 4=etch
11.10=oneiric 11.04=natty 10.10=maverick 10.04=lucid 9.10=karmic 9.04=jaunty 8.10=intrepid 8.04=hardy 23.10=mantic 23.04=lunar 22.10=kinetic 22.04=jammy
21.10=impish 21.04=hirsute 20.10=groovy 20.04=focal
19.10=eoan 19.04=disco 18.10=cosmic 18.04=bionic
17.10=artful 17.04=zesty 16.10=yakkety 16.04=xenial
15.10=wily 15.04=vivid 14.10=utopic 14.04=trusty
13.10=saucy 13.04=raring 12.10=quantal 12.04=precise
11.10=oneiric 11.04=natty 10.10=maverick 10.04=lucid
9.10=karmic 9.04=jaunty 8.10=intrepid 8.04=hardy
) )
function __setup_ALL_SYSvars() { function __setup_ALL_SYSvars() {
@ -7214,6 +7477,8 @@ function __compute_sysinfos() {
esac esac
if [ -n "$debian_version" ]; then if [ -n "$debian_version" ]; then
case "$debian_version" in case "$debian_version" in
11*|bullseye*) MYSYSDIST=(debian debianlike); MYSYSVER=(bullseye);;
10*|buster*) MYSYSDIST=(debian debianlike); MYSYSVER=(buster);;
9*|stretch*) MYSYSDIST=(debian debianlike); MYSYSVER=(stretch);; 9*|stretch*) MYSYSDIST=(debian debianlike); MYSYSVER=(stretch);;
8*|jessie*) MYSYSDIST=(debian debianlike); MYSYSVER=(jessie);; 8*|jessie*) MYSYSDIST=(debian debianlike); MYSYSVER=(jessie);;
7*|wheezy*) MYSYSDIST=(debian debianlike); MYSYSVER=(wheezy);; 7*|wheezy*) MYSYSDIST=(debian debianlike); MYSYSVER=(wheezy);;
@ -7227,6 +7492,7 @@ function __compute_sysinfos() {
elif [ -n "$oracle_release" ]; then elif [ -n "$oracle_release" ]; then
MYSYSDIST=(ol rhel redhatlike) MYSYSDIST=(ol rhel redhatlike)
case "$oracle_release" in case "$oracle_release" in
Oracle*Linux*release\ 8*) MYSYSVER=(ol8 rhel8 redhat8);;
Oracle*Linux*release\ 7*) MYSYSVER=(ol7 rhel7 redhat7);; Oracle*Linux*release\ 7*) MYSYSVER=(ol7 rhel7 redhat7);;
Oracle*Linux*release\ 6*) MYSYSVER=(ol6 rhel6 redhat6);; Oracle*Linux*release\ 6*) MYSYSVER=(ol6 rhel6 redhat6);;
esac esac
@ -7242,10 +7508,12 @@ function __compute_sysinfos() {
Fedora*13*) MYSYSVER=(fedora13);; Fedora*13*) MYSYSVER=(fedora13);;
Fedora*12*) MYSYSVER=(fedora12);; Fedora*12*) MYSYSVER=(fedora12);;
Fedora*11*) MYSYSVER=(fedora11);; Fedora*11*) MYSYSVER=(fedora11);;
Red*Hat*Enterprise*Linux*release\ 8*) MYSYSVER=(rhel8 redhat8);;
Red*Hat*Enterprise*Linux*release\ 7*) MYSYSVER=(rhel7 redhat7);; Red*Hat*Enterprise*Linux*release\ 7*) MYSYSVER=(rhel7 redhat7);;
Red*Hat*Enterprise*Linux*release\ 6*) MYSYSVER=(rhel6 redhat6);; Red*Hat*Enterprise*Linux*release\ 6*) MYSYSVER=(rhel6 redhat6);;
Red*Hat*Enterprise*Linux*release\ 5*) MYSYSVER=(rhel5 redhat5);; Red*Hat*Enterprise*Linux*release\ 5*) MYSYSVER=(rhel5 redhat5);;
Red*Hat*Enterprise*Linux*release\ 4*) MYSYSVER=(rhel4 redhat4);; Red*Hat*Enterprise*Linux*release\ 4*) MYSYSVER=(rhel4 redhat4);;
CentOS*release\ 8*) MYSYSVER=(centos8 redhat8);;
CentOS*release\ 7*) MYSYSVER=(centos7 redhat7);; CentOS*release\ 7*) MYSYSVER=(centos7 redhat7);;
CentOS*release\ 6*) MYSYSVER=(centos6 redhat6);; CentOS*release\ 6*) MYSYSVER=(centos6 redhat6);;
CentOS*release\ 5*) MYSYSVER=(centos5 redhat5);; CentOS*release\ 5*) MYSYSVER=(centos5 redhat5);;
@ -7607,6 +7875,29 @@ function on_default() {
fi fi
return 1 return 1
} }
function require_debian() {
set -- -d debian "$@"
if check_sysinfos "$@"; then
urequire debian
return 0
fi
local -a infos; local info
for info in "$@"; do
if ! [[ "$info" == -* ]]; then
infos=("${infos[@]}" "$info")
fi
done
local msg="Ce script n'est pas supporté sur $(get_sysinfos_desc)"
[ -n "$*" ] && msg="$msg
Il faut au moins l'un des systèmes suivants: ${infos[*]}"
[ -n "$UINST" -a -n "$ABORT" ] && touch "$ABORT"
die "$msg"
}
function require_stretch() {
require_debian -v stretch+
}
##@inc]../sysinfos ##@inc]../sysinfos
##@inc[../compat ##@inc[../compat
# Code de support pour les architectures autre que Linux # Code de support pour les architectures autre que Linux

View File

@ -502,36 +502,36 @@ Essayez avec 'uinst -C'"
fi fi
# Tester s'il faut bootstrapper # Tester s'il faut bootstrapper
if [ -f "$srcdir/.nutools-bootstrap" ]; then #if [ -f "$srcdir/.nutools-bootstrap" ]; then
local need_python need_gawk # local need_python need_gawk
has_python || need_python=1 # has_python || need_python=1
has_gawk || need_gawk=1 # has_gawk || need_gawk=1
if check_sysinfos -s linux; then # if check_sysinfos -s linux; then
if [ -n "$need_python" -o -n "$need_gawk" ]; then # if [ -n "$need_python" -o -n "$need_gawk" ]; then
eimportant "Il FAUT installer Python 2 et $(get_color y)*GNU*$(get_color z)awk pour que nutools fonctionne correctement." # eimportant "Il FAUT installer Python 2 et $(get_color y)*GNU*$(get_color z)awk pour que nutools fonctionne correctement."
if check_sysinfos -d debian; then # if check_sysinfos -d debian; then
if ask_yesno "Voulez-vous que ce script essaye d'installer automatiquement ces dépendances (requière les droits root)?" O; then # if ask_yesno "Voulez-vous que ce script essaye d'installer automatiquement ces dépendances (requière les droits root)?" O; then
urequire debian # urequire debian
pkg_install ${need_python:+python} ${need_gawk:+gawk} || { # pkg_install ${need_python:+python} ${need_gawk:+gawk} || {
eerror "Une erreur s'est produite pendant l'installation. Veuillez faire l'installation manuellement" # eerror "Une erreur s'est produite pendant l'installation. Veuillez faire l'installation manuellement"
return 1 # return 1
} # }
need_python= # need_python=
need_gawk= # need_gawk=
fi # fi
fi # fi
fi # fi
fi # fi
if [ -n "$need_python" ]; then # if [ -n "$need_python" ]; then
eerror "Python 2 est requis. Veuillez faire l'installation avant de relancer ce script." # eerror "Python 2 est requis. Veuillez faire l'installation avant de relancer ce script."
return 1 # return 1
fi # fi
if [ -n "$need_gawk" ]; then # if [ -n "$need_gawk" ]; then
ewarn "$(get_color y)*GNU*$(get_color z)awk est requis mais n'est pas installé. Ce script va continuer, mais les résultats ne sont pas garantis." # ewarn "$(get_color y)*GNU*$(get_color z)awk est requis mais n'est pas installé. Ce script va continuer, mais les résultats ne sont pas garantis."
fi # fi
# s'assurer que les libraries *locales* sont dans PYTHONPATH # # s'assurer que les libraries *locales* sont dans PYTHONPATH
source "$ULIBDIR/pyulib/pyulib" # source "$ULIBDIR/pyulib/pyulib"
fi #fi
if [ -n "$UINST_AUTOPREFIX" ]; then if [ -n "$UINST_AUTOPREFIX" ]; then
# initialiser le moteur de préfixes # initialiser le moteur de préfixes

31
lless Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname "$0")/lib/ulib/auto" || exit 1
function display_help() {
uecho "$scriptname: frontend de less pour lire des fichiers encodés en latin1
USAGE
$scriptname [options] files...
OPTIONS
-S, --chop-long-lines
-r, --raw-control-chars
-R, --RAW-CONTROL-CHARS
-e, --quit-at-eof
-E, --QUIT-AT-EOF
options de less qui sont reprises telles quelles"
}
lessopts=()
args=(
--help '$exit_with display_help'
-S,--chop-long-lines '$lessopts+=(-S)'
-r,--raw-control-chars '$lessopts+=(-r)'
-R,--RAW-CONTROL-CHARS '$lessopts+=(-R)'
-e,--quit-at-eof '$lessopts+=(-e)'
-E,--QUIT-AT-EOF '$lessopts+=(-E)'
)
parse_args "$@"; set -- "${args[@]}"
iconv -f latin1 -t utf-8 "$@" | less "${lessopts[@]}"

691
ucrontab
View File

@ -153,7 +153,15 @@ export TMPDIR="${TMPDIR:-${TMP:-${TEMP:-/tmp}}}"
[ -f /etc/debian_chroot ] && UTOOLS_CHROOT=1 [ -f /etc/debian_chroot ] && UTOOLS_CHROOT=1
[ -f /etc/nutoolsrc ] && . /etc/nutoolsrc [ -f /etc/nutoolsrc ] && . /etc/nutoolsrc
[ -f ~/.nutoolsrc ] && . ~/.nutoolsrc [ -f ~/.nutoolsrc ] && . ~/.nutoolsrc
true
UNAME_SYSTEM=`uname -s`
[ "${UNAME_SYSTEM#CYGWIN}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Cygwin
[ "${UNAME_SYSTEM#MINGW32}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Mingw
UNAME_MACHINE=`uname -m`
if [ -n "$UTOOLS_CHROOT" ]; then
[ -n "$UTOOLS_UNAME_SYSTEM" ] && eval "UNAME_SYSTEM=$UTOOLS_UNAME_SYSTEM"
[ -n "$UTOOLS_UNAME_MACHINE" ] && eval "UNAME_MACHINE=$UTOOLS_UNAME_MACHINE"
fi
##@inc]base.init ##@inc]base.init
##@inc[base.core ##@inc[base.core
## Fonctions de base: fondement ## Fonctions de base: fondement
@ -248,44 +256,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -312,6 +321,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -835,6 +886,19 @@ function yesval() {
is_yes "$1" && echo 1 is_yes "$1" && echo 1
} }
function setyesval() {
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
}
function normyesval() {
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
}
function normyesvals() {
local __nyv_yesvar
for __nyv_yesvar in "$@"; do
is_yes "${!__nyv_yesvar}" && _setv "$__nyv_yesvar" 1 || _setv "$__nyv_yesvar" ""
done
}
function setb() { function setb() {
local __s_var="$1"; shift local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then if [[ "$__s_var" == *=* ]]; then
@ -1137,44 +1201,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -1201,6 +1266,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -1713,7 +1820,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%::}" option_="${optdesc_%::}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -1723,7 +1830,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%:}" option_="${optdesc_%:}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -1732,7 +1839,7 @@ function __po_parse_optdescs() {
else else
option_="$optdesc_" option_="$optdesc_"
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "${2%%=*}="
flag_= flag_=
fi fi
@ -2046,44 +2153,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -2110,6 +2218,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -2622,7 +2772,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%::}" option_="${optdesc_%::}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -2632,7 +2782,7 @@ function __po_parse_optdescs() {
option_="${optdesc_%:}" option_="${optdesc_%:}"
if [[ "$2" == *=* ]]; then if [[ "$2" == *=* ]]; then
name_="${2%%=*}=" name_="${2%%=*}="
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "$name_"
else else
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=()" [ -n "$reset_" ] && eval "$name_=()"
@ -2641,7 +2791,7 @@ function __po_parse_optdescs() {
else else
option_="$optdesc_" option_="$optdesc_"
name_="$2" name_="$2"
[ -n "$reset_" ] && eval "$name_=" [ -n "$reset_" ] && eval "${2%%=*}="
flag_= flag_=
fi fi
@ -3076,44 +3226,45 @@ function qwc() {
s="${s//\"/\\\"}" s="${s//\"/\\\"}"
s="${s//\$/\\\$}" s="${s//\$/\\\$}"
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
local r a b local r a b c
while [ -n "$s" ]; do while [ -n "$s" ]; do
if [[ "$s" == *\** ]]; then a=; b=; c=
if [[ "$s" == *\?* ]]; then a=; [[ "$s" == *\** ]] && { a="${s%%\**}"; a=${#a}; }
a="${s%%\**}" b=; [[ "$s" == *\?* ]] && { b="${s%%\?*}"; b=${#b}; }
b="${s%%\?*}" c=; [[ "$s" == *\[* ]] && { c="${s%%\[*}"; c=${#c}; }
if [ ${#a} -lt ${#b} ]; then if [ -z "$a" -a -z "$b" -a -z "$c" ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\**}"
s="${s#*\*}"
r="$r\"$a\"*"
fi
elif [[ "$s" == *\?* ]]; then
if [[ "$s" == *\** ]]; then
a="${s%%\**}"
b="${s%%\?*}"
if [ ${#a} -lt ${#b} ]; then
s="${s#*\*}"
r="$r\"$a\"*"
else
s="${s#*\?}"
r="$r\"$b\"?"
fi
else
a="${s%%\?*}"
s="${s#*\?}"
r="$r\"$a\"?"
fi
else
r="$r\"$s\"" r="$r\"$s\""
break break
fi fi
if [ -n "$a" ]; then
[ -n "$b" ] && [ $a -lt $b ] && b=
[ -n "$c" ] && [ $a -lt $c ] && c=
fi
if [ -n "$b" ]; then
[ -n "$a" ] && [ $b -lt $a ] && a=
[ -n "$c" ] && [ $b -lt $c ] && c=
fi
if [ -n "$c" ]; then
[ -n "$a" ] && [ $c -lt $a ] && a=
[ -n "$b" ] && [ $c -lt $b ] && b=
fi
if [ -n "$a" ]; then # PREFIX*
a="${s%%\**}"
s="${s#*\*}"
[ -n "$a" ] && r="$r\"$a\""
r="$r*"
elif [ -n "$b" ]; then # PREFIX?
a="${s%%\?*}"
s="${s#*\?}"
[ -n "$a" ] && r="$r\"$a\""
r="$r?"
elif [ -n "$c" ]; then # PREFIX[class]
a="${s%%\[*}"
b="${s#*\[}"; b="${b%%\]*}"
s="${s:$((${#a} + ${#b} + 2))}"
[ -n "$a" ] && r="$r\"$a\""
r="$r[$b]"
fi
done done
recho_ "$r" recho_ "$r"
} }
@ -3140,6 +3291,48 @@ function echo_setv() {
fi fi
echo "$__s_var=$(qvalr "$*")" echo "$__s_var=$(qvalr "$*")"
} }
function echo_setv2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
if [ $# -eq 0 ]; then
echo_setv "$__s_var" "${!__s_var}"
else
echo_setv "$__s_var" "$@"
fi
}
function seta() {
local __s_array="$1"; shift
if [[ "$__s_array" == *=* ]]; then
set -- "${__s_array#*=}" "$@"
__s_array="${__s_array%%=*}"
fi
eval "$__s_array=(\"\$@\")"
}
function _seta() {
local __s_array="$1"; shift
eval "$__s_array=(\"\$@\")"
}
function echo_seta() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
fi
echo "$__s_var=($(qvals "$@"))"
}
function echo_seta2() {
local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then
set -- "${__s_var#*=}" "$@"
__s_var="${__s_var%%=*}"
elif [ $# -eq 0 ]; then
eval "set -- \"\${$__s_var[@]}\""
fi
echo "$__s_var=($(qvals "$@"))"
}
function setx() { function setx() {
if [ "$1" == -a ]; then if [ "$1" == -a ]; then
shift shift
@ -3690,6 +3883,19 @@ function yesval() {
is_yes "$1" && echo 1 is_yes "$1" && echo 1
} }
function setyesval() {
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
}
function normyesval() {
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
}
function normyesvals() {
local __nyv_yesvar
for __nyv_yesvar in "$@"; do
is_yes "${!__nyv_yesvar}" && _setv "$__nyv_yesvar" 1 || _setv "$__nyv_yesvar" ""
done
}
function setb() { function setb() {
local __s_var="$1"; shift local __s_var="$1"; shift
if [[ "$__s_var" == *=* ]]; then if [[ "$__s_var" == *=* ]]; then
@ -3752,6 +3958,17 @@ function quote_form() { _qform "$@"; }
function quoted_form() { qform "$@"; } function quoted_form() { qform "$@"; }
function set_array_cmd() {
if [ $# -eq 1 ]; then echo_seta "$1"
elif [ "$2" == @ ]; then echo_seta "$1" "${@:3}"
else eval "echo_seta \"\$1\" \"\${$2[@]}\""
fi
}
function set_array() {
eval "$(set_array_cmd "$@")"
}
if [ -n "$BASH_VERSINFO" -a "${BASH_VERSINFO[0]}" -lt 4 ]; then if [ -n "$BASH_VERSINFO" -a "${BASH_VERSINFO[0]}" -lt 4 ]; then
urequire base.string urequire base.string
function strlower() { tr A-Z a-z <<<"$*"; } function strlower() { tr A-Z a-z <<<"$*"; }
@ -3806,30 +4023,22 @@ if [ -n "$BASH_VERSINFO" -a "${BASH_VERSINFO[0]}" -lt 4 ]; then
} }
fi fi
##@inc]base.compat ##@inc]base.compat
uprovide base ##@inc[base.deprecated
urequire base.init base.core base.string base.num base.bool base.array base.quote base.split base.args base.tools base.compat ## Fonctions dépréciées
uprovide base.deprecated
UNAME_SYSTEM=`uname -s`
[ "${UNAME_SYSTEM#CYGWIN}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Cygwin function set_array_cmd() {
[ "${UNAME_SYSTEM#MINGW32}" != "$UNAME_SYSTEM" ] && UNAME_SYSTEM=Mingw if [ $# -eq 1 ]; then echo_seta2 "$1"
UNAME_MACHINE=`uname -m` elif [ "$2" == @ ]; then echo_seta "$1" "${@:3}"
if [ -n "$UTOOLS_CHROOT" ]; then else eval "echo_seta \"\$1\" \"\${$2[@]}\""
[ -n "$UTOOLS_UNAME_SYSTEM" ] && eval "UNAME_SYSTEM=$UTOOLS_UNAME_SYSTEM"
[ -n "$UTOOLS_UNAME_MACHINE" ] && eval "UNAME_MACHINE=$UTOOLS_UNAME_MACHINE"
fi fi
}
function set_array() {
eval "$(set_array_cmd "$@")"
}
function setyesval() {
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
}
function normyesval() {
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
}
function normyesvals() {
local __nyv_yesvar
for __nyv_yesvar in "$@"; do
is_yes "${!__nyv_yesvar}" && _setv "$__nyv_yesvar" 1 || _setv "$__nyv_yesvar" ""
done
}
function quote_in() { function quote_in() {
sed 's/\\/\\\\/g sed 's/\\/\\\\/g
s/"/\\"/g s/"/\\"/g
@ -3852,27 +4061,11 @@ function quoted_sargs() {
done done
recho "$s" recho "$s"
} }
##@inc]base.deprecated
uprovide base
urequire base.init base.core base.string base.num base.bool base.array base.quote base.split base.args base.tools base.compat
urequire base.deprecated
function set_array_cmd() {
[ $# -eq 1 ] && set -- "$1" "$1"
local __sac_s __sac_v __sac_f
__sac_s="$1=("; shift
if [ "$1" == "@" ]; then
shift
else
eval "set -- \"\${$1[@]}\""
fi
__sac_f=1
for __sac_v in "$@"; do
[ -n "$__sac_f" ] && __sac_f= || __sac_s="$__sac_s "
__sac_s="$__sac_s$(qvalm "$__sac_v")"
done
__sac_s="$__sac_s)"
echo "$__sac_s"
}
function set_array() {
eval "$(set_array_cmd "$@")"
}
function array_count() { function array_count() {
eval "echo \${#$1[*]}" eval "echo \${#$1[*]}"
} }
@ -4158,22 +4351,25 @@ function get_time_fr() {
} }
function parse_date() { function parse_date() {
local value="$1" type="${2:-date}" local value="$1" type="${2:-date}"
local now="$(awk 'BEGIN { print mktime(strftime("%Y %m %d 00 00 00 +0400")) }')" local now="$(awk 'BEGIN { print mktime(strftime("%Y %m %d 00 00 00")) }')"
case "$value" in case "$value" in
=*) value="${value#=}";;
+*) value="$(($now + ${value#+} * 86400))";; +*) value="$(($now + ${value#+} * 86400))";;
-*) value="$(($now - ${value#-} * 86400))";;
*) value="$(<<<"$value" awk -F/ '{ *) value="$(<<<"$value" awk -F/ '{
nd = strftime("%d"); nm = strftime("%m"); ny = strftime("%Y") nd = strftime("%d"); nm = strftime("%m"); ny = strftime("%Y")
d = $1 + 0; if (d < 1) d = nd; d = $1 + 0; if (d < 1) d = nd;
m = $2 + 0; if (m < 1) m = nm; m = $2 + 0; if (m < 1) m = nm;
if ($3 == "") y = ny; if ($3 == "") y = ny;
else { y = $3 + 0; if (y < 100) y = y + 2000; } else { y = $3 + 0; if (y < 100) y = y + 2000; }
print mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d)); print mktime(sprintf("%04i %02i %02i 00 00 00", y, m, d));
}')";; }')";;
esac esac
case "$type" in case "$type" in
d|date) awk '{ print strftime("%d/%m/%Y", $0 + 0) }' <<<"$value";; d|date) awk '{ print strftime("%d/%m/%Y", $0 + 0) }' <<<"$value";;
l|ldap) awk '{ print strftime("%Y%m%d%H%M%S+0400", $0 + 0) }' <<<"$value";; l|ldap) awk '{ print strftime("%Y%m%d%H%M%S+0400", $0 + 0) }' <<<"$value";;
m|mysql) awk '{ print strftime("%Y-%m-%d", $0 + 0) }' <<<"$value";; m|mysql) awk '{ print strftime("%Y-%m-%d", $0 + 0) }' <<<"$value";;
t|ts|timestamp) echo "$value";;
*) recho "$value";; *) recho "$value";;
esac esac
} }
@ -4285,6 +4481,18 @@ function ppath() {
recho "$path" recho "$path"
} }
function ppath2() {
local path="$1" cwd="$2"
path="$(abspath "$path")" # essayer de normaliser le chemin
[ -n "$cwd" ] || cwd="$(pwd)"
[ "$path" = "$cwd" ] && path="../$(basename -- "$path")"
[ "$cwd" != "/" -a "$cwd" != "$HOME" ] && path="${path#$cwd/}"
[ "${path#$HOME/}" != "$path" ] && path="~${path#$HOME}"
recho "$path"
}
function relpath() { function relpath() {
local p="$(abspath "$1" "$3")" cwd="$2" local p="$(abspath "$1" "$3")" cwd="$2"
if [ -z "$cwd" ]; then if [ -z "$cwd" ]; then
@ -4553,13 +4761,13 @@ function testdiff() {
! quietdiff "$@" ! quietdiff "$@"
} }
function testupdated() { function testupdated() {
if [ -f "$2" ]; then if [ -n "$3" ]; then return 0
testdiff "$1" "$2" elif [ -f "$2" ]; then testdiff "$1" "$2"
else else return 0
return 0
fi fi
} }
function testnewer() { function testnewer() {
[ -n "$3" ] && return 0
test ! -e "$2" -o "$1" -nt "$2" test ! -e "$2" -o "$1" -nt "$2"
} }
function ps_all() { function ps_all() {
@ -4569,7 +4777,9 @@ function progexists() {
test -n "$1" -a -x "$(which "$1" 2>/dev/null)" test -n "$1" -a -x "$(which "$1" 2>/dev/null)"
} }
function has_python() { function has_python() {
progexists python progexists python2 && return 0
progexists python && return 0
return 1
} }
function has_gawk() { function has_gawk() {
progexists gawk progexists gawk
@ -4782,10 +4992,23 @@ s/[\xE2\x80\x90\xE2\x80\x91\xE2\x80\x92\xE2\x80\x93\xE2\x80\x94\xE2\x80\x95]/-/g
s/[]/\x27/g s/[]/\x27/g
s/[«»“”]/"/g s/[«»“”]/"/g
s/[\xC2\xA0\xE2\x80\x87\xE2\x80\xAF\xE2\x81\xA0]/ /g s/[\xC2\xA0\xE2\x80\x87\xE2\x80\xAF\xE2\x81\xA0]/ /g
s/[\xE2\x80\xA6]/.../g
s/[œ]/oe/g s/[œ]/oe/g
s/[Œ]/OE/g s/[Œ]/OE/g
s/[æ]/ae/g s/[æ]/ae/g
s/[Æ]/AE/g s/[Æ]/AE/g
s/a\xCC\x80/à/g
s/e\xCC\x81/é/g; s/e\xCC\x80/è/g; s/e\xCC\x82/ê/g; s/e\xCC\x88/ë/g
s/i\xCC\x88/ï/g; s/i\xCC\x82/î/g
s/o\xCC\x82/ô/g; s/o\xCC\x88/ö/g
s/u\xCC\x88/ü/g; s/u\xCC\x82/û/g
s/c\xCC\xA7/ç/g
s/A\xCC\x80/À/g
s/E\xCC\x81/É/g; s/E\xCC\x80/È/g; s/E\xCC\x82/Ê/g; s/E\xCC\x88/Ë/g
s/I\xCC\x88/Ï/g; s/I\xCC\x82/Î/g
s/O\xCC\x82/Ô/g; s/O\xCC\x88/Ö/g
s/U\xCC\x88/Ü/g; s/U\xCC\x82/Û/g
s/C\xCC\xA7/Ç/g
' '
} }
function _noaccents() { function _noaccents() {
@ -4919,6 +5142,7 @@ function is_archive() {
name="${name%.jar}" name="${name%.jar}"
name="${name%.war}" name="${name%.war}"
name="${name%.ear}" name="${name%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && name="${name%.sh}"
[ "$name" != "$1" ] [ "$name" != "$1" ]
} }
function extract_archive() { function extract_archive() {
@ -4938,6 +5162,12 @@ function extract_archive() {
cd "$destdir" cd "$destdir"
jar xf "$arch" "$@" jar xf "$arch" "$@"
) || return ) || return
elif [ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && endswith "$arch" .sh; then
(
arch="$(abspath "$arch")"
cd "$destdir"
"${BASH:-/bin/sh}" "$arch" --tar xf "$@"
) || return
else else
return 1 return 1
fi fi
@ -4953,6 +5183,7 @@ function get_archive_basename() {
basename="${basename%.jar}" basename="${basename%.jar}"
basename="${basename%.war}" basename="${basename%.war}"
basename="${basename%.ear}" basename="${basename%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && basename="${basename%.sh}"
echo "$basename" echo "$basename"
} }
function get_archive_appname() { function get_archive_appname() {
@ -4966,6 +5197,7 @@ function get_archive_appname() {
appname="${appname%.jar}" appname="${appname%.jar}"
appname="${appname%.war}" appname="${appname%.war}"
appname="${appname%.ear}" appname="${appname%.ear}"
[ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && appname="${appname%.sh}"
echo "$appname" | awk '{ echo "$appname" | awk '{
if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) { if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) {
print substr($0, 1, RSTART - 1) print substr($0, 1, RSTART - 1)
@ -5207,6 +5439,12 @@ function unquote_html(s) {
gsub(/&amp;/, "\\&", s) gsub(/&amp;/, "\\&", s)
return s return s
} }
function qawk(s) {
gsub(/\\/, "\\\\", s)
gsub(/"/, "\\\"", s)
gsub(/\n/, "\\n", s)
return "\"" s "\""
}
function qval(s) {'" function qval(s) {'"
gsub(/'/, \"'\\\\''\", s) gsub(/'/, \"'\\\\''\", s)
return \"'\" s \"'\" return \"'\" s \"'\"
@ -5290,6 +5528,12 @@ function __parse_date_fr(date, parts, y, m, d) {
m = int(parts[2]) m = int(parts[2])
d = int(parts[1]) d = int(parts[1])
return mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d)) return mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d))
} else if (match(date, /([0-9][0-9]?)\/([0-9][0-9]?)\/([0-9][0-9])/, parts)) {
basey = int(strftime("%Y")); basey = basey - basey % 100
y = basey + int(parts[3])
m = int(parts[2])
d = int(parts[1])
return mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d))
} }
return -1 return -1
} }
@ -5934,7 +6178,7 @@ function pidfile_check() {
} }
function page_maybe() { function page_maybe() {
if isatty; then if isatty; then
less -XF "$@" less -XFR "$@"
else else
cat cat
fi fi
@ -6646,7 +6890,7 @@ function ask_any() {
lf="$(strlower "$f")" lf="$(strlower "$f")"
[ "$r" == "$lf" ] && return $i [ "$r" == "$lf" ] && return $i
if [ -z "$defi" ]; then if [ -z "$defi" ]; then
[[ "$f" =~ [A-Z] ]] && defi="$i" [ -z "${f/[A-Z]/}" ] && defi="$i"
fi fi
if [ "$lf" == o ]; then if [ "$lf" == o ]; then
case "$r" in o|y|1|v|t) return $i;; esac case "$r" in o|y|1|v|t) return $i;; esac
@ -6660,7 +6904,8 @@ function ask_any() {
else else
i=0 i=0
while [ $i -lt $count ]; do while [ $i -lt $count ]; do
[[ "${format:$i:1}" =~ [A-Z] ]] && return $i f="${format:$i:1}"
[ -z "${f/[A-Z]/}" ] && return $i
i=$(($i + 1)) i=$(($i + 1))
done done
return 0 return 0
@ -7386,18 +7631,36 @@ SYSDIST_ALIASES=(
10.7=lion 10.6=snowleopard 10.5=leopard 10.4=tiger 10.3=panther 10.7=lion 10.6=snowleopard 10.5=leopard 10.4=tiger 10.3=panther
) )
debianlike_SYSVERS=() debianlike_SYSVERS=()
debian_SYSVERS=(stretch jessie wheezy squeeze lenny etch) debian_SYSVERS=(
ubuntu_SYSVERS=(oneiric natty maverick lucid karmic jaunty intrepid hardy) forky trixie bookworm bullseye buster stretch jessie wheezy squeeze lenny etch
)
ubuntu_SYSVERS=(
mantic lunar kinetic jammy
impish hirsute groovy focal
eoan disco cosmic bionic
artful zesty yakkety xenial
wily vivid utopic trusty
saucy raring quantal precise
oneiric natty maverick lucid
karmic jaunty intrepid hardy
)
redhatlike_SYSVERS=() redhatlike_SYSVERS=()
ol_SYSVERS=(ol7 ol6 redhat7 redhat6) ol_SYSVERS=(ol8 ol7 ol6 redhat8 redhat7 redhat6)
rhel_SYSVERS=(rhel7 rhel6 rhel5 rhel4 redhat7 redhat6 redhat5 redhat4) rhel_SYSVERS=(rhel8 rhel7 rhel6 rhel5 rhel4 redhat8 redhat7 redhat6 redhat5 redhat4)
fedora_SYSVERS=(fedora14 fedora13 fedora12 fedora11) fedora_SYSVERS=(fedora14 fedora13 fedora12 fedora11)
centos_SYSVERS=(centos7 centos6 centos5 centos4 redhat7 redhat6 redhat5 redhat4) centos_SYSVERS=(centos7 centos6 centos5 centos4 redhat7 redhat6 redhat5 redhat4)
suse_SYSVERS=() suse_SYSVERS=()
gentoo_SYSVERS=() gentoo_SYSVERS=()
SYSVER_ALIASES=( SYSVER_ALIASES=(
9=stretch 8=jessie 7=wheezy 6=squeeze 5=lenny 4=etch 14=forky 13=trixie 12=bookworm 11=bullseye 10=buster 9=stretch 8=jessie 7=wheezy 6=squeeze 5=lenny 4=etch
11.10=oneiric 11.04=natty 10.10=maverick 10.04=lucid 9.10=karmic 9.04=jaunty 8.10=intrepid 8.04=hardy 23.10=mantic 23.04=lunar 22.10=kinetic 22.04=jammy
21.10=impish 21.04=hirsute 20.10=groovy 20.04=focal
19.10=eoan 19.04=disco 18.10=cosmic 18.04=bionic
17.10=artful 17.04=zesty 16.10=yakkety 16.04=xenial
15.10=wily 15.04=vivid 14.10=utopic 14.04=trusty
13.10=saucy 13.04=raring 12.10=quantal 12.04=precise
11.10=oneiric 11.04=natty 10.10=maverick 10.04=lucid
9.10=karmic 9.04=jaunty 8.10=intrepid 8.04=hardy
) )
function __setup_ALL_SYSvars() { function __setup_ALL_SYSvars() {
@ -7502,6 +7765,8 @@ function __compute_sysinfos() {
esac esac
if [ -n "$debian_version" ]; then if [ -n "$debian_version" ]; then
case "$debian_version" in case "$debian_version" in
11*|bullseye*) MYSYSDIST=(debian debianlike); MYSYSVER=(bullseye);;
10*|buster*) MYSYSDIST=(debian debianlike); MYSYSVER=(buster);;
9*|stretch*) MYSYSDIST=(debian debianlike); MYSYSVER=(stretch);; 9*|stretch*) MYSYSDIST=(debian debianlike); MYSYSVER=(stretch);;
8*|jessie*) MYSYSDIST=(debian debianlike); MYSYSVER=(jessie);; 8*|jessie*) MYSYSDIST=(debian debianlike); MYSYSVER=(jessie);;
7*|wheezy*) MYSYSDIST=(debian debianlike); MYSYSVER=(wheezy);; 7*|wheezy*) MYSYSDIST=(debian debianlike); MYSYSVER=(wheezy);;
@ -7515,6 +7780,7 @@ function __compute_sysinfos() {
elif [ -n "$oracle_release" ]; then elif [ -n "$oracle_release" ]; then
MYSYSDIST=(ol rhel redhatlike) MYSYSDIST=(ol rhel redhatlike)
case "$oracle_release" in case "$oracle_release" in
Oracle*Linux*release\ 8*) MYSYSVER=(ol8 rhel8 redhat8);;
Oracle*Linux*release\ 7*) MYSYSVER=(ol7 rhel7 redhat7);; Oracle*Linux*release\ 7*) MYSYSVER=(ol7 rhel7 redhat7);;
Oracle*Linux*release\ 6*) MYSYSVER=(ol6 rhel6 redhat6);; Oracle*Linux*release\ 6*) MYSYSVER=(ol6 rhel6 redhat6);;
esac esac
@ -7530,10 +7796,12 @@ function __compute_sysinfos() {
Fedora*13*) MYSYSVER=(fedora13);; Fedora*13*) MYSYSVER=(fedora13);;
Fedora*12*) MYSYSVER=(fedora12);; Fedora*12*) MYSYSVER=(fedora12);;
Fedora*11*) MYSYSVER=(fedora11);; Fedora*11*) MYSYSVER=(fedora11);;
Red*Hat*Enterprise*Linux*release\ 8*) MYSYSVER=(rhel8 redhat8);;
Red*Hat*Enterprise*Linux*release\ 7*) MYSYSVER=(rhel7 redhat7);; Red*Hat*Enterprise*Linux*release\ 7*) MYSYSVER=(rhel7 redhat7);;
Red*Hat*Enterprise*Linux*release\ 6*) MYSYSVER=(rhel6 redhat6);; Red*Hat*Enterprise*Linux*release\ 6*) MYSYSVER=(rhel6 redhat6);;
Red*Hat*Enterprise*Linux*release\ 5*) MYSYSVER=(rhel5 redhat5);; Red*Hat*Enterprise*Linux*release\ 5*) MYSYSVER=(rhel5 redhat5);;
Red*Hat*Enterprise*Linux*release\ 4*) MYSYSVER=(rhel4 redhat4);; Red*Hat*Enterprise*Linux*release\ 4*) MYSYSVER=(rhel4 redhat4);;
CentOS*release\ 8*) MYSYSVER=(centos8 redhat8);;
CentOS*release\ 7*) MYSYSVER=(centos7 redhat7);; CentOS*release\ 7*) MYSYSVER=(centos7 redhat7);;
CentOS*release\ 6*) MYSYSVER=(centos6 redhat6);; CentOS*release\ 6*) MYSYSVER=(centos6 redhat6);;
CentOS*release\ 5*) MYSYSVER=(centos5 redhat5);; CentOS*release\ 5*) MYSYSVER=(centos5 redhat5);;
@ -7895,6 +8163,29 @@ function on_default() {
fi fi
return 1 return 1
} }
function require_debian() {
set -- -d debian "$@"
if check_sysinfos "$@"; then
urequire debian
return 0
fi
local -a infos; local info
for info in "$@"; do
if ! [[ "$info" == -* ]]; then
infos=("${infos[@]}" "$info")
fi
done
local msg="Ce script n'est pas supporté sur $(get_sysinfos_desc)"
[ -n "$*" ] && msg="$msg
Il faut au moins l'un des systèmes suivants: ${infos[*]}"
[ -n "$UINST" -a -n "$ABORT" ] && touch "$ABORT"
die "$msg"
}
function require_stretch() {
require_debian -v stretch+
}
##@inc]sysinfos ##@inc]sysinfos
##@inc[compat ##@inc[compat
# Code de support pour les architectures autre que Linux # Code de support pour les architectures autre que Linux