maj des chemins

This commit is contained in:
Jephte CLAIN 2014-07-07 22:06:38 +04:00
parent ee78740382
commit 4100152139
94 changed files with 545 additions and 402 deletions

View File

@ -3,10 +3,10 @@
gendefault gendefault
etitle "Documentation de ulib" etitle "Documentation de ulib"
array_from_lines ulibnames "$(list_files ulib)" array_from_lines ulibnames "$(list_files lib/ulib)"
# faire les pages # faire les pages
for ulibname in "${ulibnames[@]}"; do for ulibname in "${ulibnames[@]}"; do
awkrun <"ulib/$ulibname" 'BEGIN { awkrun <"lib/ulib/$ulibname" 'BEGIN {
in_func = 0 in_func = 0
dump_doc = 0 dump_doc = 0
dumped_doc = 0 dumped_doc = 0

2
.udir
View File

@ -6,7 +6,7 @@ udir_note=""
udir_types=("uinst") udir_types=("uinst")
uinc=true uinc=true
uinc_options=() uinc_options=()
uinc_args=(ucrontab reptyr.cgo ulib/ulibsh ulib/support/install-pubkeys.sh lib/uinst/system_caps.legacy) uinc_args=(ucrontab reptyr.cgo lib/ulib/ulibsh lib/ulib/support/install-pubkeys.sh lib/uinst/system_caps.legacy)
# Faut-il désinstaller les fichiers de configuration de utools? # Faut-il désinstaller les fichiers de configuration de utools?
uninst_utools= uninst_utools=

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS service
function display_help() { function display_help() {
uecho "$scriptname: s'assurer que les services sont lancés pour un type de virtualisation uecho "$scriptname: s'assurer que les services sont lancés pour un type de virtualisation
@ -10,10 +12,6 @@ USAGE
Les types supportés sont virtualbox et kvm (par défaut)" Les types supportés sont virtualbox et kvm (par défaut)"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS service ||
exit 1
function ensure_kvm() { function ensure_kvm() {
# S'assurer que les modules VirtualBox sont déchargés et que les modules kvm # S'assurer que les modules VirtualBox sont déchargés et que les modules kvm
# sont chargés, et que le service libvirt-bin est démarré # sont chargés, et que le service libvirt-bin est démarré

6
SKvm
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS virsh
function display_help() { function display_help() {
uecho "$scriptname: lancer une machine virtuelle kvm uecho "$scriptname: lancer une machine virtuelle kvm
@ -34,10 +36,6 @@ OPTIONS
Afficher le gestionnaire de machines virtuelle" Afficher le gestionnaire de machines virtuelle"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS virsh ||
exit 1
function build_arrays() { function build_arrays() {
# Construire les listes avms, rvms, svms # Construire les listes avms, rvms, svms
# rvms: les vms qui tournent # rvms: les vms qui tournent

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: lancer une machine virtuelle VirtualBox uecho "$scriptname: lancer une machine virtuelle VirtualBox
@ -23,10 +25,6 @@ OPTIONS
-g Afficher le gestionnaire de machines virtuelle" -g Afficher le gestionnaire de machines virtuelle"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
function build_arrays() { function build_arrays() {
# Construire les listes avms, rvms, svms # Construire les listes avms, rvms, svms
# rvms: les vms qui tournent # rvms: les vms qui tournent

6
_root
View File

@ -1,15 +1,13 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire base
function display_help() { function display_help() {
uecho "$scriptname: devenir l'utilisateur root, avec 'sudo' si possible, ou 'su' si uecho "$scriptname: devenir l'utilisateur root, avec 'sudo' si possible, ou 'su' si
'sudo' n'est pas installé" 'sudo' n'est pas installé"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire base ||
exit 1
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
@ args -- "$@" && set -- "${args[@]}" || die "$args" @ args -- "$@" && set -- "${args[@]}" || die "$args"

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Se connecter sur un site FTP authentifié uecho "$scriptname: Se connecter sur un site FTP authentifié
@ -30,10 +32,6 @@ façon dont le proxy ftp est configuré, il n'est pas possible de se connecter
avec un mot de passe qui contient le caractère @" avec un mot de passe qui contient le caractère @"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
AUTHFTP_PROXY_DISABLED=1 # par défaut, ne pas utiliser le proxy AUTHFTP_PROXY_DISABLED=1 # par défaut, ne pas utiliser le proxy
set_defaults proxy set_defaults proxy
set_defaults authftp set_defaults authftp

2
bashrc
View File

@ -1,6 +1,6 @@
# -*- 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
function uprovide() { :; } function uprovide() { :; }
source @@dest@@/ulib/uenv || return source @@dest@@/lib/ulib/uenv || return
__uenv_source_dirs @@dest@@/bashrc.d "$HOME/etc/bashrc.d" __uenv_source_dirs @@dest@@/bashrc.d "$HOME/etc/bashrc.d"
__uenv_cleanup __uenv_cleanup

6
caturl
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Afficher une url uecho "$scriptname: Afficher une url
@ -8,10 +10,6 @@ USAGE
$scriptname <file.url|file.desktop|URL>" $scriptname <file.url|file.desktop|URL>"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
@ args -- "$@" && set -- "${args[@]}" || die "$args" @ args -- "$@" && set -- "${args[@]}" || die "$args"

2
cssh
View File

@ -1,6 +1,6 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1 source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS urequire DEFAULTS
function display_help() { function display_help() {

View File

@ -1,13 +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
source "$(dirname "$0")/../lib/ulib/ulib" || exit 1
source "$(dirname "$0")/../ulib/ulib" && urequire DEFAULTS
urequire DEFAULTS ||
exit 1
OENC="$UTF8"
function display_help() { function display_help() {
local OENC="$UTF8"
uecho "$scriptname: Mettre à jour la documentation pour les outils de nutools uecho "$scriptname: Mettre à jour la documentation pour les outils de nutools
USAGE USAGE
@ -93,7 +89,7 @@ $("$cmd" --help)
fi fi
if [ -n "$ulib" ]; then if [ -n "$ulib" ]; then
array_from_lines ulibnames "$(list_files ../ulib)" array_from_lines ulibnames "$(list_files ../lib/ulib)"
# faire l'entête # faire l'entête
dump_content ulib.twp "$oldcontent" dump_content ulib.twp "$oldcontent"
echo " echo "
@ -104,7 +100,7 @@ if [ -n "$ulib" ]; then
write_twpage "$oldcontent" ulib "$newcontent" ulib.twp write_twpage "$oldcontent" ulib "$newcontent" ulib.twp
# faire les pages # faire les pages
for ulibname in "${ulibnames[@]}"; do for ulibname in "${ulibnames[@]}"; do
ulib="../ulib/$ulibname" ulib="../lib/ulib/$ulibname"
twpage="ulib_$ulibname.twp" twpage="ulib_$ulibname.twp"
title="ulib/$ulibname" title="ulib/$ulibname"
dump_content "$twpage" "$oldcontent" dump_content "$twpage" "$oldcontent"

View File

@ -43,9 +43,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source "$(dirname "$0")/ulib/ulib" && source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
# Traduire le nom du script # Traduire le nom du script
for script_alias in "${SCRIPT_ALIASES[@]}"; do for script_alias in "${SCRIPT_ALIASES[@]}"; do

5
fconv
View File

@ -30,9 +30,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source "$(dirname "$0")/ulib/ulib" && source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
from=detect from=detect
case "${scriptname#fconv2}" in case "${scriptname#fconv2}" in

5
fnconv
View File

@ -28,9 +28,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source "$(dirname "$0")/ulib/ulib" && source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
from=detect from=detect
case "${scriptname#fnconv2}" in case "${scriptname#fnconv2}" in

6
geturl
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Télécharger un fichier avec wget ou curl uecho "$scriptname: Télécharger un fichier avec wget ou curl
@ -8,10 +10,6 @@ USAGE
$scriptname <file.url|file.desktop|URL> [wget options]" $scriptname <file.url|file.desktop|URL> [wget options]"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
parse_opts + "${PRETTYOPTS[@]}" \ parse_opts + "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
@ args -- "$@" && set -- "${args[@]}" || die "$args" @ args -- "$@" && set -- "${args[@]}" || die "$args"

View File

@ -7,7 +7,7 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
6*|squeeze*) 6*|squeeze*)
# le code suivant n'est compatible qu'avec debian squeeze # le code suivant n'est compatible qu'avec debian squeeze
if [ -z "$BASH_COMPLETION" -a "${BASH_VERSINFO[0]}" -ge 4 ]; then if [ -z "$BASH_COMPLETION" -a "${BASH_VERSINFO[0]}" -ge 4 ]; then
source "@@dest@@/ulib/bash_completion" source "@@dest@@/lib/ulib/bash_completion"
fi fi
if [ -n "$BASH_COMPLETION" ]; then if [ -n "$BASH_COMPLETION" ]; then
if [ -n "$BASH_COMPLETION_DIR" -a -f "$BASH_COMPLETION_DIR/ssh" ]; then if [ -n "$BASH_COMPLETION_DIR" -a -f "$BASH_COMPLETION_DIR/ssh" ]; then

View File

@ -1,7 +1,7 @@
#!/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
. "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
. "$(dirname "$0")/../../ulib/ulib" && urequire DEFAULTS || exit 1 urequire DEFAULTS
check_sysinfos -s linux -d debian || exit 0 check_sysinfos -s linux -d debian || exit 0
run_as_root "$@" run_as_root "$@"

View File

@ -1,7 +1,7 @@
#!/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
. "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
. "$(dirname "$0")/../../ulib/ulib" && urequire DEFAULTS || exit 1 urequire DEFAULTS
check_sysinfos -s linux -d debian || exit 0 check_sysinfos -s linux -d debian || exit 0
run_as_root "$@" run_as_root "$@"

View File

@ -1,11 +1,7 @@
#!/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
source "$(dirname "$0")/../lib/ulib/ulib" || exit 1
source "$(dirname "$0")/../ulib/ulib" && urequire DEFAULTS
urequire DEFAULTS ||
exit 1
OENC="$UTF8"
MAKESELFDIR="$scriptdir/makeself-2.1.5"
function display_help() { function display_help() {
uecho "$scriptname: Créer une archive auto-extractible qui installe nutools uecho "$scriptname: Créer une archive auto-extractible qui installe nutools
@ -22,6 +18,8 @@ OPTIONS
s'auto-détruit après utilisation." s'auto-détruit après utilisation."
} }
MAKESELFDIR="$scriptdir/makeself-2.1.5"
mode=755 mode=755
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \

View File

@ -6,7 +6,7 @@
# gourmandes en resources. # gourmandes en resources.
# Au 18/06/2013, cela ne concerne que les scripts/fichiers suivants: # Au 18/06/2013, cela ne concerne que les scripts/fichiers suivants:
# - lib/profile.d/bash_prompt # - lib/profile.d/bash_prompt
# - ulib/vcs {git_commit} # - lib/ulib/vcs {git_commit}
: "${UTOOLS_AUTO:=1}" "${UTOOLS_NOPUSH:=}" : "${UTOOLS_AUTO:=1}" "${UTOOLS_NOPUSH:=}"
export UTOOLS_AUTO UTOOLS_NOPUSH export UTOOLS_AUTO UTOOLS_NOPUSH

View File

@ -17,5 +17,5 @@ else
nutoolsdir="$(cd "$(dirname "$0")"; pwd)" nutoolsdir="$(cd "$(dirname "$0")"; pwd)"
fi fi
source "$nutoolsdir/ulib/nutools/pyulib" source "$nutoolsdir/lib/ulib/nutools/pyulib"
exec "$nutoolsdir/pyulib/src/uapps/$scriptname.py" "$@" exec "$nutoolsdir/lib/pyulib/src/uapps/$scriptname.py" "$@"

View File

@ -1,6 +1,7 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1; urequire DEFAULTS source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: uecho "$scriptname:

View File

@ -23,10 +23,9 @@ if [ $# -eq 2 ]; then
fi fi
fi fi
#source /etc/ulib && #source /etc/ulib || exit 1
source "$(dirname "$0")/../../ulib/ulib" && source "$(dirname "$0")/../../ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
[ $# -eq 1 -a "$1" == "--help" ] && exit_with display_help [ $# -eq 1 -a "$1" == "--help" ] && exit_with display_help

View File

@ -46,10 +46,9 @@ if [ $# -eq 2 ]; then
fi fi
fi fi
#source /etc/ulib && #source /etc/ulib || exit 1
source "$(dirname "$0")/../../ulib/ulib" && source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
function check_overwrite() { function check_overwrite() {
if [ -e "$1" -a -z "$overwrite" ]; then if [ -e "$1" -a -z "$overwrite" ]; then

View File

@ -46,10 +46,9 @@ if [ $# -eq 2 ]; then
fi fi
fi fi
#source /etc/ulib && #source /etc/ulib || exit 1
source "$(dirname "$0")/../../ulib/ulib" && source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
function check_overwrite() { function check_overwrite() {
if [ -e "$1" -a -z "$overwrite" ]; then if [ -e "$1" -a -z "$overwrite" ]; then

View File

@ -49,10 +49,9 @@ if [ $# -eq 2 ]; then
fi fi
fi fi
#source /etc/ulib && #source /etc/ulib || exit 1
source "$(dirname "$0")/../../ulib/ulib" && source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
function check_overwrite() { function check_overwrite() {
if [ -e "$1" -a -z "$overwrite" ]; then if [ -e "$1" -a -z "$overwrite" ]; then

View File

@ -53,7 +53,7 @@ if [ $# -eq 2 ]; then
fi fi
#source /etc/ulib || exit 1 #source /etc/ulib || exit 1
source "$(dirname "$0")/../../ulib/ulib" || exit 1 source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS urequire DEFAULTS
set_defaults nutools set_defaults nutools

View File

@ -46,10 +46,9 @@ if [ $# -eq 2 ]; then
fi fi
fi fi
#source /etc/ulib && #source /etc/ulib || exit 1
source "$(dirname "$0")/../../ulib/ulib" && source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
function check_overwrite() { function check_overwrite() {
if [ -e "$1" -a -z "$overwrite" ]; then if [ -e "$1" -a -z "$overwrite" ]; then

View File

@ -46,10 +46,9 @@ if [ $# -eq 2 ]; then
fi fi
fi fi
#source /etc/ulib && #source /etc/ulib || exit 1
source "$(dirname "$0")/../../ulib/ulib" && source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
function check_overwrite() { function check_overwrite() {
if [ -e "$1" -a -z "$overwrite" ]; then if [ -e "$1" -a -z "$overwrite" ]; then

View File

@ -1,10 +1,7 @@
#!/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
source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
source "$(dirname "$0")/../../ulib/ulib" && urequire DEFAULTS tiddlywiki
urequire DEFAULTS tiddlywiki ||
exit 1
OENC="$UTF8"
function display_help() { function display_help() {
echo "$scriptname: Télécharger la dernière version de TiddlyWiki" echo "$scriptname: Télécharger la dernière version de TiddlyWiki"

View File

@ -1,7 +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
source "$@" || exit 1 source "$@" || exit 1
source "$ULIBDIR/ulib" && urequire DEFAULTS uenv uenv_update || exit 1 source "$ULIBDIR/ulib" || exit 1
urequire DEFAULTS uenv uenv_update
cd "$scriptdir/../.." cd "$scriptdir/../.."
# supprimer les fichiers de VCS # supprimer les fichiers de VCS
@ -11,13 +12,13 @@ rm -rf .git
rm -f .nutools-devel rm -f .nutools-devel
# supprimer fichiers de développement # supprimer fichiers de développement
rm -rf pyulib/{build,devel,migrate,test} rm -rf lib/pyulib/{build,devel,migrate,test}
# liens pour les scripts python # liens pour les scripts python
for i in plver plbck uencdetect urandomize umail uxpath wofixsql; do for i in plver plbck uencdetect urandomize umail uxpath wofixsql; do
ln -s lib/pywrapper "$i" ln -s lib/pywrapper "$i"
done done
ln -s ulib/support/cgiupload.py ln -s lib/ulib/support/cgiupload.py
# liens pour les scripts shell # liens pour les scripts shell
for i in cg cgs; do for i in cg cgs; do

View File

@ -1,24 +1,25 @@
# -*- 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
source "$@" || exit 1 source "$@" || exit 1
source "$ULIBDIR/ulib" && urequire DEFAULTS || exit 1 source "$ULIBDIR/ulib" || exit 1
urequire DEFAULTS
cd "$scriptdir/../../" cd "$scriptdir/../.."
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"
./uinst -y pyulib >&"$log" ./uinst -y lib/pyulib >&"$log"
eend 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 pyulib/build rm -rf lib/pyulib/build
dest="@@dest@@" dest="@@dest@@"
for i in ulib ulibsh; do for i in ulib ulibsh; do
sed "s|@@""dest""@@|$dest|g" "ulib/$i" >"/etc/$i" sed "s|@@""dest""@@|$dest|g" "lib/ulib/$i" >"/etc/$i"
done done
cp ulib/.ulib_version /etc/.ulib_version cp lib/ulib/.ulib_version /etc/.ulib_version
echo >/etc/ulibauto '# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 echo >/etc/ulibauto '# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
if [ x"$BASH" != x -a -f /etc/ulib ]; then if [ x"$BASH" != x -a -f /etc/ulib ]; then
. /etc/ulib . /etc/ulib

View File

@ -11,6 +11,11 @@ elif [ "$0" == "-bash" ]; then
scriptname= scriptname=
scriptdir= scriptdir=
script= script=
elif [ ! -f "$0" -a -f "${0#-}" ]; then
scriptname="$(basename -- "${0#-}")"
scriptdir="$(dirname -- "${0#-}")"
scriptdir="$(cd "$scriptdir"; pwd)"
script="$scriptdir/$scriptname"
else else
scriptname="$(basename -- "$0")" scriptname="$(basename -- "$0")"
scriptdir="$(dirname -- "$0")" scriptdir="$(dirname -- "$0")"

View File

@ -29,6 +29,79 @@ export TMPDIR="${TMPDIR:-${TMP:-${TEMP:-/tmp}}}"
[ -f /etc/nutoolsrc ] && . /etc/nutoolsrc [ -f /etc/nutoolsrc ] && . /etc/nutoolsrc
[ -f ~/.nutoolsrc ] && . ~/.nutoolsrc [ -f ~/.nutoolsrc ] && . ~/.nutoolsrc
function recho() {
if [[ "${1:0:2}" == -[eEn] ]]; then
echo -n -
local first="${1:1}"; shift
echo "$first$@"
else
echo "$@"
fi
}
function recho_() {
if [[ "${1:0:2}" == -[eEn] ]]; then
echo -n -
local first="${1:1}"; shift
echo -n "$first$@"
else
echo -n "$@"
fi
}
function qval() {
local s="$*"
s="${s//\\/\\\\}"
s="${s//\"/\\\"}"
s="${s//\$/\\\$}"
s="${s//\`/\\\`}"
recho_ "$s"
}
function should_quote() {
[ -z "$1" ] && return 0
local s="${*//[a-zA-Z0-9]/}"
s="${s//,/}"
s="${s//./}"
s="${s//+/}"
s="${s//\//}"
s="${s//-/}"
s="${s//_/}"
s="${s//=/}"
[ -n "$s" ]
}
function qvals() {
local arg first=1
for arg in "$@"; do
[ -z "$first" ] && echo -n " "
if should_quote "$arg"; then
echo -n \"
qval "$arg"
echo -n \"
else
recho_ "$arg"
fi
first=
done
}
function qlines() {
sed "s/'/'\\\\''/g; s/.*/'&'/g"
}
function setv() {
local __s_var="$1"; shift
eval "$__s_var=\"$(qval "$*")\""
}
function setx() {
local __s_var="$1"; shift
eval "$__s_var=\"\$(\"\$@\")\""
}
function seta() {
local __s_array="$1"; shift
eval "$__s_array=($("$@" | qlines))"
}
function e2of() {
"$@" 2>&1
}
function nef() {
"$@" | sed '/^$/d'
}
function isnum() { function isnum() {
[ ${#1} -gt 0 ] || return 1 [ ${#1} -gt 0 ] || return 1
@ -53,14 +126,10 @@ function isrnum() {
[ -z "$v" ] [ -z "$v" ]
} }
function is_yes() { function is_yes() {
[ "$1" == "o" -o "$1" == "O" -o "$1" == "oui" -o "$1" == "OUI" ] && return 0 case "${1,,}" in
[ "$1" == "y" -o "$1" == "Y" -o "$1" == "yes" -o "$1" == "YES" ] && return 0 o|oui|y|yes|v|vrai|t|true|on) return 0;;
[ "$1" == "v" -o "$1" == "V" -o "$1" == "vrai" -o "$1" == "VRAI" ] && return 0 esac
[ "$1" == "t" -o "$1" == "T" -o "$1" == "true" -o "$1" == "TRUE" ] && return 0 isnum "$1" && [ "$1" -ne 0 ] && return 0
[ "$1" == "on" -o "$1" == "ON" ] && return 0
if isnum "$1"; then
[ "$1" -ne 0 ] && return 0
fi
return 1 return 1
} }
function yesval() { function yesval() {
@ -79,14 +148,10 @@ function normyesvals() {
done done
} }
function is_no() { function is_no() {
[ "$1" == "n" -o "$1" == "N" -o "$1" == "non" -o "$1" == "NON" ] && return 0 case "${1,,}" in
[ "$1" == "no" -o "$1" == "NO" ] && return 0 n|non|no|f|faux|false|off) return 0;;
[ "$1" == "f" -o "$1" == "F" -o "$1" == "faux" -o "$1" == "FAUX" ] && return 0 esac
[ "$1" == "false" -o "$1" == "FALSE" ] && return 0 isnum "$1" && [ "$1" -eq 0 ] && return 0
[ "$1" == "off" -o "$1" == "OFF" ] && return 0
if isnum "$1"; then
[ "$1" -eq 0 ] && return 0
fi
return 1 return 1
} }
function rawecho() { function rawecho() {
@ -115,18 +180,6 @@ function quote_arg() {
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
rawecho "$s" rawecho "$s"
} }
function should_quote() {
[ -z "$1" ] && return 0
local s="${1//[a-zA-Z0-9]/}"
s="${s//,/}"
s="${s//./}"
s="${s//+/}"
s="${s//\//}"
s="${s//-/}"
s="${s//_/}"
s="${s//=/}"
[ -n "$s" ]
}
function quoted_arg() { function quoted_arg() {
should_quote "$1" && echo "\"$(quote_arg "$1")\"" || quote_arg "$1" should_quote "$1" && echo "\"$(quote_arg "$1")\"" || quote_arg "$1"
} }
@ -403,6 +456,18 @@ function array_fillrange() {
done done
array_copy "$1" __af_vs array_copy "$1" __af_vs
} }
function array_eq() {
local -a __ae_a1 __ae_a2
array_copy __ae_a1 "$1"
array_copy __ae_a2 "$2"
[ ${#__ae_a1[*]} -eq ${#__ae_a2[*]} ] || return 1
local __ae_v __ae_i=0
for __ae_v in "${__ae_a1[@]}"; do
[ "$__ae_v" == "${__ae_a2[$__ae_i]}" ] || return 1
__ae_i=$(($__ae_i + 1))
done
return 0
}
function array_contains() { function array_contains() {
local __ac_v local __ac_v
eval 'for __ac_v in "${'"$1"'[@]}"; do eval 'for __ac_v in "${'"$1"'[@]}"; do
@ -512,14 +577,14 @@ function array_extend_lasts() {
eval "$1=(\"\${$1[@]}\" \"\${$2[@]:1}\")" eval "$1=(\"\${$1[@]}\" \"\${$2[@]:1}\")"
} }
function array_xsplit() { function array_xsplit() {
eval "$1=($(<<<"$2" stripnl | awkrun RS="${3:-:}" ' eval "$1=($(recho_ "$2" | awkrun RS="${3:-:}" '
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
print "'\''" $0 "'\''" print "'\''" $0 "'\''"
}'))" #" }'))" #"
} }
function array_split() { function array_split() {
eval "$1=($(<<<"$2" stripnl | awkrun RS="${3:-:}" ' eval "$1=($(recho_ "$2" | awkrun RS="${3:-:}" '
/^$/ { next } /^$/ { next }
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
@ -530,14 +595,14 @@ function array_from_path() {
array_split "$1" "$2" ":" array_split "$1" "$2" ":"
} }
function array_from_xlines() { function array_from_xlines() {
eval "$1=($(<<<"$2" _nl2lf | awk ' eval "$1=($(recho_ "$2" | _nl2lf | awk '
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
print "'\''" $0 "'\''" print "'\''" $0 "'\''"
}'))" #" }'))" #"
} }
function array_from_lines() { function array_from_lines() {
eval "$1=($(<<<"$2" _nl2lf | awk ' eval "$1=($(recho_ "$2" | _nl2lf | awk '
/^$/ { next } /^$/ { next }
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
@ -591,7 +656,7 @@ function array_fix_paths() {
array_copy __afp_vs "$__afp_an" array_copy __afp_vs "$__afp_an"
array_new "$__afp_an" array_new "$__afp_an"
for __afp_v in "${__afp_vs[@]}"; do for __afp_v in "${__afp_vs[@]}"; do
array_split __afp_v "$__afp_v" array_split __afp_v "$__afp_v" "$__afp_s"
array_extend "$__afp_an" __afp_v array_extend "$__afp_an" __afp_v
done done
} }
@ -624,12 +689,9 @@ function parse_date() {
}')" }')"
esac esac
case "$type" in case "$type" in
d|date) d|date) awk '{ print strftime("%d/%m/%Y", $0 + 0) }' <<<"$value";;
awk '{ print strftime("%d/%m/%Y", $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";;
l|ldap)
awk '{ print strftime("%Y%m%d%H%M%S+0400", $0 + 0) }' <<<"$value"
;;
*) *)
rawecho "$value" rawecho "$value"
;; ;;
@ -899,6 +961,13 @@ function testsame() {
function testdiff() { function testdiff() {
! quietdiff "$@" ! quietdiff "$@"
} }
function testupdated() {
if [ -f "$2" ]; then
testdiff "$1" "$2"
else
return 0
fi
}
function testnewer() { function testnewer() {
test ! -e "$2" -o "$1" -nt "$2" test ! -e "$2" -o "$1" -nt "$2"
} }
@ -989,15 +1058,16 @@ function rm_maybe() {
done done
[ -n "$rm" ] && /bin/rm "$@" [ -n "$rm" ] && /bin/rm "$@"
} }
__CPDIR_RSYNC_ARGS=() __CPDIR_RSYNC_SLOW=1 # synchro potentiellement plus lente, mais plus fidèle (option -c)
__CPDIR_RSYNC_ARGS=(-q)
function cpdir() { function cpdir() {
if progexists rsync; then if progexists rsync; then
[ -d "$2" ] || mkdir -p "$2" || return 1 [ -d "$2" ] || mkdir -p "$2" || return 1
if [ -d "$1" ]; then if [ -d "$1" ]; then
rsync -qa "${__CPDIR_RSYNC_ARGS[@]}" "$1/" "$2/" rsync -a ${__CPDIR_RSYNC_SLOW:+-c} "${__CPDIR_RSYNC_ARGS[@]}" "$1/" "$2/"
else else
rsync -qa "${__CPDIR_RSYNC_ARGS[@]}" "$1" "$2/" rsync -a ${__CPDIR_RSYNC_SLOW:+-c} "${__CPDIR_RSYNC_ARGS[@]}" "$1" "$2/"
fi fi
else else
__cpdir "$@" __cpdir "$@"
@ -1033,17 +1103,17 @@ function __cpdir() {
fi fi
fi fi
} }
CPNOVCS_OPTS=() # deprecated __CPNOVCS_RSYNC_SLOW=1 # synchro potentiellement plus lente, mais plus fidèle (option -c)
__CPNOVCS_RSYNC_ARGS=() __CPNOVCS_RSYNC_ARGS=(-q)
function cpnovcs() { function cpnovcs() {
local src="$1" destdir="$2" local src="$1" destdir="$2"
[ -d "$destdir" ] || mkdir -p "$destdir" || return 1 [ -d "$destdir" ] || mkdir -p "$destdir" || return 1
if progexists rsync; then if progexists rsync; then
local gitexclude=/.git/ local gitexclude=/.git/
if [ "${src%/}" != "$src" ]; then if [ "${src%/}" == "$src" ]; then
gitexclude="/$(basename -- "$src")$gitexclude" gitexclude="/$(basename -- "$src")$gitexclude"
fi fi
rsync -qa --exclude CVS --exclude .svn --exclude "$gitexclude" "${CPNOVCS_OPTS[@]}" "${__CPNOVCS_RSYNC_ARGS[@]}" "$src" "$destdir/" rsync -a ${__CPNOVCS_RSYNC_SLOW:+-c} --exclude CVS/ --exclude .svn/ --exclude "$gitexclude" "${__CPNOVCS_RSYNC_ARGS[@]}" "$src" "$destdir/"
elif [ "${src%/}" != "$src" ]; then elif [ "${src%/}" != "$src" ]; then
__cpdir "$src" "$destdir" __cpdir "$src" "$destdir"
else else
@ -1271,11 +1341,25 @@ function get_archive_appname() {
print substr($0, 1, RSTART - 1) print substr($0, 1, RSTART - 1)
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) { } else 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)
} else if (match($0, /([0-9]+[a-z][a-z][a-z0-9]?)$/, vs)) {
print substr($0, 1, RSTART - 1)
} else { } else {
print $0 print $0
} }
}' }'
} }
function get_archive_versionsuffix() {
local basename="$(get_archive_basename "$1")"
echo "$basename" | awk '{
if (match($0, /([-_.][0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"]
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"]
} else if (match($0, /([0-9]+[a-z][a-z][a-z0-9]?)$/, vs)) {
print vs["1"]
}
}'
}
function get_archive_version() { function get_archive_version() {
local basename="$(get_archive_basename "$1")" local basename="$(get_archive_basename "$1")"
echo "$basename" | awk '{ echo "$basename" | awk '{
@ -1283,7 +1367,7 @@ function get_archive_version() {
print vs["1"] print vs["1"]
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) { } else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"] print vs["1"]
} else if (match($0, /([0-9]+[a-z][a-z][a-z]?)$/, vs)) { } else if (match($0, /([0-9]+[a-z][a-z][a-z0-9]?)$/, vs)) {
print vs["1"] print vs["1"]
} }
}' }'
@ -1504,6 +1588,13 @@ function quote_sql(s) {'"
gsub(/'/, \"''\", s) gsub(/'/, \"''\", s)
return \"'\" s \"'\" return \"'\" s \"'\"
"'} "'}
function unquote_mysqlcsv(s) {
gsub(/\\n/, "\n", s)
gsub(/\\t/, "\t", s)
gsub(/\\0/, "\0", s)
gsub(/\\\\/, "\\", s)
return s
}
function array_new(dest) { function array_new(dest) {
dest[0] = 0 # forcer awk à considérer dest comme un tableau dest[0] = 0 # forcer awk à considérer dest comme un tableau
delete dest delete dest
@ -1807,7 +1898,7 @@ function array_formatcsv2(fields, colsep, mvsep, qchar, echar, count, indic
if (echar != "") gsub(qchar, quote_subrepl(echar) "&", value); if (echar != "") gsub(qchar, quote_subrepl(echar) "&", value);
else gsub(qchar, "&&", value); else gsub(qchar, "&&", value);
} }
if (qchar != "" && (index(value, mvsep) != 0 || index(value, colsep) != 0 || __csv_should_quote(value))) { if (qchar != "" && (index(value, mvsep) != 0 || index(value, colsep) != 0 || index(value, qchar) != 0 || __csv_should_quote(value))) {
line = line qchar value qchar line = line qchar value qchar
} else { } else {
line = line value line = line value
@ -1981,12 +2072,12 @@ function awkdef() {
} }
function lawkrun() { function lawkrun() {
local -a __ar_defs __ar_args local -a __ar_defs __ar_args
while [ -n "$1" -a "$1" != "--" ]; do while [ $# -gt 0 -a "$1" != "--" ]; do
__ar_defs=("${__ar_defs[@]}" "$1") __ar_defs=("${__ar_defs[@]}" "$1")
shift shift
done done
shift shift
while [ -n "$1" ]; do while [ $# -gt 0 ]; do
__ar_args=("${__ar_args[@]}" "$1") __ar_args=("${__ar_args[@]}" "$1")
shift shift
done done
@ -2341,6 +2432,13 @@ function pidfile_check() {
fi fi
return 1 return 1
} }
function page_maybe() {
if isatty; then
less -XF
else
cat
fi
}
function utools_local() { function utools_local() {
@ -2638,6 +2736,29 @@ function eecho_() {
function edebug() { function edebug() {
show_debug || return; eflush; __edebug "$*" 1>&2 show_debug || return; eflush; __edebug "$*" 1>&2
} }
function trace() {
local r cmd="$(quoted_args "$@")"
show_info && { eflush; __eecho "\$ $cmd" 1>&2; }
"$@"; r=$?
if [ $r -ne 0 ]; then
if show_info; then
eflush; __eecho "^ [EC #$r]" 1>&2
elif show_error; then
eflush; __eecho "^ $cmd [EC #$r]" 1>&2;
fi
fi
return $r
}
function trace_error() {
local r
"$@"; r=$?
if [ $r -ne 0 ]; then
local cmd="$(quoted_args "$@")"
show_error && { eflush; __eecho "^ $cmd [EC #$r]" 1>&2; }
fi
return $r
}
function etitle() { function etitle() {
local __t_deferred= local __t_deferred=
__t_etitle "$@" __t_etitle "$@"

View File

@ -3,8 +3,8 @@
# charger le fichier de configuration $1 pour avoir ULIBDIR # charger le fichier de configuration $1 pour avoir ULIBDIR
source "$1" || exit 1 source "$1" || exit 1
source "$ULIBDIR/ulib" && urequire DEFAULTS uinst || exit 1 source "$ULIBDIR/ulib" || exit 1
OENC="$UTF8" urequire DEFAULTS uinst
is_root || die "Ce script doit être lancé avec les droits de root" is_root || die "Ce script doit être lancé avec les droits de root"

View File

@ -3,8 +3,8 @@
# charger le fichier de configuration $1 pour avoir ULIBDIR # charger le fichier de configuration $1 pour avoir ULIBDIR
source "$1" || exit 1 source "$1" || exit 1
source "$ULIBDIR/ulib" && urequire DEFAULTS uinst || exit 1 source "$ULIBDIR/ulib" || exit 1
OENC="$UTF8" urequire DEFAULTS uinst
is_root || die "Ce script doit être lancé avec les droits de root" is_root || die "Ce script doit être lancé avec les droits de root"

View File

@ -2,10 +2,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
source "$1" || exit 1 # pour avoir la définition de ULIBDIR source "$1" || exit 1 # pour avoir la définition de ULIBDIR
source "$ULIBDIR/ulib" && source "$ULIBDIR/ulib" || exit 1
urequire DEFAULTS prefixes apache webobjects wosign || urequire DEFAULTS prefixes apache webobjects wosign
exit 1
OENC="$UTF8"
is_root || die "Ce script doit être lancé avec les droits de root" is_root || die "Ce script doit être lancé avec les droits de root"

View File

@ -8,7 +8,8 @@
# Ensuite, des librairies individuelles de ulib peuvent être chargées avec la # Ensuite, des librairies individuelles de ulib peuvent être chargées avec la
# fonction urequire(), e.g. # fonction urequire(), e.g.
# source /etc/ulib && urequire DEFAULTS conf || exit 1 # source /etc/ulib || exit 1
# urequire DEFAULTS conf
# 'DEFAULTS' permet de charger base, pretty, sysinfos et compat. # 'DEFAULTS' permet de charger base, pretty, sysinfos et compat.
function eerror() { echo "error: $*" 1>&2; } function eerror() { echo "error: $*" 1>&2; }
@ -18,9 +19,9 @@ function die() { [ -n "$*" ] && eerror "$*"; exit 1; }
# il est possible de forcer la valeur de ULIBDIR avec FORCED_ULIBDIR. ceci est # il est possible de forcer la valeur de ULIBDIR avec FORCED_ULIBDIR. ceci est
# utile avec bash 2.x qui ne supporte pas la variable BASH_SOURCE # utile avec bash 2.x qui ne supporte pas la variable BASH_SOURCE
ULIBDIR="${FORCED_ULIBDIR:-@@dest@@/ulib}" ULIBDIR="${FORCED_ULIBDIR:-@@dest@@/lib/ulib}"
if [ "$ULIBDIR" = "@@""dest""@@/ulib" ]; then if [ "$ULIBDIR" = "@@""dest""@@/lib/ulib" ]; then
# La valeur "@@"dest"@@" n'est remplacée que dans la copie de ce script # La valeur "@@"dest"@@" n'est remplacée que dans la copie de ce script
# faite dans /etc. Sinon, il faut toujours faire le calcul. Cela permet de # faite dans /etc. Sinon, il faut toujours faire le calcul. Cela permet de
# déplacer la librairie n'importe ou sur le disque, ce qui est # déplacer la librairie n'importe ou sur le disque, ce qui est

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Gestion de la version de ulib uecho "$scriptname: Gestion de la version de ulib
@ -19,10 +21,6 @@ OPTIONS
juste tester la version et ne pas afficher le message d'information." juste tester la version et ne pas afficher le message d'information."
} }
source "$(dirname "$0")/ulib" &&
urequire DEFAULTS ||
exit 1
action=show action=show
version=0 version=0
set_version= set_version=

View File

@ -24,9 +24,9 @@ function eerror() { echo "error: $*" 1>&2; }
function die() { [ -n "$*" ] && eerror "$*"; exit 1; } function die() { [ -n "$*" ] && eerror "$*"; exit 1; }
ULIBDIR="${FORCED_ULIBDIR:-@@dest@@/ulib}" ULIBDIR="${FORCED_ULIBDIR:-@@dest@@/lib/ulib}"
if [ "$ULIBDIR" = "@@""dest""@@/ulib" ]; then if [ "$ULIBDIR" = "@@""dest""@@/lib/ulib" ]; then
ULIBDIR="${BASH_SOURCE[0]}" ULIBDIR="${BASH_SOURCE[0]}"
if [ -n "$ULIBDIR" -a -f "$ULIBDIR" ]; then if [ -n "$ULIBDIR" -a -f "$ULIBDIR" ]; then
ULIBDIR="$(dirname "$ULIBDIR")" ULIBDIR="$(dirname "$ULIBDIR")"

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS awk
function display_help() { function display_help() {
uecho "$scriptname: Outils pour gérer une installation de MediaWiki uecho "$scriptname: Outils pour gérer une installation de MediaWiki
@ -42,10 +44,6 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS awk ||
exit 1
# Traduire le nom du script # Traduire le nom du script
for script_alias in "${SCRIPT_ALIASES[@]}"; do for script_alias in "${SCRIPT_ALIASES[@]}"; do
splitpair "$script_alias" src dest splitpair "$script_alias" src dest

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Créer un fichier de redirections pour Apache à partir d'un certain uecho "$scriptname: Créer un fichier de redirections pour Apache à partir d'un certain
@ -80,10 +82,6 @@ Dans les exemples donnés ci-dessus, $URL est l'\''url générée par la réécr
et $proxy_acls la valeur du champ proxy_acls spécifiée ci-dessus.' et $proxy_acls la valeur du champ proxy_acls spécifiée ci-dessus.'
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
proxy_enabled= proxy_enabled=
infile= infile=
outfile="RewriteRules.conf" outfile="RewriteRules.conf"

6
mkiso
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: créer une image iso d'un répertoire uecho "$scriptname: créer une image iso d'un répertoire
@ -12,10 +14,6 @@ OPTIONS
créer une image hybride ISO/HFS" créer une image hybride ISO/HFS"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
hfsmode= hfsmode=
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \

6
mkurl
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Enregistrer une url dans un fichier raccourci uecho "$scriptname: Enregistrer une url dans un fichier raccourci
@ -14,10 +16,6 @@ raccourci utilisable aussi sous Windows, ou avec l'extension .desktop pour
compatibilité avec le standard XDG" compatibilité avec le standard XDG"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
@ args -- "$@" && set -- "${args[@]}" || die "$args" @ args -- "$@" && set -- "${args[@]}" || die "$args"

6
mkusfx
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Créer une archive auto-extractible qui installe son contenu avec uinst uecho "$scriptname: Créer une archive auto-extractible qui installe son contenu avec uinst
@ -29,10 +31,6 @@ OPTIONS
locale de ulib et uinst.sh" locale de ulib et uinst.sh"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
MAKESELFDIR="$scriptdir/lib/makeself-2.1.5" MAKESELFDIR="$scriptdir/lib/makeself-2.1.5"
sfxtype=uinst sfxtype=uinst

6
mocifs
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Monter un partage Windows/Samba/CIFS uecho "$scriptname: Monter un partage Windows/Samba/CIFS
@ -24,10 +26,6 @@ OPTIONS
Spécifier les credentials à utiliser pour la connexion" Spécifier les credentials à utiliser pour la connexion"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
if ! progexists mount.cifs; then if ! progexists mount.cifs; then
[ -x /sbin/mount.cifs ] || die "Ce script nécessite cifs-utils. Sur debian, vous pouvez l'installer avec la commande [ -x /sbin/mount.cifs ] || die "Ce script nécessite cifs-utils. Sur debian, vous pouvez l'installer avec la commande
sudo apt-get install cifs-utils" sudo apt-get install cifs-utils"

6
modav
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Monter un répertoire sur un hôte distant avec davfs uecho "$scriptname: Monter un répertoire sur un hôte distant avec davfs
@ -38,10 +40,6 @@ OPTIONS
mountpoint username password" mountpoint username password"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
if ! progexists mount.davfs; then if ! progexists mount.davfs; then
[ -x /usr/sbin/mount.davfs ] || die "Ce script nécessite davfs2. Sur debian, vous pouvez l'installer avec la commande [ -x /usr/sbin/mount.davfs ] || die "Ce script nécessite davfs2. Sur debian, vous pouvez l'installer avec la commande
sudo apt-get install davfs2" sudo apt-get install davfs2"

6
moiso
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Monter une image ISO uecho "$scriptname: Monter une image ISO
@ -18,10 +20,6 @@ OPTIONS
Forcer le démontage" Forcer le démontage"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
action=auto action=auto
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \

2
mossh
View File

@ -1,6 +1,6 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1 source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS urequire DEFAULTS
function display_help() { function display_help() {

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Faire une requête MySQL et formater la sortie pour traitement avec awkcsv uecho "$scriptname: Faire une requête MySQL et formater la sortie pour traitement avec awkcsv
@ -63,10 +65,6 @@ OPTIONS
arguments." arguments."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
host= host=
port= port=
user= user=

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS awk
function display_help() { function display_help() {
uecho "$scriptname: Charger une table MySQL avec un fichier csv uecho "$scriptname: Charger une table MySQL avec un fichier csv
@ -82,8 +84,6 @@ OPTIONS
est quand même honoré." est quand même honoré."
} }
source "$(dirname "$0")/ulib/ulib" || exit 1; urequire DEFAULTS awk
__AWK_MYSQLFUNCS=' __AWK_MYSQLFUNCS='
function format_sqlvalue(value) { function format_sqlvalue(value) {
if (value ~ /^[0-9]+$/) { if (value ~ /^[0-9]+$/) {

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Ouvrir une URL dans un navigateur uecho "$scriptname: Ouvrir une URL dans un navigateur
@ -8,10 +10,6 @@ USAGE
$scriptname <file.url|file.desktop|URL>" $scriptname <file.url|file.desktop|URL>"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
@ args -- "$@" && set -- "${args[@]}" || die "$args" @ args -- "$@" && set -- "${args[@]}" || die "$args"

View File

@ -3,6 +3,6 @@
[ -z "$USER" -a -n "$LOGNAME" ] && export USER="$LOGNAME" [ -z "$USER" -a -n "$LOGNAME" ] && export USER="$LOGNAME"
function uprovide() { :; } function uprovide() { :; }
source @@dest@@/ulib/uenv || return source @@dest@@/lib/ulib/uenv || return
__uenv_source_dirs @@dest@@/profile.d "$HOME/etc/profile.d" __uenv_source_dirs @@dest@@/profile.d "$HOME/etc/profile.d"
__uenv_cleanup __uenv_cleanup

2
rruns
View File

@ -1,6 +1,6 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1 source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS runs urequire DEFAULTS runs
function display_help() { function display_help() {

2
ruinst
View File

@ -1,6 +1,6 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1 source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS nutools/pyulib urequire DEFAULTS nutools/pyulib
function display_help() { function display_help() {

6
runs
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS runs
function display_help() { function display_help() {
uecho "$scriptname: Lancer un script avec le protocole runs uecho "$scriptname: Lancer un script avec le protocole runs
@ -56,10 +58,6 @@ Gestion des scripts
-z Forcer la réinstallation des scripts qui se basent sur shouldrun/setdone" -z Forcer la réinstallation des scripts qui se basent sur shouldrun/setdone"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS runs ||
exit 1
set_defaults runs set_defaults runs
function runs_path_required() { function runs_path_required() {

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS woinst
function display_help() { function display_help() {
uecho "$scriptname: Déploiement distant avec woinst uecho "$scriptname: Déploiement distant avec woinst
@ -32,10 +34,6 @@ OPTIONS
user@host, e.g -H user@host" user@host, e.g -H user@host"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS woinst ||
exit 1
set_defaults pubkeys set_defaults pubkeys
action=deploy action=deploy

6
twsync
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS udir tiddlywiki javaproperties
function display_help() { function display_help() {
uecho "$scriptname: synchroniser un répertoire de wiki avec un tiddlywiki uecho "$scriptname: synchroniser un répertoire de wiki avec un tiddlywiki
@ -33,10 +35,6 @@ OPTIONS
située dans $(ppath "$TEMPLATE")" située dans $(ppath "$TEMPLATE")"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS udir tiddlywiki javaproperties ||
exit 1
TEMPLATE="$scriptdir/lib/tiddlywiki/empty.html" TEMPLATE="$scriptdir/lib/tiddlywiki/empty.html"
function find_wikifile() { function find_wikifile() {

3
uawk
View File

@ -12,7 +12,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source "$(dirname "$0")/ulib/ulib" || exit 1; urequire DEFAULTS awk source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS awk
# si on lance le script uawk, donner la possibilité de choisir l'outil # si on lance le script uawk, donner la possibilité de choisir l'outil
if [ "$scriptname" == uawk ] && array_contains ALIASES "${1#l}"; then if [ "$scriptname" == uawk ] && array_contains ALIASES "${1#l}"; then

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: faire une sauvegarde des fichiers uecho "$scriptname: faire une sauvegarde des fichiers
@ -18,10 +20,6 @@ OPTIONS
-H Arrêter la machine après une sauvegarde REUSSIE." -H Arrêter la machine après une sauvegarde REUSSIE."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
action=getargs action=getargs
profile= profile=
HOMEDIR="$HOME" HOMEDIR="$HOME"

6
ucalc
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Afficher une valeur dans plusieurs unités uecho "$scriptname: Afficher une valeur dans plusieurs unités
@ -29,10 +31,6 @@ OPTIONS
en cylindres" en cylindres"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
unit= unit=
ounit= ounit=
cyl= cyl=

6
uconf
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS conf
function display_help() { function display_help() {
local OENC="$UTF8" local OENC="$UTF8"
@ -51,10 +53,6 @@ OPTIONS
automatiquement." automatiquement."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS conf ||
exit 1
action=enable action=enable
quoted= quoted=
type=auto type=auto

236
ucrontab
View File

@ -1,5 +1,10 @@
#!/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
#source "$(dirname "$0")/lib/ulib/ulib" || exit 1
#urequire DEFAULTS crontab
# Pour pouvoir être copié le cas échéant sur un hôte distant, la librairie ulib
# est inclue avec uinc à partir de lib/ulib. En mode développement, il faut
# replier les inclusions avec uinc -f et décommenter les lignes ci-dessus
function display_help() { function display_help() {
uecho "$scriptname: Ajouter/Supprimer une ligne dans crontab uecho "$scriptname: Ajouter/Supprimer une ligne dans crontab
@ -84,10 +89,6 @@ OPTIONS
Afficher simplement les modifications qui doivent être effectuées." Afficher simplement les modifications qui doivent être effectuées."
} }
#source "$(dirname "$0")/ulib/ulib" &&
#urequire DEFAULTS crontab ||
#exit 1
DEFAULT_ADELAY=1 DEFAULT_ADELAY=1
DEFAULT_GDELAY=15 DEFAULT_GDELAY=15
@ -116,6 +117,79 @@ export TMPDIR="${TMPDIR:-${TMP:-${TEMP:-/tmp}}}"
[ -f /etc/nutoolsrc ] && . /etc/nutoolsrc [ -f /etc/nutoolsrc ] && . /etc/nutoolsrc
[ -f ~/.nutoolsrc ] && . ~/.nutoolsrc [ -f ~/.nutoolsrc ] && . ~/.nutoolsrc
function recho() {
if [[ "${1:0:2}" == -[eEn] ]]; then
echo -n -
local first="${1:1}"; shift
echo "$first$@"
else
echo "$@"
fi
}
function recho_() {
if [[ "${1:0:2}" == -[eEn] ]]; then
echo -n -
local first="${1:1}"; shift
echo -n "$first$@"
else
echo -n "$@"
fi
}
function qval() {
local s="$*"
s="${s//\\/\\\\}"
s="${s//\"/\\\"}"
s="${s//\$/\\\$}"
s="${s//\`/\\\`}"
recho_ "$s"
}
function should_quote() {
[ -z "$1" ] && return 0
local s="${*//[a-zA-Z0-9]/}"
s="${s//,/}"
s="${s//./}"
s="${s//+/}"
s="${s//\//}"
s="${s//-/}"
s="${s//_/}"
s="${s//=/}"
[ -n "$s" ]
}
function qvals() {
local arg first=1
for arg in "$@"; do
[ -z "$first" ] && echo -n " "
if should_quote "$arg"; then
echo -n \"
qval "$arg"
echo -n \"
else
recho_ "$arg"
fi
first=
done
}
function qlines() {
sed "s/'/'\\\\''/g; s/.*/'&'/g"
}
function setv() {
local __s_var="$1"; shift
eval "$__s_var=\"$(qval "$*")\""
}
function setx() {
local __s_var="$1"; shift
eval "$__s_var=\"\$(\"\$@\")\""
}
function seta() {
local __s_array="$1"; shift
eval "$__s_array=($("$@" | qlines))"
}
function e2of() {
"$@" 2>&1
}
function nef() {
"$@" | sed '/^$/d'
}
function isnum() { function isnum() {
[ ${#1} -gt 0 ] || return 1 [ ${#1} -gt 0 ] || return 1
@ -140,14 +214,10 @@ function isrnum() {
[ -z "$v" ] [ -z "$v" ]
} }
function is_yes() { function is_yes() {
[ "$1" == "o" -o "$1" == "O" -o "$1" == "oui" -o "$1" == "OUI" ] && return 0 case "${1,,}" in
[ "$1" == "y" -o "$1" == "Y" -o "$1" == "yes" -o "$1" == "YES" ] && return 0 o|oui|y|yes|v|vrai|t|true|on) return 0;;
[ "$1" == "v" -o "$1" == "V" -o "$1" == "vrai" -o "$1" == "VRAI" ] && return 0 esac
[ "$1" == "t" -o "$1" == "T" -o "$1" == "true" -o "$1" == "TRUE" ] && return 0 isnum "$1" && [ "$1" -ne 0 ] && return 0
[ "$1" == "on" -o "$1" == "ON" ] && return 0
if isnum "$1"; then
[ "$1" -ne 0 ] && return 0
fi
return 1 return 1
} }
function yesval() { function yesval() {
@ -166,14 +236,10 @@ function normyesvals() {
done done
} }
function is_no() { function is_no() {
[ "$1" == "n" -o "$1" == "N" -o "$1" == "non" -o "$1" == "NON" ] && return 0 case "${1,,}" in
[ "$1" == "no" -o "$1" == "NO" ] && return 0 n|non|no|f|faux|false|off) return 0;;
[ "$1" == "f" -o "$1" == "F" -o "$1" == "faux" -o "$1" == "FAUX" ] && return 0 esac
[ "$1" == "false" -o "$1" == "FALSE" ] && return 0 isnum "$1" && [ "$1" -eq 0 ] && return 0
[ "$1" == "off" -o "$1" == "OFF" ] && return 0
if isnum "$1"; then
[ "$1" -eq 0 ] && return 0
fi
return 1 return 1
} }
function rawecho() { function rawecho() {
@ -202,18 +268,6 @@ function quote_arg() {
s="${s//\`/\\\`}" s="${s//\`/\\\`}"
rawecho "$s" rawecho "$s"
} }
function should_quote() {
[ -z "$1" ] && return 0
local s="${1//[a-zA-Z0-9]/}"
s="${s//,/}"
s="${s//./}"
s="${s//+/}"
s="${s//\//}"
s="${s//-/}"
s="${s//_/}"
s="${s//=/}"
[ -n "$s" ]
}
function quoted_arg() { function quoted_arg() {
should_quote "$1" && echo "\"$(quote_arg "$1")\"" || quote_arg "$1" should_quote "$1" && echo "\"$(quote_arg "$1")\"" || quote_arg "$1"
} }
@ -490,6 +544,18 @@ function array_fillrange() {
done done
array_copy "$1" __af_vs array_copy "$1" __af_vs
} }
function array_eq() {
local -a __ae_a1 __ae_a2
array_copy __ae_a1 "$1"
array_copy __ae_a2 "$2"
[ ${#__ae_a1[*]} -eq ${#__ae_a2[*]} ] || return 1
local __ae_v __ae_i=0
for __ae_v in "${__ae_a1[@]}"; do
[ "$__ae_v" == "${__ae_a2[$__ae_i]}" ] || return 1
__ae_i=$(($__ae_i + 1))
done
return 0
}
function array_contains() { function array_contains() {
local __ac_v local __ac_v
eval 'for __ac_v in "${'"$1"'[@]}"; do eval 'for __ac_v in "${'"$1"'[@]}"; do
@ -599,14 +665,14 @@ function array_extend_lasts() {
eval "$1=(\"\${$1[@]}\" \"\${$2[@]:1}\")" eval "$1=(\"\${$1[@]}\" \"\${$2[@]:1}\")"
} }
function array_xsplit() { function array_xsplit() {
eval "$1=($(<<<"$2" stripnl | awkrun RS="${3:-:}" ' eval "$1=($(recho_ "$2" | awkrun RS="${3:-:}" '
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
print "'\''" $0 "'\''" print "'\''" $0 "'\''"
}'))" #" }'))" #"
} }
function array_split() { function array_split() {
eval "$1=($(<<<"$2" stripnl | awkrun RS="${3:-:}" ' eval "$1=($(recho_ "$2" | awkrun RS="${3:-:}" '
/^$/ { next } /^$/ { next }
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
@ -617,14 +683,14 @@ function array_from_path() {
array_split "$1" "$2" ":" array_split "$1" "$2" ":"
} }
function array_from_xlines() { function array_from_xlines() {
eval "$1=($(<<<"$2" _nl2lf | awk ' eval "$1=($(recho_ "$2" | _nl2lf | awk '
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
print "'\''" $0 "'\''" print "'\''" $0 "'\''"
}'))" #" }'))" #"
} }
function array_from_lines() { function array_from_lines() {
eval "$1=($(<<<"$2" _nl2lf | awk ' eval "$1=($(recho_ "$2" | _nl2lf | awk '
/^$/ { next } /^$/ { next }
{ {
gsub(/'\''/, "'\'\\\\\'\''") gsub(/'\''/, "'\'\\\\\'\''")
@ -678,7 +744,7 @@ function array_fix_paths() {
array_copy __afp_vs "$__afp_an" array_copy __afp_vs "$__afp_an"
array_new "$__afp_an" array_new "$__afp_an"
for __afp_v in "${__afp_vs[@]}"; do for __afp_v in "${__afp_vs[@]}"; do
array_split __afp_v "$__afp_v" array_split __afp_v "$__afp_v" "$__afp_s"
array_extend "$__afp_an" __afp_v array_extend "$__afp_an" __afp_v
done done
} }
@ -711,12 +777,9 @@ function parse_date() {
}')" }')"
esac esac
case "$type" in case "$type" in
d|date) d|date) awk '{ print strftime("%d/%m/%Y", $0 + 0) }' <<<"$value";;
awk '{ print strftime("%d/%m/%Y", $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";;
l|ldap)
awk '{ print strftime("%Y%m%d%H%M%S+0400", $0 + 0) }' <<<"$value"
;;
*) *)
rawecho "$value" rawecho "$value"
;; ;;
@ -986,6 +1049,13 @@ function testsame() {
function testdiff() { function testdiff() {
! quietdiff "$@" ! quietdiff "$@"
} }
function testupdated() {
if [ -f "$2" ]; then
testdiff "$1" "$2"
else
return 0
fi
}
function testnewer() { function testnewer() {
test ! -e "$2" -o "$1" -nt "$2" test ! -e "$2" -o "$1" -nt "$2"
} }
@ -1076,15 +1146,16 @@ function rm_maybe() {
done done
[ -n "$rm" ] && /bin/rm "$@" [ -n "$rm" ] && /bin/rm "$@"
} }
__CPDIR_RSYNC_ARGS=() __CPDIR_RSYNC_SLOW=1 # synchro potentiellement plus lente, mais plus fidèle (option -c)
__CPDIR_RSYNC_ARGS=(-q)
function cpdir() { function cpdir() {
if progexists rsync; then if progexists rsync; then
[ -d "$2" ] || mkdir -p "$2" || return 1 [ -d "$2" ] || mkdir -p "$2" || return 1
if [ -d "$1" ]; then if [ -d "$1" ]; then
rsync -qa "${__CPDIR_RSYNC_ARGS[@]}" "$1/" "$2/" rsync -a ${__CPDIR_RSYNC_SLOW:+-c} "${__CPDIR_RSYNC_ARGS[@]}" "$1/" "$2/"
else else
rsync -qa "${__CPDIR_RSYNC_ARGS[@]}" "$1" "$2/" rsync -a ${__CPDIR_RSYNC_SLOW:+-c} "${__CPDIR_RSYNC_ARGS[@]}" "$1" "$2/"
fi fi
else else
__cpdir "$@" __cpdir "$@"
@ -1120,17 +1191,17 @@ function __cpdir() {
fi fi
fi fi
} }
CPNOVCS_OPTS=() # deprecated __CPNOVCS_RSYNC_SLOW=1 # synchro potentiellement plus lente, mais plus fidèle (option -c)
__CPNOVCS_RSYNC_ARGS=() __CPNOVCS_RSYNC_ARGS=(-q)
function cpnovcs() { function cpnovcs() {
local src="$1" destdir="$2" local src="$1" destdir="$2"
[ -d "$destdir" ] || mkdir -p "$destdir" || return 1 [ -d "$destdir" ] || mkdir -p "$destdir" || return 1
if progexists rsync; then if progexists rsync; then
local gitexclude=/.git/ local gitexclude=/.git/
if [ "${src%/}" != "$src" ]; then if [ "${src%/}" == "$src" ]; then
gitexclude="/$(basename -- "$src")$gitexclude" gitexclude="/$(basename -- "$src")$gitexclude"
fi fi
rsync -qa --exclude CVS --exclude .svn --exclude "$gitexclude" "${CPNOVCS_OPTS[@]}" "${__CPNOVCS_RSYNC_ARGS[@]}" "$src" "$destdir/" rsync -a ${__CPNOVCS_RSYNC_SLOW:+-c} --exclude CVS/ --exclude .svn/ --exclude "$gitexclude" "${__CPNOVCS_RSYNC_ARGS[@]}" "$src" "$destdir/"
elif [ "${src%/}" != "$src" ]; then elif [ "${src%/}" != "$src" ]; then
__cpdir "$src" "$destdir" __cpdir "$src" "$destdir"
else else
@ -1358,11 +1429,25 @@ function get_archive_appname() {
print substr($0, 1, RSTART - 1) print substr($0, 1, RSTART - 1)
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/)) { } else 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)
} else if (match($0, /([0-9]+[a-z][a-z][a-z0-9]?)$/, vs)) {
print substr($0, 1, RSTART - 1)
} else { } else {
print $0 print $0
} }
}' }'
} }
function get_archive_versionsuffix() {
local basename="$(get_archive_basename "$1")"
echo "$basename" | awk '{
if (match($0, /([-_.][0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"]
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"]
} else if (match($0, /([0-9]+[a-z][a-z][a-z0-9]?)$/, vs)) {
print vs["1"]
}
}'
}
function get_archive_version() { function get_archive_version() {
local basename="$(get_archive_basename "$1")" local basename="$(get_archive_basename "$1")"
echo "$basename" | awk '{ echo "$basename" | awk '{
@ -1370,7 +1455,7 @@ function get_archive_version() {
print vs["1"] print vs["1"]
} else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) { } else if (match($0, /([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
print vs["1"] print vs["1"]
} else if (match($0, /([0-9]+[a-z][a-z][a-z]?)$/, vs)) { } else if (match($0, /([0-9]+[a-z][a-z][a-z0-9]?)$/, vs)) {
print vs["1"] print vs["1"]
} }
}' }'
@ -1591,6 +1676,13 @@ function quote_sql(s) {'"
gsub(/'/, \"''\", s) gsub(/'/, \"''\", s)
return \"'\" s \"'\" return \"'\" s \"'\"
"'} "'}
function unquote_mysqlcsv(s) {
gsub(/\\n/, "\n", s)
gsub(/\\t/, "\t", s)
gsub(/\\0/, "\0", s)
gsub(/\\\\/, "\\", s)
return s
}
function array_new(dest) { function array_new(dest) {
dest[0] = 0 # forcer awk à considérer dest comme un tableau dest[0] = 0 # forcer awk à considérer dest comme un tableau
delete dest delete dest
@ -1894,7 +1986,7 @@ function array_formatcsv2(fields, colsep, mvsep, qchar, echar, count, indic
if (echar != "") gsub(qchar, quote_subrepl(echar) "&", value); if (echar != "") gsub(qchar, quote_subrepl(echar) "&", value);
else gsub(qchar, "&&", value); else gsub(qchar, "&&", value);
} }
if (qchar != "" && (index(value, mvsep) != 0 || index(value, colsep) != 0 || __csv_should_quote(value))) { if (qchar != "" && (index(value, mvsep) != 0 || index(value, colsep) != 0 || index(value, qchar) != 0 || __csv_should_quote(value))) {
line = line qchar value qchar line = line qchar value qchar
} else { } else {
line = line value line = line value
@ -2068,12 +2160,12 @@ function awkdef() {
} }
function lawkrun() { function lawkrun() {
local -a __ar_defs __ar_args local -a __ar_defs __ar_args
while [ -n "$1" -a "$1" != "--" ]; do while [ $# -gt 0 -a "$1" != "--" ]; do
__ar_defs=("${__ar_defs[@]}" "$1") __ar_defs=("${__ar_defs[@]}" "$1")
shift shift
done done
shift shift
while [ -n "$1" ]; do while [ $# -gt 0 ]; do
__ar_args=("${__ar_args[@]}" "$1") __ar_args=("${__ar_args[@]}" "$1")
shift shift
done done
@ -2428,6 +2520,13 @@ function pidfile_check() {
fi fi
return 1 return 1
} }
function page_maybe() {
if isatty; then
less -XF
else
cat
fi
}
function utools_local() { function utools_local() {
@ -2725,6 +2824,29 @@ function eecho_() {
function edebug() { function edebug() {
show_debug || return; eflush; __edebug "$*" 1>&2 show_debug || return; eflush; __edebug "$*" 1>&2
} }
function trace() {
local r cmd="$(quoted_args "$@")"
show_info && { eflush; __eecho "\$ $cmd" 1>&2; }
"$@"; r=$?
if [ $r -ne 0 ]; then
if show_info; then
eflush; __eecho "^ [EC #$r]" 1>&2
elif show_error; then
eflush; __eecho "^ $cmd [EC #$r]" 1>&2;
fi
fi
return $r
}
function trace_error() {
local r
"$@"; r=$?
if [ $r -ne 0 ]; then
local cmd="$(quoted_args "$@")"
show_error && { eflush; __eecho "^ $cmd [EC #$r]" 1>&2; }
fi
return $r
}
function etitle() { function etitle() {
local __t_deferred= local __t_deferred=
__t_etitle "$@" __t_etitle "$@"
@ -4185,8 +4307,8 @@ BEGIN {
match_indented = 0 match_indented = 0
} }
/^(export[ \t]+)?[a-zA-Z_][a-zA-Z0-9_]*[-+%#]=/ { /^(export[ \t]+)?[a-zA-Z_][a-zA-Z0-9_]*[-+%#?]=/ {
match($0, /^(export[ \t]+)?([a-zA-Z_][a-zA-Z0-9_]*)([-+%#])=(.*)$/, parts) match($0, /^(export[ \t]+)?([a-zA-Z_][a-zA-Z0-9_]*)([-+%#?])=(.*)$/, parts)
name = parts[2] name = parts[2]
type = parts[3] type = parts[3]
value = parts[4] value = parts[4]
@ -4196,6 +4318,8 @@ BEGIN {
print "uinspath " value " " name print "uinspath " value " " name
} else if (type == "-") { } else if (type == "-") {
print "udelpath " value " " name print "udelpath " value " " name
} else if (type == "?") {
print "[ -n \"$" name "\" ] || " name "=" value
} }
print "export " name print "export " name
next next

6
udir
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS udir
function display_help() { function display_help() {
uecho "$scriptname: gérer les variables de répertoire uecho "$scriptname: gérer les variables de répertoire
@ -116,10 +118,6 @@ root_scripts
destination." destination."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS udir ||
exit 1
action=auto action=auto
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \

5
udist
View File

@ -145,9 +145,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source $(dirname "$0")/ulib/ulib && source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS conf install || urequire DEFAULTS conf install
exit 1
INSTALL_VERBOSE= INSTALL_VERBOSE=
INSTALL_USES_PPATH=1 INSTALL_USES_PPATH=1

6
uenv
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS uenv uenv_update
function display_help() { function display_help() {
uecho "$scriptname: Mettre à jour la configuration de l'environnement uecho "$scriptname: Mettre à jour la configuration de l'environnement
@ -27,10 +29,6 @@ OPTIONS
nutools." nutools."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS uenv uenv_update ||
exit 1
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
-u update \ -u update \

View File

@ -1,6 +1,7 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1; urequire DEFAULTS source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Enlever ou transformer certaines classes de caractères d'un flux encodé en UTF-8 uecho "$scriptname: Enlever ou transformer certaines classes de caractères d'un flux encodé en UTF-8

View File

@ -1,6 +1,7 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1; urequire DEFAULTS password source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS password
function display_help() { function display_help() {
uecho "$scriptname: générer un mot de passe au hasard uecho "$scriptname: générer un mot de passe au hasard

6
uinc
View File

@ -1,9 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
source "$(dirname "$0")/ulib/ulib" && urequire uinc
urequire uinc ||
exit 1
export UINCPATH="$ULIBDIR${UINCPATH:+:$UINCPATH}" export UINCPATH="$ULIBDIR${UINCPATH:+:$UINCPATH}"
uinc "$@" uinc "$@"

View File

@ -1,12 +1,9 @@
#!/bin/sh #!/bin/sh
# -*- 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
# Version de uinc qui fonctionne avec /bin/sh. Le contrôle est transmis à # Version de uinc qui fonctionne avec /bin/sh. Le contrôle est transmis à
# bash, qui est recherché dans une liste de répertoires standards # bash, qui est recherché dans une liste de répertoires standards
. `dirname "$0"`/lib/ulib/ulibsh || exit 1
. `dirname "$0"`/ulib/ulibsh && urequire DEFAULTS uinc
urequire DEFAULTS uinc ||
exit 1
export UINCPATH="$ULIBDIR${UINCPATH:+:$UINCPATH}" export UINCPATH="$ULIBDIR${UINCPATH:+:$UINCPATH}"
uinc "$@" uinc "$@"

6
uinst
View File

@ -1,8 +1,6 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
source "$(dirname "$0")/ulib/ulib" && urequire DEFAULTS uinst
urequire DEFAULTS uinst ||
exit 1
uinst_nolocal "$@" uinst_nolocal "$@"

View File

@ -1,11 +1,8 @@
#!/bin/sh #!/bin/sh
# -*- 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
# Version de uinst qui fonctionne avec /bin/sh. Le contrôle est transmis à # Version de uinst qui fonctionne avec /bin/sh. Le contrôle est transmis à
# bash, qui est recherché dans une liste de répertoires standards # bash, qui est recherché dans une liste de répertoires standards
. `dirname "$0"`/lib/ulib/ulibsh || exit 1
. `dirname "$0"`/ulib/ulibsh && urequire DEFAULTS uinst
urequire DEFAULTS uinst ||
exit 1
uinst_nolocal "$@" uinst_nolocal "$@"

6
ujava
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS java
function display_help() { function display_help() {
uecho "$scriptname: Lancer un script après avoir sélectionné une version de java uecho "$scriptname: Lancer un script après avoir sélectionné une version de java
@ -24,10 +26,6 @@ Si args n'est pas spécifié, un shell est lancé dans lequel les variables
JAVA_HOME, JAVA, JAVAC et PATH sont mis à jour." JAVA_HOME, JAVA, JAVAC et PATH sont mis à jour."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS java ||
exit 1
bits= bits=
exact= exact=
parse_opts + "${PRETTYOPTS[@]}" \ parse_opts + "${PRETTYOPTS[@]}" \

6
uldap
View File

@ -1,9 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 255
source "$(dirname "$0")/ulib/ulib" && urequire DEFAULTS ldif prefixes ldap
urequire DEFAULTS ldif prefixes ldap ||
exit 255
################################################################################ ################################################################################
# Fonctions utilitaire # Fonctions utilitaire

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Lancer un shell après avoir chargé des modules de ulib uecho "$scriptname: Lancer un shell après avoir chargé des modules de ulib
@ -18,10 +20,6 @@ est modifié pour que $scriptdir soit ajouté en premier.
Les arguments sont passés inchangés au shell." Les arguments sont passés inchangés au shell."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
parse_opts + "${PRETTYOPTS[@]}" \ parse_opts + "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
-r: modules \ -r: modules \

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Copier les librairies ulib et/ou pyulib uecho "$scriptname: Copier les librairies ulib et/ou pyulib
@ -14,10 +16,6 @@ OPTIONS
Copier pyulib" Copier pyulib"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \
-u,--ulib ulib \ -u,--ulib ulib \

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Gestion de la version de ulib uecho "$scriptname: Gestion de la version de ulib
@ -18,10 +20,6 @@ OPTIONS
juste tester la version et ne pas afficher le message d'information." juste tester la version et ne pas afficher le message d'information."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
action=show action=show
system= system=
min_version= min_version=

6
umatch
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Afficher le résultat d'une recherche par regexp et compter uecho "$scriptname: Afficher le résultat d'une recherche par regexp et compter
@ -49,10 +51,6 @@ OPTIONS
une ligne '--'" une ligne '--'"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
function match() { function match() {
local regexp="$1" sep="$2" local regexp="$1" sep="$2"
awkrun ${sep:+FS="$sep"} '{ awkrun ${sep:+FS="$sep"} '{

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: faire un miroir d'un site web uecho "$scriptname: faire un miroir d'un site web
@ -12,10 +14,6 @@ OPTIONS
Convertir les liens pour consultation locale" Convertir les liens pour consultation locale"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
local= local=
parse_opts + "${PRETTYOPTS[@]}" \ parse_opts + "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \

View File

@ -69,4 +69,5 @@ if [ -n "$clonerepo" ]; then
cd .. cd ..
rm -rf "$NAME" rm -rf "$NAME"
fi fi
# IMPORTANT: la ligne suivante ne doit pas se terminer par un retour à la ligne:
rm "$0"; exit 0 rm "$0"; exit 0

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS PREFIXES-DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Afficher les préfixes valides pour uinst uecho "$scriptname: Afficher les préfixes valides pour uinst
@ -16,10 +18,6 @@ OPTIONS
Afficher la valeur du préfixe spécifié" Afficher la valeur du préfixe spécifié"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS PREFIXES-DEFAULTS ||
exit 1
action=expand action=expand
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \ --help '$exit_with display_help' \

View File

@ -138,9 +138,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source "$(dirname "$0")/ulib/ulib" && source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS modeline vcs || urequire DEFAULTS modeline vcs
exit 1
# Traduire le nom du script # Traduire le nom du script
for script_alias in "${SCRIPT_ALIASES[@]}"; do for script_alias in "${SCRIPT_ALIASES[@]}"; do

View File

@ -1,6 +1,7 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1; urequire DEFAULTS crontab source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS crontab
function display_help() { function display_help() {
uecho "$scriptname: lancer une suite de commande en respectant une planification de type cron uecho "$scriptname: lancer une suite de commande en respectant une planification de type cron

2
ussh
View File

@ -1,6 +1,6 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1 source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS urequire DEFAULTS
function display_help() { function display_help() {

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Afficher les informations sur le système uecho "$scriptname: Afficher les informations sur le système
@ -13,10 +15,6 @@ requête. Voir la doc de check_sysinfos() pour le format de la requête.
Sinon, afficher les informations sur le système courant." Sinon, afficher les informations sur le système courant."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
[ $# -eq 1 -a "$1" == "--help" ] && exit_with display_help [ $# -eq 1 -a "$1" == "--help" ] && exit_with display_help
if [ -n "$*" ]; then if [ -n "$*" ]; then

6
utempl
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Créer un nouveau fichier à partir d'un modèle uecho "$scriptname: Créer un nouveau fichier à partir d'un modèle
@ -22,10 +24,6 @@ utilisé pour créer le nouveau fichier. Utiliser l'option --help pour
avoir une description des options disponibles." avoir une description des options disponibles."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
template= template=
edit=auto edit=auto
overwrite= overwrite=

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire base pretty
function display_help() { function display_help() {
uecho "$scriptname: lancer une commande en différé uecho "$scriptname: lancer une commande en différé
@ -47,10 +49,6 @@ OPTIONS
train de tourner, cette option n'a aucun effet." train de tourner, cette option n'a aucun effet."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire base pretty ||
exit 1
RUNDELAY=5 RUNDELAY=5
function acquire_lock() { function acquire_lock() {

View File

@ -1,6 +1,7 @@
#!/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
source "$(dirname "$0")/ulib/ulib" || exit 1; urequire DEFAULTS semver source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS semver
function display_help() { function display_help() {
uecho "$scriptname: gérer des numéros de version selon les règles du versionnage sémantique v2.0.0 (http://semver.org/) uecho "$scriptname: gérer des numéros de version selon les règles du versionnage sémantique v2.0.0 (http://semver.org/)

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: afficher des informations sur une machine virtuelle OpenVZ uecho "$scriptname: afficher des informations sur une machine virtuelle OpenVZ
@ -19,10 +21,6 @@ OPTIONS
beancounters" beancounters"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
default=1 default=1
bc= bc=
show_failed= show_failed=

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: créer une archive de la distribution WebObjects en cours uecho "$scriptname: créer une archive de la distribution WebObjects en cours
@ -15,10 +17,6 @@ OPTIONS
\$NAME.files" \$NAME.files"
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
name= name=
files= files=
parse_opts "${PRETTYOPTS[@]}" \ parse_opts "${PRETTYOPTS[@]}" \

View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS
function display_help() { function display_help() {
uecho "$scriptname: Changer la version de WebObjects pour le système en cours uecho "$scriptname: Changer la version de WebObjects pour le système en cours
@ -27,10 +29,6 @@ Ensuite, les répertoires Applications et Configuration sont restaurés. Il faud
restaurer Extensions manuellement." restaurer Extensions manuellement."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1
nocheck= nocheck=
from= from=
to= to=

5
woctl
View File

@ -89,9 +89,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
exit 0 exit 0
fi fi
source "$(dirname "$0")/ulib/ulib" && source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS || urequire DEFAULTS
exit 1
# Traduire le nom du script # Traduire le nom du script
for script_alias in "${SCRIPT_ALIASES[@]}"; do for script_alias in "${SCRIPT_ALIASES[@]}"; do

6
woinst
View File

@ -1,8 +1,6 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
source "$(dirname "$0")/ulib/ulib" && urequire DEFAULTS woinst
urequire DEFAULTS woinst ||
exit 1
woinst "$@" woinst "$@"

6
wosign
View File

@ -1,5 +1,7 @@
#!/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
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
urequire DEFAULTS prefixes apache webobjects java wosign
function display_help() { function display_help() {
uecho "$scriptname: signer les jars d'un bundle uecho "$scriptname: signer les jars d'un bundle
@ -18,10 +20,6 @@ OPTIONS
accessible en écriture, relancer le script en root." accessible en écriture, relancer le script en root."
} }
source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS prefixes apache webobjects java wosign ||
exit 1
sign= sign=
unsign= unsign=
resign= resign=