Compare commits
73 Commits
Author | SHA1 | Date |
---|---|---|
Jephté Clain | 0527aee96e | |
Jephté Clain | f156fe0b1e | |
Jephté Clain | 625d5f1d25 | |
Jephté Clain | e30820261a | |
Jephté Clain | 5c03184c94 | |
Jephté Clain | 0ed5ddf6b9 | |
Jephté Clain | f39787c6ec | |
Jephté Clain | 11145f686a | |
Jephté Clain | 21042e4677 | |
Jephté Clain | e4176dfd94 | |
Jephté Clain | 1787aa2310 | |
Jephté Clain | d1f77aa354 | |
Jephté Clain | c2cfd7739a | |
Jephté Clain | e7745c2dd4 | |
Jephté Clain | ce8f541520 | |
Jephté Clain | 30594aa84b | |
Jephté Clain | 2df175ee57 | |
Jephté Clain | fbb05f8dee | |
Jephté Clain | 9d8e3c53d1 | |
Jephté Clain | 2886c40aa2 | |
Jephté Clain | e50a686536 | |
Jephté Clain | 8570d12ce6 | |
Jephté Clain | 5d6c6b4053 | |
Jephté Clain | 90bda71351 | |
Jephté Clain | 7d7b88a427 | |
Jephté Clain | 5cc1826744 | |
Jephté Clain | 0bf0f48ad0 | |
Jephté Clain | b818e11c73 | |
Jephté Clain | ad14de35ea | |
Jephté Clain | 54a5b5485d | |
Jephté Clain | 5a06851b0f | |
Jephté Clain | a855b04c21 | |
Jephté Clain | e5315532a1 | |
Jephté Clain | db1467b8fd | |
Jephté Clain | 3123d8e65e | |
Jephté Clain | d9b1485354 | |
Jephté Clain | 744a3fa0ac | |
Jephté Clain | 2803868e16 | |
Jephté Clain | 4f7bc3f6bf | |
Jephté Clain | 8cdc3cb2bb | |
Jephté Clain | 1b7b2744ba | |
Jephté Clain | b9951d269d | |
Jephté Clain | 4ffd43f2e0 | |
Jephté Clain | ddfbc00f78 | |
Jephté Clain | e33f2a5afe | |
Jephté Clain | f245e17138 | |
Jephté Clain | efe31b8c9d | |
Jephté Clain | 5cb4112cd0 | |
Jephté Clain | f424f41561 | |
Jephté Clain | e5a147351d | |
Jephté Clain | 771bd1c563 | |
Jephté Clain | 776cd96fd7 | |
Jephté Clain | 471315dcbb | |
Jephté Clain | bfdf9b5bef | |
Jephté Clain | 108215fce4 | |
Jephté Clain | 6ddb870a56 | |
Jephté Clain | c0b130fd29 | |
Jephté Clain | 6e36d26471 | |
Jephté Clain | e5ab8dd240 | |
Jephté Clain | c0d4e950e9 | |
Jephté Clain | e76a6a6a84 | |
Jephté Clain | b03df72236 | |
Jephté Clain | 44f719b2e6 | |
Jephté Clain | 337f24c447 | |
Jephté Clain | 246b9473aa | |
Jephté Clain | 9d5713c1f9 | |
Jephté Clain | 05fd86acc7 | |
Jephté Clain | abd178bf0d | |
Jephté Clain | 2283a66201 | |
Jephté Clain | 7f143c0fd4 | |
Jephté Clain | 046ba0d323 | |
Jephté Clain | c8b8f107a1 | |
Jephté Clain | 1210ca7382 |
65
CHANGES.md
65
CHANGES.md
|
@ -1,3 +1,68 @@
|
||||||
|
## Version 11.3.0 du 24/09/2024-16:02
|
||||||
|
|
||||||
|
* `625d5f1` bug mineur
|
||||||
|
* `e308202` dkbuild: améliorer from_glob()
|
||||||
|
* `5c03184` lgrep, lless: modifier la doc pour ne parler que d'un fichier
|
||||||
|
|
||||||
|
## Version 11.2.0 du 21/06/2024-20:34
|
||||||
|
|
||||||
|
* `21042e4` bug
|
||||||
|
* `e4176df` reginc: possibilité de renommer des fichiers
|
||||||
|
* `1787aa2` bug
|
||||||
|
* `d1f77aa` dkbuild: support dist none et tag LATEST
|
||||||
|
* `c2cfd77` bug
|
||||||
|
* `e7745c2` dk: support --plain-output
|
||||||
|
* `ce8f541` dkbuild: -g pour --profile
|
||||||
|
* `30594aa` maj distributions
|
||||||
|
* `2df175e` dkbuild: cosmetic
|
||||||
|
* `fbb05f8` support des versions AMUE
|
||||||
|
|
||||||
|
## Version 11.1.0 du 01/02/2024-20:59
|
||||||
|
|
||||||
|
* `8570d12` pff: les répertoires liés peuvent contenir des fichiers
|
||||||
|
* `5d6c6b4` synchroniser pff et nulib/pff
|
||||||
|
* `90bda71` pff: support des répertoires liés
|
||||||
|
* `7d7b88a` autoriser les feature branches qui commencent par wip/
|
||||||
|
* `5cc1826` dk et dkbuild: support .composer.yaml et setup_image
|
||||||
|
* `0bf0f48` dk: support ~/.dkbuild.env
|
||||||
|
* `b818e11` dkbuild: ajout de --plain
|
||||||
|
* `ad14de3` dkbuild: configuration profil prod par défaut
|
||||||
|
* `54a5b54` Sscreen: support des cas où screen n'est pas dans le PATH
|
||||||
|
* `5a06851` dkbuild: support profil par défaut
|
||||||
|
* `a855b04` dkbuild: les versions de profil sont ordonnées comme les versions de distribution
|
||||||
|
* `e531553` dkbuild: sans --all-profiles, ne build que dans le profil par défaut
|
||||||
|
* `db1467b` bug
|
||||||
|
* `3123d8e` dkbuild: mappings par défaut
|
||||||
|
* `d9b1485` charnière entre java 8 et java 11
|
||||||
|
* `744a3fa` dkbuild: indiquer si la version de Java demandée n'est pas trouvée
|
||||||
|
* `2803868` dkbuild: marquer plus d'action comme étant du build
|
||||||
|
* `4f7bc3f` dkbuild: bug avec -u seul
|
||||||
|
* `8cdc3cb` modifs.mineures sans commentaires
|
||||||
|
|
||||||
|
## Version 11.0.0 du 05/09/2023-14:29
|
||||||
|
|
||||||
|
* `ddfbc00` maj des images par défaut dk et dkbuild
|
||||||
|
* `e33f2a5` ajout registry privé
|
||||||
|
* `f245e17` image par défaut en prod
|
||||||
|
* `efe31b8` support java17
|
||||||
|
* `5cb4112` dkbuild: bug profil unitaire
|
||||||
|
* `f424f41` dkbuild: -u n'implique plus -b
|
||||||
|
* `e5a1473` dkbuild: implémenter -u
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
18
Sscreen
18
Sscreen
|
@ -18,15 +18,25 @@ function __ask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __auto_screen() {
|
function __auto_screen() {
|
||||||
|
# Si on est déjà dans screen, ne rien faire
|
||||||
|
[ -z "$STY" ] || return
|
||||||
|
|
||||||
# Si screen pas installé, ne rien faire
|
# Si screen pas installé, ne rien faire
|
||||||
if [ -z "$(which screen 2>/dev/null)" ]; then
|
local dir screen="$(which screen 2>/dev/null)"
|
||||||
|
if [ -z "$screen" ]; then
|
||||||
|
for dir in /usr/local/bin /opt/bin /usr/bin /bin; do
|
||||||
|
if [ -x "$dir/screen" ]; then
|
||||||
|
screen="$dir/screen"
|
||||||
|
PATH="$PATH:$dir"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ -z "$screen" ]; then
|
||||||
echo "${COULEUR_JAUNE}WARNING${COULEUR_NORMALE} screen introuvable. une session bash classique sera lancée"
|
echo "${COULEUR_JAUNE}WARNING${COULEUR_NORMALE} screen introuvable. une session bash classique sera lancée"
|
||||||
exec /bin/bash -l
|
exec /bin/bash -l
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Si on est déjà dans screen, ne rien faire
|
|
||||||
[ -z "$STY" ] || return
|
|
||||||
|
|
||||||
# corriger TERM pour les vieilles versions de Linux
|
# corriger TERM pour les vieilles versions de Linux
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
xterm*) TERM=xterm;;
|
xterm*) TERM=xterm;;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
9.16.0
|
11.3.0
|
||||||
|
|
117
dk
117
dk
|
@ -230,6 +230,7 @@ COMMANDES
|
||||||
spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
||||||
Ce paramétrage est utilisé pour par exemple installer certains
|
Ce paramétrage est utilisé pour par exemple installer certains
|
||||||
packages nécessaire au projet.
|
packages nécessaire au projet.
|
||||||
|
* COMPOSER_SETUP_IMAGE -- nom final de l'image pour COMPOSER_SETUP
|
||||||
La commande 'rshell' est une extension qui lance un shell bash au lieu
|
La commande 'rshell' est une extension qui lance un shell bash au lieu
|
||||||
de lancer la commande composer, ce qui permet de faire des opérations
|
de lancer la commande composer, ce qui permet de faire des opérations
|
||||||
plus complexes si le besoin s'en fait sentir. NB: le shell est lancé
|
plus complexes si le besoin s'en fait sentir. NB: le shell est lancé
|
||||||
|
@ -267,6 +268,7 @@ COMMANDES
|
||||||
spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
||||||
Ce paramétrage est utilisé pour par exemple installer certains
|
Ce paramétrage est utilisé pour par exemple installer certains
|
||||||
packages nécessaire au projet.
|
packages nécessaire au projet.
|
||||||
|
* MAVEN_SETUP_IMAGE -- nom final de l'image pour MAVEN_SETUP
|
||||||
La commande 'rshell' est une extension qui lance un shell bash au lieu
|
La commande 'rshell' est une extension qui lance un shell bash au lieu
|
||||||
de lancer la commande mvn, ce qui permet de faire des opérations
|
de lancer la commande mvn, ce qui permet de faire des opérations
|
||||||
plus complexes si le besoin s'en fait sentir. NB: le shell est lancé
|
plus complexes si le besoin s'en fait sentir. NB: le shell est lancé
|
||||||
|
@ -334,6 +336,8 @@ OPTIONS build
|
||||||
deploy, by, bpy et update impliquent --stack
|
deploy, by, bpy et update impliquent --stack
|
||||||
-j, --no-cache
|
-j, --no-cache
|
||||||
Ne pas utiliser le cache lors du build
|
Ne pas utiliser le cache lors du build
|
||||||
|
--plain-output
|
||||||
|
Afficher la sortie complète des containers lors du build
|
||||||
-U, --pull
|
-U, --pull
|
||||||
Essayer de récupérer une version plus récente de l'image source
|
Essayer de récupérer une version plus récente de l'image source
|
||||||
-g, --ug, --no-update-apps
|
-g, --ug, --no-update-apps
|
||||||
|
@ -1083,10 +1087,10 @@ function build_update_apps() {
|
||||||
estep "Type de dépôt: $TYPE"
|
estep "Type de dépôt: $TYPE"
|
||||||
if [ "$TYPE" == composer ]; then
|
if [ "$TYPE" == composer ]; then
|
||||||
local cvname cvvalue
|
local cvname cvvalue
|
||||||
local composer_php composer_php_max composer_image composer_cmd composer_setup composer_action
|
local composer_php composer_php_max composer_image composer_cmd composer_setup composer_setup_image composer_action
|
||||||
local -a composer_vars composer_args
|
local -a composer_vars composer_args
|
||||||
|
|
||||||
for cvname in composer_php composer_php_max composer_image composer_cmd composer_setup; do
|
for cvname in composer_php composer_php_max composer_image composer_cmd composer_setup composer_setup_image; do
|
||||||
cvvalue="${var}_${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"
|
cvvalue="${var}_${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"
|
||||||
[ -n "$cvvalue" ] || { cvvalue="${var}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
[ -n "$cvvalue" ] || { cvvalue="${var}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
||||||
[ -n "$cvvalue" ] || { cvvalue="${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
[ -n "$cvvalue" ] || { cvvalue="${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
||||||
|
@ -1122,10 +1126,10 @@ function build_update_apps() {
|
||||||
fi
|
fi
|
||||||
elif [ "$TYPE" == maven ]; then
|
elif [ "$TYPE" == maven ]; then
|
||||||
local cvname cvvalue
|
local cvname cvvalue
|
||||||
local maven_java maven_image maven_cmd maven_setup maven_action
|
local maven_java maven_image maven_cmd maven_setup maven_setup_image maven_action
|
||||||
local -a maven_vars maven_args
|
local -a maven_vars maven_args
|
||||||
|
|
||||||
for cvname in maven_java maven_image maven_cmd maven_setup; do
|
for cvname in maven_java maven_image maven_cmd maven_setup maven_setup_image; do
|
||||||
cvvalue="${var}_${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"
|
cvvalue="${var}_${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"
|
||||||
[ -n "$cvvalue" ] || { cvvalue="${var}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
[ -n "$cvvalue" ] || { cvvalue="${var}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
||||||
[ -n "$cvvalue" ] || { cvvalue="${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
[ -n "$cvvalue" ] || { cvvalue="${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"; }
|
||||||
|
@ -1243,6 +1247,7 @@ function default_compose_build() {
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
build \
|
build \
|
||||||
${NO_CACHE:+--no-cache} \
|
${NO_CACHE:+--no-cache} \
|
||||||
|
${PROGRESS:+--progress "$PROGRESS"} \
|
||||||
${PULL:+--pull} \
|
${PULL:+--pull} \
|
||||||
"${replace_build_args[@]}" "${build_args[@]}" \
|
"${replace_build_args[@]}" "${build_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
|
@ -1254,6 +1259,7 @@ function default_docker_build() {
|
||||||
done
|
done
|
||||||
${FAKE:+qvals} "$DOCKER" build \
|
${FAKE:+qvals} "$DOCKER" build \
|
||||||
${NO_CACHE:+--no-cache} \
|
${NO_CACHE:+--no-cache} \
|
||||||
|
${PROGRESS:+--progress "$PROGRESS"} \
|
||||||
${PULL:+--pull} \
|
${PULL:+--pull} \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
"${replace_build_args[@]}" "${build_args[@]}" \
|
"${replace_build_args[@]}" "${build_args[@]}" \
|
||||||
|
@ -1303,6 +1309,7 @@ function auto_build() {
|
||||||
done
|
done
|
||||||
${FAKE:+qvals} "$DOCKER" build \
|
${FAKE:+qvals} "$DOCKER" build \
|
||||||
${NO_CACHE:+--no-cache} \
|
${NO_CACHE:+--no-cache} \
|
||||||
|
${PROGRESS:+--progress "$PROGRESS"} \
|
||||||
${PULL:+--pull} \
|
${PULL:+--pull} \
|
||||||
"${replace_build_args[@]}" "$@"
|
"${replace_build_args[@]}" "$@"
|
||||||
fi
|
fi
|
||||||
|
@ -1979,6 +1986,7 @@ function default_docker_composer() {
|
||||||
-e group="$group"
|
-e group="$group"
|
||||||
-e projdir="$projdir"
|
-e projdir="$projdir"
|
||||||
-e setup="$COMPOSER_SETUP"
|
-e setup="$COMPOSER_SETUP"
|
||||||
|
-e setup_image="$COMPOSER_SETUP_IMAGE"
|
||||||
-e composer="$COMPOSER_CMD"
|
-e composer="$COMPOSER_CMD"
|
||||||
-e args="$args"
|
-e args="$args"
|
||||||
)
|
)
|
||||||
|
@ -2008,35 +2016,36 @@ fi
|
||||||
|
|
||||||
if [ -n "$COMPOSER_SETUP" ]; then
|
if [ -n "$COMPOSER_SETUP" ]; then
|
||||||
# lancement dans un container docker à préparer
|
# lancement dans un container docker à préparer
|
||||||
local NAME project_name container_name dkid
|
local NAME setup_image project_name container_name dkid
|
||||||
if [ -f docker-compose.yml ]; then
|
if [ -f docker-compose.yml ]; then
|
||||||
compose_set_project_name set_container_name
|
compose_set_project_name set_container_name
|
||||||
else
|
else
|
||||||
NAME="$(basename -- "$(pwd)")"
|
NAME="$(basename -- "$(pwd)")"
|
||||||
docker_check_name set_container_name
|
docker_check_name set_container_name
|
||||||
fi
|
fi
|
||||||
container_name="dk_composer_${container_name}"
|
setup_image="$COMPOSER_SETUP_IMAGE"
|
||||||
|
[ -n "$setup_image" ] || setup_image="dk_composer_${container_name}_image"
|
||||||
|
|
||||||
# vérifier l'existence de l'image
|
# vérifier l'existence de l'image
|
||||||
setx dkid=docker image ls --format '{{.ID}}' "${container_name}_image"
|
setx dkid=docker image ls --format '{{.ID}}' "$setup_image"
|
||||||
|
|
||||||
# créer le container le cas échéant
|
# créer le container le cas échéant
|
||||||
if [ -z "$dkid" ]; then
|
if [ -z "$dkid" ]; then
|
||||||
estep "Création du container $container_name avec l'image $COMPOSER_IMAGE"
|
estep "Création de l'image $setup_image à partir de $COMPOSER_IMAGE"
|
||||||
cmd=(
|
cmd=(
|
||||||
"$DOCKER" create -it --name "${container_name}_ct"
|
"$DOCKER" create -it --name "${setup_image}_tmpct"
|
||||||
"${basecmd[@]}"
|
"${basecmd[@]}"
|
||||||
"$COMPOSER_IMAGE"
|
"$COMPOSER_IMAGE"
|
||||||
bash -c "$setupscript"
|
bash -c "$setupscript"
|
||||||
)
|
)
|
||||||
setx dkid="${cmd[@]}" || return 1
|
setx dkid="${cmd[@]}" || return 1
|
||||||
"$DOCKER" container start -ai "$dkid" || return 1
|
"$DOCKER" container start -ai "$dkid" || return 1
|
||||||
"$DOCKER" container commit "$dkid" "${container_name}_image" || return 1
|
"$DOCKER" container commit "$dkid" "$setup_image" || return 1
|
||||||
"$DOCKER" container rm "$dkid" || return 1
|
"$DOCKER" container rm "$dkid" || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prendre comme image le container créé
|
# prendre comme image le container créé
|
||||||
COMPOSER_IMAGE="${container_name}_image"
|
COMPOSER_IMAGE="$setup_image"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd=(
|
cmd=(
|
||||||
|
@ -2062,7 +2071,19 @@ function auto_composer() {
|
||||||
local COMPOSER_MACHINE=-u
|
local COMPOSER_MACHINE=-u
|
||||||
local COMPOSER_CMD=
|
local COMPOSER_CMD=
|
||||||
local COMPOSER_SETUP=
|
local COMPOSER_SETUP=
|
||||||
[ -f .composer.conf ] && source ./.composer.conf
|
local COMPOSER_SETUP_IMAGE=
|
||||||
|
if [ -f .composer.yaml ]; then
|
||||||
|
local registry
|
||||||
|
eval "$(<.composer.yaml grep ^composer_ |
|
||||||
|
sed 's/^composer_php_min: /COMPOSER_PHP=/
|
||||||
|
s/^composer_php_max: /COMPOSER_PHP_MAX=/
|
||||||
|
s/^composer_registry: /registry=/
|
||||||
|
s/^composer_image: \(.*\)/COMPOSER_IMAGE="${registry:-$REGISTRY}\/\1"/
|
||||||
|
s/^composer_setup: /COMPOSER_SETUP=/
|
||||||
|
s/^composer_setup_image: /COMPOSER_SETUP_IMAGE=/')"
|
||||||
|
elif [ -f .composer.conf ]; then
|
||||||
|
source ./.composer.conf
|
||||||
|
fi
|
||||||
# les premiers arguments peuvent servir à redéfinir les variables
|
# les premiers arguments peuvent servir à redéfinir les variables
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -2204,6 +2225,7 @@ function default_docker_maven() {
|
||||||
-e group="$group"
|
-e group="$group"
|
||||||
-e projdir="$projdir"
|
-e projdir="$projdir"
|
||||||
-e setup="$MAVEN_SETUP"
|
-e setup="$MAVEN_SETUP"
|
||||||
|
-e setup_image="$MAVEN_SETUP_IMAGE"
|
||||||
-e maven="$MAVEN_CMD"
|
-e maven="$MAVEN_CMD"
|
||||||
-e args="$args"
|
-e args="$args"
|
||||||
${MAVEN_JAVA:+-e JAVA="$MAVEN_JAVA"}
|
${MAVEN_JAVA:+-e JAVA="$MAVEN_JAVA"}
|
||||||
|
@ -2228,35 +2250,36 @@ cd "$projdir"
|
||||||
|
|
||||||
if [ -n "$MAVEN_SETUP" ]; then
|
if [ -n "$MAVEN_SETUP" ]; then
|
||||||
# lancement dans un container docker à préparer
|
# lancement dans un container docker à préparer
|
||||||
local NAME project_name container_name dkid
|
local NAME setup_image project_name container_name dkid
|
||||||
if [ -f docker-compose.yml ]; then
|
if [ -f docker-compose.yml ]; then
|
||||||
compose_set_project_name set_container_name
|
compose_set_project_name set_container_name
|
||||||
else
|
else
|
||||||
NAME="$(basename -- "$(pwd)")"
|
NAME="$(basename -- "$(pwd)")"
|
||||||
docker_check_name set_container_name
|
docker_check_name set_container_name
|
||||||
fi
|
fi
|
||||||
container_name="dk_maven_${container_name}"
|
setup_image="$MAVEN_SETUP_IMAGE"
|
||||||
|
[ -n "$setup_image" ] || setup_image="dk_maven_${container_name}_image"
|
||||||
|
|
||||||
# vérifier l'existence de l'image
|
# vérifier l'existence de l'image
|
||||||
setx dkid=docker image ls --format '{{.ID}}' "${container_name}_image"
|
setx dkid=docker image ls --format '{{.ID}}' "$setup_image"
|
||||||
|
|
||||||
# créer le container le cas échéant
|
# créer le container le cas échéant
|
||||||
if [ -z "$dkid" ]; then
|
if [ -z "$dkid" ]; then
|
||||||
estep "Création du container $container_name avec l'image $MAVEN_IMAGE"
|
estep "Création de l'image $setup_image à partir de $MAVEN_IMAGE"
|
||||||
cmd=(
|
cmd=(
|
||||||
"$DOCKER" create -it --name "${container_name}_ct"
|
"$DOCKER" create -it --name "${setup_image}_tmpct"
|
||||||
"${basecmd[@]}"
|
"${basecmd[@]}"
|
||||||
"$MAVEN_IMAGE"
|
"$MAVEN_IMAGE"
|
||||||
bash -c "$setupscript"
|
bash -c "$setupscript"
|
||||||
)
|
)
|
||||||
setx dkid="${cmd[@]}" || return 1
|
setx dkid="${cmd[@]}" || return 1
|
||||||
"$DOCKER" container start -ai "$dkid" || return 1
|
"$DOCKER" container start -ai "$dkid" || return 1
|
||||||
"$DOCKER" container commit "$dkid" "${container_name}_image" || return 1
|
"$DOCKER" container commit "$dkid" "$setup_image" || return 1
|
||||||
"$DOCKER" container rm "$dkid" || return 1
|
"$DOCKER" container rm "$dkid" || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prendre comme image le container créé
|
# prendre comme image le container créé
|
||||||
MAVEN_IMAGE="${container_name}_image"
|
MAVEN_IMAGE="$setup_image"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd=(
|
cmd=(
|
||||||
|
@ -2281,6 +2304,7 @@ function auto_maven() {
|
||||||
local MAVEN_MACHINE=-u
|
local MAVEN_MACHINE=-u
|
||||||
local MAVEN_CMD=
|
local MAVEN_CMD=
|
||||||
local MAVEN_SETUP=
|
local MAVEN_SETUP=
|
||||||
|
local MAVEN_SETUP_IMAGE=
|
||||||
[ -f .maven.conf ] && source ./.maven.conf
|
[ -f .maven.conf ] && source ./.maven.conf
|
||||||
# les premiers arguments peuvent servir à redéfinir les variables
|
# les premiers arguments peuvent servir à redéfinir les variables
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
|
@ -2413,7 +2437,6 @@ fi
|
||||||
|
|
||||||
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
||||||
|
|
||||||
DEFAULT_PROFILE=devel
|
|
||||||
PROFILE=
|
PROFILE=
|
||||||
DM_ALIASES=()
|
DM_ALIASES=()
|
||||||
DM_PROFILES=()
|
DM_PROFILES=()
|
||||||
|
@ -2421,19 +2444,55 @@ CLUSTERDIRS=()
|
||||||
DEFAULT_DEVEL_SRCDIR="$HOME/wop"
|
DEFAULT_DEVEL_SRCDIR="$HOME/wop"
|
||||||
COMPOSER_DEVEL_SRCDIR="$HOME/wop/php"
|
COMPOSER_DEVEL_SRCDIR="$HOME/wop/php"
|
||||||
MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
||||||
DEFAULT_COMPOSER_IMAGE=docker.univ-reunion.fr/image/phpbuilder
|
DEFAULT_COMPOSER_IMAGE=
|
||||||
DEFAULT_MAVEN_IMAGE=docker.univ-reunion.fr/image/javabuilder
|
DEFAULT_MAVEN_IMAGE=
|
||||||
DEFAULT_HOST_MAPPINGS=()
|
DEFAULT_HOST_MAPPINGS=()
|
||||||
prod_HOST_MAPPINGS=(
|
|
||||||
docker.univ-reunion.fr:10.82.70.154
|
|
||||||
repos.univ-reunion.fr:10.82.70.246
|
|
||||||
git.univ-reunion.fr:10.82.70.247
|
|
||||||
)
|
|
||||||
test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS[@]}")
|
|
||||||
set_defaults dk
|
set_defaults dk
|
||||||
export PROFILE
|
export PROFILE
|
||||||
|
|
||||||
|
DEFAULT_PROFILE=devel
|
||||||
|
REGISTRY=
|
||||||
HOST_MAPPINGS=()
|
HOST_MAPPINGS=()
|
||||||
|
if [ -f ~/.dkbuild.env ]; then
|
||||||
|
function default_profile() {
|
||||||
|
DEFAULT_PROFILE="$1"
|
||||||
|
}
|
||||||
|
function profile() {
|
||||||
|
local profile
|
||||||
|
for profile in "$@"; do
|
||||||
|
[ "$profile" == "$DEFAULT_PROFILE" ] && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
function setenv() {
|
||||||
|
eval "export $1"
|
||||||
|
}
|
||||||
|
function default() {
|
||||||
|
local command="$1"; shift
|
||||||
|
local nv n v
|
||||||
|
case "$command" in
|
||||||
|
docker)
|
||||||
|
for nv in "$@"; do
|
||||||
|
[[ "$nv" == *=* ]] || continue
|
||||||
|
n="${nv%%=*}"
|
||||||
|
v="${nv#*=}"
|
||||||
|
case "$n" in
|
||||||
|
host-mappings)
|
||||||
|
read -a nv <<<"$v"
|
||||||
|
for v in "${ns[@]}"; do
|
||||||
|
HOST_MAPPINGS+=("$v")
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
source ~/.dkbuild.env
|
||||||
|
fi
|
||||||
|
[ -n "$REGISTRY" ] || REGISTRY=pubdocker.univ-reunion.fr
|
||||||
|
[ -n "$DEFAULT_COMPOSER_IMAGE" ] || DEFAULT_COMPOSER_IMAGE="$REGISTRY/image/php:d11"
|
||||||
|
[ -n "$DEFAULT_MAVEN_IMAGE" ] || DEFAULT_MAVEN_IMAGE="$REGISTRY/image/javabuilder:d11"
|
||||||
|
|
||||||
chdir=
|
chdir=
|
||||||
CONFIG=
|
CONFIG=
|
||||||
|
@ -2445,6 +2504,7 @@ FAKE=
|
||||||
VARS=()
|
VARS=()
|
||||||
FORCE=
|
FORCE=
|
||||||
NO_CACHE=
|
NO_CACHE=
|
||||||
|
PROGRESS=
|
||||||
PULL=
|
PULL=
|
||||||
HOST=
|
HOST=
|
||||||
WITH_REGISTRY_AUTH=1
|
WITH_REGISTRY_AUTH=1
|
||||||
|
@ -2468,6 +2528,7 @@ args=(
|
||||||
-e:,--build-arg:,--env: VARS
|
-e:,--build-arg:,--env: VARS
|
||||||
-f,--force FORCE=1
|
-f,--force FORCE=1
|
||||||
-j,--no-cache NO_CACHE=1
|
-j,--no-cache NO_CACHE=1
|
||||||
|
--plain-output PROGRESS=plain
|
||||||
-U,--pull PULL=1
|
-U,--pull PULL=1
|
||||||
-h:,--host: HOST=
|
-h:,--host: HOST=
|
||||||
-g,--ug,--no-update-apps update_apps_mode=b
|
-g,--ug,--no-update-apps update_apps_mode=b
|
||||||
|
|
311
dkbuild
311
dkbuild
|
@ -9,10 +9,10 @@ TEMPLATEDIR="$scriptdir/lib/dkbuild/templates"
|
||||||
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
||||||
|
|
||||||
function get_default_phpbuilder_image() {
|
function get_default_phpbuilder_image() {
|
||||||
echo "${REGISTRY:-docker.univ-reunion.fr}/image/phpbuilder:${DIST:-d11}"
|
echo "${REGISTRY:-pubdocker.univ-reunion.fr}/image/phpbuilder:${DIST:-d11}"
|
||||||
}
|
}
|
||||||
function get_default_javabuilder_image() {
|
function get_default_javabuilder_image() {
|
||||||
echo "${REGISTRY:-docker.univ-reunion.fr}/image/javabuilder:d11"
|
echo "${REGISTRY:-pubdocker.univ-reunion.fr}/image/javabuilder:d11"
|
||||||
}
|
}
|
||||||
|
|
||||||
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -86,23 +86,28 @@ $scriptname build [OPTIONS] [BUILDVARS...]
|
||||||
configuration ne doit être chargé.
|
configuration ne doit être chargé.
|
||||||
|
|
||||||
-d, --dist DIST
|
-d, --dist DIST
|
||||||
-9, --d9
|
|
||||||
-0, --d10
|
-0, --d10
|
||||||
-1, --d11
|
-1, --d11
|
||||||
|
-2, --d12
|
||||||
|
-3, --d13
|
||||||
--r7, --rhel7
|
--r7, --rhel7
|
||||||
--r8, --rhel8
|
--r8, --rhel8
|
||||||
|
--r9, --rhel9
|
||||||
--o7, --oracle7
|
--o7, --oracle7
|
||||||
--o8, --oracle8
|
--o8, --oracle8
|
||||||
|
--o9, --oracle9
|
||||||
Ne faire le build que pour la distribution spécifiée. Par défaut, faire
|
Ne faire le build que pour la distribution spécifiée. Par défaut, faire
|
||||||
le build pour toutes les distributions définies. Si la distribution
|
le build pour toutes les distributions définies. Si la distribution
|
||||||
sélectionnée n'est pas valide pour ce build, elle est ignorée
|
sélectionnée n'est pas valide pour ce build, elle est ignorée
|
||||||
|
|
||||||
--profile PROFILE
|
-g, --profile PROFILE
|
||||||
-P, --prod
|
-P, --prod
|
||||||
-T, --test
|
-T, --test
|
||||||
-E, --dtest
|
-E, --dtest
|
||||||
--devel
|
--devel
|
||||||
Spécifier le profil dans lequel construire l'image
|
Spécifier le profil dans lequel construire l'image
|
||||||
|
--all-profiles
|
||||||
|
Construire l'image dans tous les profils définis
|
||||||
|
|
||||||
-e, --env VAR=VALUE
|
-e, --env VAR=VALUE
|
||||||
Spécifier la valeur d'une variable d'environnement. Cette valeur
|
Spécifier la valeur d'une variable d'environnement. Cette valeur
|
||||||
|
@ -111,10 +116,18 @@ $scriptname build [OPTIONS] [BUILDVARS...]
|
||||||
Spécifier la valeur d'un argument de build. Cette valeur remplace la
|
Spécifier la valeur d'un argument de build. Cette valeur remplace la
|
||||||
valeur par défaut spécifiée dans le fichier de build.
|
valeur par défaut spécifiée dans le fichier de build.
|
||||||
|
|
||||||
|
-u, --clean-update
|
||||||
|
Avant de faire le build, faire un clean, suivi de git pull. C'est la
|
||||||
|
méthode préférée pour mettre à jour le dépôt s'il y a des fichiers
|
||||||
|
synchronisé avec la commande 'copy', parce que sinon les fichiers
|
||||||
|
sources (mis à jour par git pull) sont désynchronisés d'avec les
|
||||||
|
fichiers destination.
|
||||||
--clone-src-only
|
--clone-src-only
|
||||||
Ne faire que cloner les dépôts sources
|
Ne faire que cloner les dépôts sources mentionnés avec la commande
|
||||||
|
'checkout'
|
||||||
--update-src-only
|
--update-src-only
|
||||||
Ne faire que mettre à jour les dépôts sources
|
Ne faire que mettre à jour les dépôts sources mentionnés avec la
|
||||||
|
commande 'checkout'
|
||||||
--update-src
|
--update-src
|
||||||
Avec la commande 'checkout', mettre à jour les dépôts avant de faire le
|
Avec la commande 'checkout', mettre à jour les dépôts avant de faire le
|
||||||
build. C'est la valeur par défaut.
|
build. C'est la valeur par défaut.
|
||||||
|
@ -125,7 +138,8 @@ $scriptname build [OPTIONS] [BUILDVARS...]
|
||||||
Ne pas mettre à jour le dépôt, préférer la synchronisation depuis la
|
Ne pas mettre à jour le dépôt, préférer la synchronisation depuis la
|
||||||
version de développement d'un dépôt
|
version de développement d'un dépôt
|
||||||
-s, --sync-src
|
-s, --sync-src
|
||||||
Avec la commande 'copy', effectuer la mise à jour des fichiers
|
Avec la commande 'copy', effectuer la mise à jour des fichiers. C'est la
|
||||||
|
valeur par défaut si on construit l'image
|
||||||
--no-sync-src
|
--no-sync-src
|
||||||
Ne pas mettre à jour les fichiers. La commande 'copy' devient un NOP si
|
Ne pas mettre à jour les fichiers. La commande 'copy' devient un NOP si
|
||||||
le fichier destination existe.
|
le fichier destination existe.
|
||||||
|
@ -133,7 +147,9 @@ $scriptname build [OPTIONS] [BUILDVARS...]
|
||||||
Construire les images
|
Construire les images
|
||||||
--no-cache
|
--no-cache
|
||||||
Ne pas utiliser le cache lors du build
|
Ne pas utiliser le cache lors du build
|
||||||
-u, --pull-image
|
--plain-output
|
||||||
|
Afficher la sortie complète des containers lors du build
|
||||||
|
-U, --pull-image
|
||||||
Essayer de récupérer une version plus récente de l'image source
|
Essayer de récupérer une version plus récente de l'image source
|
||||||
-p, --push-image
|
-p, --push-image
|
||||||
Pousser les images construites vers la registry
|
Pousser les images construites vers la registry
|
||||||
|
@ -169,8 +185,9 @@ $scriptname mvn DESTDIR [ACTION [PARAMS] [ARGS]]
|
||||||
$scriptname dump [OPTIONS]
|
$scriptname dump [OPTIONS]
|
||||||
afficher les valeurs des variables
|
afficher les valeurs des variables
|
||||||
|
|
||||||
Les options --machine, --projdir, --config, --dist, --profile, --env et
|
Les options suivantes ont la même signification que pour l'action build:
|
||||||
--arg ont la même signification que pour l'action build"
|
--machine, --projdir, --config, --dist, --profile, --all-profiles, --env,
|
||||||
|
--arg"
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_help_dkbuild() {
|
function display_help_dkbuild() {
|
||||||
|
@ -207,9 +224,13 @@ construites. Une version est définie en ajoutant un préfixe à la distribution
|
||||||
La commande 'setdists' permet de lister explicitement les distributions valides
|
La commande 'setdists' permet de lister explicitement les distributions valides
|
||||||
(et les versions associées le cas échéant). Si la distribution sélectionnée par
|
(et les versions associées le cas échéant). Si la distribution sélectionnée par
|
||||||
l'utilisateur n'est pas dans la liste fournie, le script s'arrête sans erreur.
|
l'utilisateur n'est pas dans la liste fournie, le script s'arrête sans erreur.
|
||||||
|
|
||||||
La première distribution listée est spéciale: c'est la distribution la plus
|
La première distribution listée est spéciale: c'est la distribution la plus
|
||||||
récente, celle qui reçoit le tag :latest
|
récente, celle qui reçoit le tag :latest
|
||||||
|
|
||||||
|
La distribution 'none' est spéciale aussi: elle n'est pas mentionnée dans les
|
||||||
|
tags automatiquement attribués aux images.
|
||||||
|
|
||||||
La commande 'dist' permet de tester si la distribution spécifiée en argument a
|
La commande 'dist' permet de tester si la distribution spécifiée en argument a
|
||||||
été sélectionnée par l'utilisateur. L'argument 'LATEST' permet de tester la
|
été sélectionnée par l'utilisateur. L'argument 'LATEST' permet de tester la
|
||||||
dernière distribution.
|
dernière distribution.
|
||||||
|
@ -248,6 +269,11 @@ Si le profil sélectionné par l'utilisateur n'est pas dans la liste fournie, le
|
||||||
script s'arrête avec une erreur. Le premier profil listé est spécial: c'est le
|
script s'arrête avec une erreur. Le premier profil listé est spécial: c'est le
|
||||||
profil par défaut.
|
profil par défaut.
|
||||||
|
|
||||||
|
La commande 'default_profile' permet de spécifier un profil par défaut à
|
||||||
|
utiliser, exactement comme s'il avait été spécifié avec l'option --profile.
|
||||||
|
Cette commande est particulièrement appropriée pour le fichier ~/.dkbuild.env
|
||||||
|
s'il s'agit de définir le profil à utiliser sur un hôte.
|
||||||
|
|
||||||
La commande 'profile' permet de tester si le profil spécifié en argument a été
|
La commande 'profile' permet de tester si le profil spécifié en argument a été
|
||||||
sélectionné par l'utilisateur. L'argument 'DEFAULT' permet de tester le profil
|
sélectionné par l'utilisateur. L'argument 'DEFAULT' permet de tester le profil
|
||||||
par défaut.
|
par défaut.
|
||||||
|
@ -277,8 +303,8 @@ la plus récente.
|
||||||
Si les distributions sont utilisées avec des versions, alors c'est une erreur de
|
Si les distributions sont utilisées avec des versions, alors c'est une erreur de
|
||||||
spécifier une version dans le profil
|
spécifier une version dans le profil
|
||||||
|
|
||||||
Note: 'setprofiles' ne doit être utilisé qu'une seule fois. Les invocations
|
Note: 'setprofiles' et 'default_profile' ne peuvent être utilisés qu'une seule
|
||||||
suivantes sont ignorées.
|
fois. Les invocations suivantes sont ignorées.
|
||||||
|
|
||||||
## Versions ####################################################################
|
## Versions ####################################################################
|
||||||
|
|
||||||
|
@ -498,6 +524,8 @@ USAGE:
|
||||||
|
|
||||||
## setprofiles -- spécifier les profils valides
|
## setprofiles -- spécifier les profils valides
|
||||||
|
|
||||||
|
## default_profile -- spécifier le profil à utiliser si aucun profil n'est sélectionné
|
||||||
|
|
||||||
## profile -- vérifier le profil courant
|
## profile -- vérifier le profil courant
|
||||||
|
|
||||||
## setversion -- spécifier la version par défaut
|
## setversion -- spécifier la version par défaut
|
||||||
|
@ -654,7 +682,8 @@ Les paramètres optionnels sont
|
||||||
* set-tag=TAGS... ou set-tags=TAGS...
|
* set-tag=TAGS... ou set-tags=TAGS...
|
||||||
spécifier des tags à rajouter au nom de l'image, séparés par un espace. cette
|
spécifier des tags à rajouter au nom de l'image, séparés par un espace. cette
|
||||||
liste remplace celle calculée automatiquement. ce paramètre est ignoré pour
|
liste remplace celle calculée automatiquement. ce paramètre est ignoré pour
|
||||||
les noms d'images comportant un tag
|
les noms d'images comportant un tag.
|
||||||
|
Utiliser le tag spécial LATEST pour rajouter :latest si c'est approprié
|
||||||
* add-tag=TAGS... ou add-tags=TAGS...
|
* add-tag=TAGS... ou add-tags=TAGS...
|
||||||
spécifier des tags à rajouter à la liste calculée automatiquement, séparés par
|
spécifier des tags à rajouter à la liste calculée automatiquement, séparés par
|
||||||
un espace. ce paramètre est ignoré pour les noms d'images comportant un tag
|
un espace. ce paramètre est ignoré pour les noms d'images comportant un tag
|
||||||
|
@ -765,18 +794,29 @@ Les paramètres optionnels sont
|
||||||
commandes spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
commandes spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
||||||
Ce paramétrage est utilisé par exemple pour installer certains packages
|
Ce paramétrage est utilisé par exemple pour installer certains packages
|
||||||
nécessaire au projet.
|
nécessaire au projet.
|
||||||
|
* setup-image=SETUP_IMAGE
|
||||||
|
forcer le nom de l'image pour setup= (la valeur de project-name= est ignorée)
|
||||||
* project-name=PROJECT_NAME
|
* project-name=PROJECT_NAME
|
||||||
si setup= est défini, nommer l'image sur la base de ce nom. par défaut, le nom
|
si setup= est défini, nommer l'image sur la base de ce nom. par défaut, le nom
|
||||||
est calculé automatiquement
|
est calculé automatiquement
|
||||||
|
|
||||||
Si un fichier .composer.conf existe dans le répertoire du projet, il est sourcé
|
Si un fichier .composer.yaml existe dans le répertoire du projet, il est analysé
|
||||||
pour obtenir les valeurs par défaut des paramètres:
|
pour obtenir les valeurs par défaut des paramètres suivants:
|
||||||
|
* composer_php_min: valeur par défaut de php=
|
||||||
|
* composer_php_max: valeur par défaut de php-max=
|
||||||
|
* composer_registry: ET composer_image: valeur par défaut de image=
|
||||||
|
* composer_setup: valeur par défaut de setup=
|
||||||
|
* composer_setup_image: valeur par défaut de setup-image=
|
||||||
|
|
||||||
|
Sinon, si un fichier .composer.conf existe dans le répertoire du projet, il est
|
||||||
|
sourcé pour obtenir les valeurs par défaut des paramètres:
|
||||||
* COMPOSER_PHP -- valeur par défaut de php=
|
* COMPOSER_PHP -- valeur par défaut de php=
|
||||||
* COMPOSER_PHP_MAX -- valeur par défaut de php-max=
|
* COMPOSER_PHP_MAX -- valeur par défaut de php-max=
|
||||||
* COMPOSER_IMAGE -- valeur par défaut de image=
|
* COMPOSER_IMAGE -- valeur par défaut de image=
|
||||||
* COMPOSER_MACHINE -- valeur par défaut de machine=
|
* COMPOSER_MACHINE -- valeur par défaut de machine=
|
||||||
* COMPOSER_CMD -- valeur par défaut de composer=
|
* COMPOSER_CMD -- valeur par défaut de composer=
|
||||||
* COMPOSER_SETUP -- valeur par défaut de setup=
|
* COMPOSER_SETUP -- valeur par défaut de setup=
|
||||||
|
* COMPOSER_SETUP_IMAGE -- valeur par défaut de setup-image=
|
||||||
|
|
||||||
## mvn -- construire projet maven
|
## mvn -- construire projet maven
|
||||||
|
|
||||||
|
@ -838,6 +878,8 @@ Les paramètres optionnels sont
|
||||||
commandes spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
commandes spécifiées y sont lancées. Ce container est réutilisé à chaque fois.
|
||||||
Ce paramétrage est utilisé par exemple pour installer certains packages
|
Ce paramétrage est utilisé par exemple pour installer certains packages
|
||||||
nécessaire au projet.
|
nécessaire au projet.
|
||||||
|
* setup-image=SETUP_IMAGE
|
||||||
|
forcer le nom de l'image pour setup= (la valeur de project-name= est ignorée)
|
||||||
* project-name=PROJECT_NAME
|
* project-name=PROJECT_NAME
|
||||||
si setup= est défini, nommer l'image sur la base de ce nom. par défaut, le nom
|
si setup= est défini, nommer l'image sur la base de ce nom. par défaut, le nom
|
||||||
est calculé automatiquement
|
est calculé automatiquement
|
||||||
|
@ -849,6 +891,7 @@ pour obtenir les valeurs par défaut des paramètres:
|
||||||
* MAVEN_MACHINE -- valeur par défaut de machine=
|
* MAVEN_MACHINE -- valeur par défaut de machine=
|
||||||
* MAVEN_CMD -- valeur par défaut de mvn=
|
* MAVEN_CMD -- valeur par défaut de mvn=
|
||||||
* MAVEN_SETUP -- valeur par défaut de setup=
|
* MAVEN_SETUP -- valeur par défaut de setup=
|
||||||
|
* MAVEN_SETUP_IMAGE -- valeur par défaut de setup-image=
|
||||||
|
|
||||||
## run -- lancer des commandes
|
## run -- lancer des commandes
|
||||||
|
|
||||||
|
@ -880,6 +923,7 @@ declare -A PROTECTED_VARS=(
|
||||||
[SETDISTS]=1
|
[SETDISTS]=1
|
||||||
[SETPROFILES_DONE]=1
|
[SETPROFILES_DONE]=1
|
||||||
[SETPROFILES]=1
|
[SETPROFILES]=1
|
||||||
|
[DEFAULT_PROFILE]=1
|
||||||
[SETVERSION_DONE]=1
|
[SETVERSION_DONE]=1
|
||||||
[SETVERSION]=1
|
[SETVERSION]=1
|
||||||
[AUTOBUILD]=1
|
[AUTOBUILD]=1
|
||||||
|
@ -897,22 +941,27 @@ SHARED_ARGS1=(
|
||||||
-c:,--config: CONFIG=
|
-c:,--config: CONFIG=
|
||||||
)
|
)
|
||||||
|
|
||||||
SHARED_LOCALS2="local DIST PROFILE; local -a TMPENVIRON TMPARGS"
|
SHARED_LOCALS2="local DIST PROFILE ALL_PROFILES; local -a TMPENVIRON TMPARGS"
|
||||||
SHARED_ARGS2=(
|
SHARED_ARGS2=(
|
||||||
-d:,--dist: DIST=
|
-d:,--dist: DIST=
|
||||||
-9,--d9 DIST=d9
|
|
||||||
-0,--d10 DIST=d10
|
-0,--d10 DIST=d10
|
||||||
-1,--d11 DIST=d11
|
-1,--d11 DIST=d11
|
||||||
|
-2,--d12 DIST=d12
|
||||||
|
-3,--d13 DIST=d13
|
||||||
--r7,--rhel7 DIST=rhel7
|
--r7,--rhel7 DIST=rhel7
|
||||||
--r8,--rhel8 DIST=rhel8
|
--r8,--rhel8 DIST=rhel8
|
||||||
|
--r9,--rhel9 DIST=rhel9
|
||||||
--ol7,--oracle7 DIST=ol7
|
--ol7,--oracle7 DIST=ol7
|
||||||
--ol8,--oracle8 DIST=ol8
|
--ol8,--oracle8 DIST=ol8
|
||||||
|
--ol9,--oracle9 DIST=ol9
|
||||||
|
|
||||||
-p:,--profile: PROFILE=
|
-g:,--profile: PROFILE=
|
||||||
-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
|
||||||
|
--all-profiles ALL_PROFILES=1
|
||||||
|
|
||||||
-e:,--env: '$TMPENVIRON+=("$value_")'
|
-e:,--env: '$TMPENVIRON+=("$value_")'
|
||||||
--arg: '$TMPARGS+=("$value_")'
|
--arg: '$TMPARGS+=("$value_")'
|
||||||
|
@ -923,6 +972,7 @@ TFUNCTIONS=(
|
||||||
section note info debug
|
section note info debug
|
||||||
setdists dist
|
setdists dist
|
||||||
setprofiles profile
|
setprofiles profile
|
||||||
|
default_profile
|
||||||
setversion version
|
setversion version
|
||||||
setenv resetenv
|
setenv resetenv
|
||||||
setarg resetarg
|
setarg resetarg
|
||||||
|
@ -1033,12 +1083,13 @@ function reset_functions() {
|
||||||
function include() {
|
function include() {
|
||||||
edebug "include $(qvals "$@")"
|
edebug "include $(qvals "$@")"
|
||||||
|
|
||||||
local file="$1"
|
local file="$1" cwd="$(pwd)"
|
||||||
[ -d "$file" ] && file="$file/dkbuild"
|
[ -d "$file" ] && file="$file/dkbuild"
|
||||||
[ -f "$file" ] || die "$file: fichier introuvable"
|
[ -f "$file" ] || die "$file: fichier introuvable"
|
||||||
setx file=abspath "$file"
|
setx file=abspath "$file"
|
||||||
cd "$(dirname "$file")"
|
cd "$(dirname "$file")"
|
||||||
source "$file"
|
source "$file"
|
||||||
|
cd "$cwd"
|
||||||
}
|
}
|
||||||
function machine() {
|
function machine() {
|
||||||
local machine version
|
local machine version
|
||||||
|
@ -1137,12 +1188,14 @@ function load_environ() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function from_glob() {
|
function from_glob() {
|
||||||
local var=value value
|
local vvalue=value value vfile=file file
|
||||||
[[ "$1" != *=* ]] && { var="$1"; shift; }
|
[[ "$1" != *=* ]] && { vvalue="$1"; shift; }
|
||||||
|
[[ "$1" != *=* ]] && { vfile="$1"; shift; }
|
||||||
|
|
||||||
local path extract add_prefix add_suffix
|
local basedir path extract add_prefix add_suffix
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
basedir=*) basedir="${1#basedir=}";;
|
||||||
path=*) path="${1#path=}";;
|
path=*) path="${1#path=}";;
|
||||||
extract=*) extract="${1#extract=}";;
|
extract=*) extract="${1#extract=}";;
|
||||||
add-prefix=*) add_prefix="${1#add-prefix=}";;
|
add-prefix=*) add_prefix="${1#add-prefix=}";;
|
||||||
|
@ -1152,7 +1205,9 @@ function from_glob() {
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
value="$(list_all . "$path" | sort -rn | head -1)"
|
[ -n "$basedir" ] || basedir=.
|
||||||
|
value="$(list_all "$basedir" "$path" | sort -rn | head -1)"
|
||||||
|
file="$basedir/$value"
|
||||||
[ -n "$extract" ] || extract="${path//\*/(.*)}"
|
[ -n "$extract" ] || extract="${path//\*/(.*)}"
|
||||||
if [ -n "$extract" ]; then
|
if [ -n "$extract" ]; then
|
||||||
extract="${extract//\//\\/}"
|
extract="${extract//\//\\/}"
|
||||||
|
@ -1162,7 +1217,7 @@ function from_glob() {
|
||||||
}")$add_suffix"
|
}")$add_suffix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local "$var"; upvar "$var" "$value"
|
local "$vvalue" "$vfile"; upvars "$vvalue" "$value" "$vfile" "$file"
|
||||||
}
|
}
|
||||||
function define_functions_env() {
|
function define_functions_env() {
|
||||||
function setversion() {
|
function setversion() {
|
||||||
|
@ -1259,14 +1314,37 @@ function define_functions_env() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
function profile() {
|
function profile() {
|
||||||
local profile version
|
local profile version default
|
||||||
for profile in "$@"; do
|
for profile in "$@"; do
|
||||||
[ "$profile" == DEFAULT ] && profile="${SETPROFILES[0]}"
|
if [ "$profile" == DEFAULT ]; then
|
||||||
|
default=1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
parse_profile "$profile" profile version
|
parse_profile "$profile" profile version
|
||||||
[ "$profile" == "$PROFILE" ] || continue
|
[ "$profile" == "$PROFILE" ] || continue
|
||||||
[ -z "$version" -o "$version" == "$PVERSION" ] || continue
|
[ -z "$version" -o "$version" == "$PVERSION" ] || continue
|
||||||
return 0
|
return 0
|
||||||
done
|
done
|
||||||
|
if [ -n "$default" ]; then
|
||||||
|
# trouver la dernière occurence du premier profil mentionné. en
|
||||||
|
# effet, les versions doivent être ordonnées de la plus ancienne à
|
||||||
|
# la plus récente.
|
||||||
|
local first_profile last_version
|
||||||
|
for profile in "${SETPROFILES[@]}"; do
|
||||||
|
parse_profile "$profile" profile version
|
||||||
|
if [ -z "$first_profile" ]; then
|
||||||
|
first_profile="$profile"
|
||||||
|
last_version="$version"
|
||||||
|
elif [ "$profile" == "$first_profile" ]; then
|
||||||
|
last_version="$version"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$first_profile" == "$PROFILE" ]; then
|
||||||
|
if [ -z "$last_version" -o "$last_version" == "$PVERSION" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
declare -g -A ENVIRON
|
declare -g -A ENVIRON
|
||||||
|
@ -1395,6 +1473,7 @@ function resolve_dists_profiles() {
|
||||||
SETDISTS=()
|
SETDISTS=()
|
||||||
SETPROFILES_DONE=
|
SETPROFILES_DONE=
|
||||||
SETPROFILES=()
|
SETPROFILES=()
|
||||||
|
DEFAULT_PROFILE=
|
||||||
SETVERSION_DONE=
|
SETVERSION_DONE=
|
||||||
SETVERSION=
|
SETVERSION=
|
||||||
AUTOBUILD=1
|
AUTOBUILD=1
|
||||||
|
@ -1409,6 +1488,9 @@ function resolve_dists_profiles() {
|
||||||
SETPROFILES=("$@")
|
SETPROFILES=("$@")
|
||||||
SETPROFILES_DONE=1
|
SETPROFILES_DONE=1
|
||||||
}
|
}
|
||||||
|
function default_profile() {
|
||||||
|
[ -n "$DEFAULT_PROFILE" ] || DEFAULT_PROFILE="$1"
|
||||||
|
}
|
||||||
function build() {
|
function build() {
|
||||||
AUTOBUILD=
|
AUTOBUILD=
|
||||||
}
|
}
|
||||||
|
@ -1417,6 +1499,20 @@ function resolve_dists_profiles() {
|
||||||
}
|
}
|
||||||
load_dkbuild
|
load_dkbuild
|
||||||
|
|
||||||
|
if [ -z "$PROFILE" -a -z "$ALL_PROFILES" -a -n "$DEFAULT_PROFILE" ]; then
|
||||||
|
enote "Auto-sélection du profil $DEFAULT_PROFILE"
|
||||||
|
PROFILE="$DEFAULT_PROFILE"
|
||||||
|
fi
|
||||||
|
local MANUAL_SETPROFILES=
|
||||||
|
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
|
||||||
|
MANUAL_SETPROFILES=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
|
||||||
|
@ -1466,7 +1562,7 @@ function resolve_dists_profiles() {
|
||||||
fi
|
fi
|
||||||
parse_profile "$profile"
|
parse_profile "$profile"
|
||||||
if [ "$profile" == "$PROFILE" ]; then
|
if [ "$profile" == "$PROFILE" ]; then
|
||||||
# ou matcher uniquement la distribution
|
# ou matcher uniquement le profil
|
||||||
found=1
|
found=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -1475,12 +1571,24 @@ function resolve_dists_profiles() {
|
||||||
[ -n "$found" ] || die "$PROFILE: profil invalide"
|
[ -n "$found" ] || die "$PROFILE: profil invalide"
|
||||||
# forcer à ne construire que cette distribution
|
# forcer à ne construire que cette distribution
|
||||||
PROFILES=("$PROFILE")
|
PROFILES=("$PROFILE")
|
||||||
|
elif [ -n "$ALL_PROFILES" ]; then
|
||||||
|
# prendre tous les profils comme indiqué
|
||||||
|
for profile in "${SETPROFILES[@]}"; do
|
||||||
|
parse_profile "$profile"
|
||||||
|
PROFILES+=("$profile")
|
||||||
|
done
|
||||||
else
|
else
|
||||||
PROFILES=("${SETPROFILES[@]}")
|
# prendre le profil par défaut
|
||||||
|
parse_profile "${SETPROFILES[0]}"
|
||||||
|
PROFILES=("$profile")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
load_dkbuild
|
load_dkbuild
|
||||||
|
|
||||||
|
if [ -n "$MANUAL_SETPROFILES" ]; then
|
||||||
|
setprofiles "$PROFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
## Si pas de distribution ou de profil, remplacer par valeur vide
|
## Si pas de distribution ou de profil, remplacer par valeur vide
|
||||||
if [ ${#DISTS[*]} -eq 0 ]; then
|
if [ ${#DISTS[*]} -eq 0 ]; then
|
||||||
SETDISTS=("")
|
SETDISTS=("")
|
||||||
|
@ -1810,6 +1918,7 @@ function define_functions_cmd() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ -n "${DEFAULTS[build_build]-1}" ] || return 0
|
||||||
[ -n "$output" ] || die "genfile: Vous devez spécifier le fichier en sortie"
|
[ -n "$output" ] || die "genfile: Vous devez spécifier le fichier en sortie"
|
||||||
if [ -n "$context" ]; then
|
if [ -n "$context" ]; then
|
||||||
mkdir -p "$context" || die
|
mkdir -p "$context" || die
|
||||||
|
@ -1845,6 +1954,7 @@ function define_functions_cmd() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ -n "${DEFAULTS[build_build]-1}" ] || return 0
|
||||||
[ -n "$DOCKERFILE" ] || DOCKERFILE=Dockerfile
|
[ -n "$DOCKERFILE" ] || DOCKERFILE=Dockerfile
|
||||||
DOCKERCONTEXT=.
|
DOCKERCONTEXT=.
|
||||||
if [ -n "$context" ]; then
|
if [ -n "$context" ]; then
|
||||||
|
@ -1868,6 +1978,7 @@ function define_functions_cmd() {
|
||||||
function add2dockerfile() {
|
function add2dockerfile() {
|
||||||
edebug "$(qvals "$@")"
|
edebug "$(qvals "$@")"
|
||||||
|
|
||||||
|
[ -n "${DEFAULTS[build_build]-1}" ] || return 0
|
||||||
[ -n "$DOCKERFILE" ] || return
|
[ -n "$DOCKERFILE" ] || return
|
||||||
echo "$*" >>"$DOCKERFILE"
|
echo "$*" >>"$DOCKERFILE"
|
||||||
}
|
}
|
||||||
|
@ -1941,6 +2052,14 @@ function define_functions_cmd() {
|
||||||
imagetags+=("$imagetag")
|
imagetags+=("$imagetag")
|
||||||
else
|
else
|
||||||
for tag in "${set_tags[@]}" "${add_tags[@]}"; do
|
for tag in "${set_tags[@]}" "${add_tags[@]}"; do
|
||||||
|
if [ "$tag" == LATEST ]; then
|
||||||
|
if [ -n "$HAVE_VERSION" -a "$VERSION" == "$LAST_VERSION" ]; then
|
||||||
|
tag=latest
|
||||||
|
else
|
||||||
|
# ignorer le tag LATEST s'il n'est pas applicable
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
imagetags+=("$imagetag:$tag")
|
imagetags+=("$imagetag:$tag")
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -1953,10 +2072,16 @@ function define_functions_cmd() {
|
||||||
imagetags+=("$imagetag")
|
imagetags+=("$imagetag")
|
||||||
else
|
else
|
||||||
for tag in "${add_tags[@]}"; do
|
for tag in "${add_tags[@]}"; do
|
||||||
|
if [ "$tag" == LATEST ]; then
|
||||||
|
# toujours ignorer le tag LATEST dans add_tags
|
||||||
|
continue
|
||||||
|
fi
|
||||||
imagetags+=("$imagetag:$tag")
|
imagetags+=("$imagetag:$tag")
|
||||||
done
|
done
|
||||||
[ -n "$VERSION" ] && imagetags+=("$imagetag:$VERSION-$DIST")
|
[ -n "$VERSION" ] && imagetags+=("$imagetag:$VERSION-$DIST")
|
||||||
[ -n "$DIST" -a -z "$HAVE_VERSION" ] && imagetags+=("$imagetag:$DIST")
|
if [ -n "$DIST" -a "$DIST" != none -a -z "$HAVE_VERSION" ]; then
|
||||||
|
imagetags+=("$imagetag:$DIST")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -1965,7 +2090,7 @@ function define_functions_cmd() {
|
||||||
if [ -z "$HAVE_VERSION" ]; then
|
if [ -z "$HAVE_VERSION" ]; then
|
||||||
dist LATEST && imagetags+=("$imagetag:latest")
|
dist LATEST && imagetags+=("$imagetag:latest")
|
||||||
elif [ "$VERSION" == "$LAST_VERSION" ]; then
|
elif [ "$VERSION" == "$LAST_VERSION" ]; then
|
||||||
imagetags+=("$imagetag:$DIST")
|
[ "$DIST" != none ] && imagetags+=("$imagetag:$DIST")
|
||||||
dist LATEST && imagetags+=("$imagetag:latest")
|
dist LATEST && imagetags+=("$imagetag:latest")
|
||||||
fi
|
fi
|
||||||
elif [ -n "$PROFILE" ]; then
|
elif [ -n "$PROFILE" ]; then
|
||||||
|
@ -1978,6 +2103,7 @@ function define_functions_cmd() {
|
||||||
local avar
|
local avar
|
||||||
local -a args; args=(
|
local -a args; args=(
|
||||||
${no_cache:+--no-cache}
|
${no_cache:+--no-cache}
|
||||||
|
${progress:+--progress "$progress"}
|
||||||
${pull:+--pull}
|
${pull:+--pull}
|
||||||
)
|
)
|
||||||
eval "host_mappings=($host_mappings)"
|
eval "host_mappings=($host_mappings)"
|
||||||
|
@ -2015,6 +2141,7 @@ function define_functions_cmd() {
|
||||||
function cbuild() {
|
function cbuild() {
|
||||||
edebug "cbuild $(qvals "$@")"
|
edebug "cbuild $(qvals "$@")"
|
||||||
|
|
||||||
|
local build="${DEFAULTS[build_build]-1}"
|
||||||
local files="${DEFAULTS[cbuild_files]}"
|
local files="${DEFAULTS[cbuild_files]}"
|
||||||
local project_name="${DEFAULTS[cbuild_project-name]}"
|
local project_name="${DEFAULTS[cbuild_project-name]}"
|
||||||
local no_cache="${DEFAULTS[cbuild_no-cache]}"
|
local no_cache="${DEFAULTS[cbuild_no-cache]}"
|
||||||
|
@ -2033,6 +2160,7 @@ function define_functions_cmd() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ -n "$build" ] || return
|
||||||
if [ -n "$files" ]; then
|
if [ -n "$files" ]; then
|
||||||
eval "files=($files)"
|
eval "files=($files)"
|
||||||
else
|
else
|
||||||
|
@ -2059,6 +2187,7 @@ function define_functions_cmd() {
|
||||||
local avar evar; local -a bargs
|
local avar evar; local -a bargs
|
||||||
bargs=(
|
bargs=(
|
||||||
${no_cache:+--no-cache}
|
${no_cache:+--no-cache}
|
||||||
|
${progress:+--progress "$progress"}
|
||||||
${pull:+--pull}
|
${pull:+--pull}
|
||||||
)
|
)
|
||||||
for avar in "${!ARGS[@]}"; do
|
for avar in "${!ARGS[@]}"; do
|
||||||
|
@ -2129,6 +2258,7 @@ function define_functions_cmd() {
|
||||||
-e group="$group"
|
-e group="$group"
|
||||||
-e projdir="$projdir"
|
-e projdir="$projdir"
|
||||||
-e setup="$setup"
|
-e setup="$setup"
|
||||||
|
-e setup_image="$setup_image"
|
||||||
-e composer="$composer"
|
-e composer="$composer"
|
||||||
-e args="$args"
|
-e args="$args"
|
||||||
)
|
)
|
||||||
|
@ -2158,32 +2288,33 @@ fi
|
||||||
|
|
||||||
if [ -n "$setup" ]; then
|
if [ -n "$setup" ]; then
|
||||||
local project_name container_name ctid
|
local project_name container_name ctid
|
||||||
|
local setup_image="$setup_image"
|
||||||
|
|
||||||
# lancement dans un container docker à préparer
|
# lancement dans un container docker à préparer
|
||||||
[ -n "$project_name" ] || setx project_name=get_project_name
|
[ -n "$project_name" ] || setx project_name=get_project_name
|
||||||
setx container_name=get_container_name "$project_name"
|
setx container_name=get_container_name "$project_name"
|
||||||
container_name="dkbuild_composer_${container_name}"
|
[ -n "$setup_image" ] || setup_image="dkbuild_composer_${container_name}_image"
|
||||||
|
|
||||||
# vérifier l'existence de l'image
|
# vérifier l'existence de l'image
|
||||||
setx ctid=docker image ls --format '{{.ID}}' "${container_name}_image"
|
setx ctid=docker image ls --format '{{.ID}}' "$setup_image"
|
||||||
|
|
||||||
# créer le container le cas échéant
|
# créer le container le cas échéant
|
||||||
if [ -z "$ctid" ]; then
|
if [ -z "$ctid" ]; then
|
||||||
estep "Création du container $container_name à partir de l'image $image"
|
estep "Création de l'image $setup_image à partir de $image"
|
||||||
cmd=(
|
cmd=(
|
||||||
docker create -it --name "${container_name}_ct"
|
docker create -it --name "${setup_image}_tmpct"
|
||||||
"${basecmd[@]}"
|
"${basecmd[@]}"
|
||||||
"$image"
|
"$image"
|
||||||
bash -c "$setupscript"
|
bash -c "$setupscript"
|
||||||
)
|
)
|
||||||
setx ctid="${cmd[@]}" &&
|
setx ctid="${cmd[@]}" &&
|
||||||
docker container start -ai "$ctid" &&
|
docker container start -ai "$ctid" &&
|
||||||
docker container commit "$ctid" "${container_name}_image" &&
|
docker container commit "$ctid" "$setup_image" &&
|
||||||
docker container rm "$ctid" || die
|
docker container rm "$ctid" || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prendre comme image le container créé
|
# prendre comme image le container créé
|
||||||
image="${container_name}_image"
|
image="$setup_image"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
|
@ -2232,8 +2363,29 @@ fi
|
||||||
[ "$host_mappings" == __UNDEFINED__ ] && host_mappings="${DEFAULTS[docker_host-mappings]}"
|
[ "$host_mappings" == __UNDEFINED__ ] && host_mappings="${DEFAULTS[docker_host-mappings]}"
|
||||||
local composer="${DEFAULTS[composer_composer]}"
|
local composer="${DEFAULTS[composer_composer]}"
|
||||||
local setup="${DEFAULTS[composer_setup]}"
|
local setup="${DEFAULTS[composer_setup]}"
|
||||||
|
local setup_image="${DEFAULTS[composer_setup-image]}"
|
||||||
local project_name="${DEFAULTS[composer_project-name]}"
|
local project_name="${DEFAULTS[composer_project-name]}"
|
||||||
if [ -f "$destdir/.composer.conf" ]; then
|
if [ -f "$destdir/.composer.yaml" ]; then
|
||||||
|
eval "$(
|
||||||
|
COMPOSER_PHP=
|
||||||
|
COMPOSER_PHP_MAX=
|
||||||
|
COMPOSER_IMAGE="$COMPOSER_IMAGE"
|
||||||
|
COMPOSER_SETUP=
|
||||||
|
COMPOSER_SETUP_IMAGE=
|
||||||
|
eval "$(<"$destdir/.composer.yaml" grep ^composer_ |
|
||||||
|
sed 's/^composer_php_min: /COMPOSER_PHP=/
|
||||||
|
s/^composer_php_max: /COMPOSER_PHP_MAX=/
|
||||||
|
s/^composer_registry: /registry=/
|
||||||
|
s/^composer_image: \(.*\)/COMPOSER_IMAGE="${registry:-$REGISTRY}\/\1"/
|
||||||
|
s/^composer_setup: /COMPOSER_SETUP=/
|
||||||
|
s/^composer_setup_image: /COMPOSER_SETUP_IMAGE=/')"
|
||||||
|
[ -z "$php" ] && echo_setv php="$COMPOSER_PHP"
|
||||||
|
[ -z "$php_max" ] && echo_setv php_max="$COMPOSER_PHP_MAX"
|
||||||
|
[ -z "$image" ] && echo_setv image="$COMPOSER_IMAGE"
|
||||||
|
[ -z "$setup" ] && echo_setv setup="$COMPOSER_SETUP"
|
||||||
|
[ -z "$setup_image" ] && echo_setv setup_image="$COMPOSER_SETUP_IMAGE"
|
||||||
|
)"
|
||||||
|
elif [ -f "$destdir/.composer.conf" ]; then
|
||||||
eval "$(
|
eval "$(
|
||||||
COMPOSER_PHP=
|
COMPOSER_PHP=
|
||||||
COMPOSER_PHP_MAX=
|
COMPOSER_PHP_MAX=
|
||||||
|
@ -2241,6 +2393,7 @@ fi
|
||||||
COMPOSER_MACHINE=-u
|
COMPOSER_MACHINE=-u
|
||||||
COMPOSER_CMD=
|
COMPOSER_CMD=
|
||||||
COMPOSER_SETUP=
|
COMPOSER_SETUP=
|
||||||
|
COMPOSER_SETUP_IMAGE=
|
||||||
source "$destdir/.composer.conf"
|
source "$destdir/.composer.conf"
|
||||||
[ -z "$php" ] && echo_setv php="$COMPOSER_PHP"
|
[ -z "$php" ] && echo_setv php="$COMPOSER_PHP"
|
||||||
[ -z "$php_max" ] && echo_setv php_max="$COMPOSER_PHP_MAX"
|
[ -z "$php_max" ] && echo_setv php_max="$COMPOSER_PHP_MAX"
|
||||||
|
@ -2248,6 +2401,7 @@ fi
|
||||||
[ -z "$machine" ] && echo_setv machine="$COMPOSER_MACHINE"
|
[ -z "$machine" ] && echo_setv machine="$COMPOSER_MACHINE"
|
||||||
[ -z "$composer" ] && echo_setv composer="$COMPOSER_CMD"
|
[ -z "$composer" ] && echo_setv composer="$COMPOSER_CMD"
|
||||||
[ -z "$setup" ] && echo_setv setup="$COMPOSER_SETUP"
|
[ -z "$setup" ] && echo_setv setup="$COMPOSER_SETUP"
|
||||||
|
[ -z "$setup_image" ] && echo_setv setup_image="$COMPOSER_SETUP_IMAGE"
|
||||||
)"
|
)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2263,6 +2417,7 @@ fi
|
||||||
host-mappings=*) host_mappings="${1#host-mappings=}";;
|
host-mappings=*) host_mappings="${1#host-mappings=}";;
|
||||||
composer=*) composer="${1#composer=}";;
|
composer=*) composer="${1#composer=}";;
|
||||||
setup=*) setup="${1#setup=}";;
|
setup=*) setup="${1#setup=}";;
|
||||||
|
setup-image=*) setup_image="${1#setup-image=}";;
|
||||||
project-name=*) project_name="${1#project-name=}";;
|
project-name=*) project_name="${1#project-name=}";;
|
||||||
*=*) ewarn "composer: $1: argument ignoré";;
|
*=*) ewarn "composer: $1: argument ignoré";;
|
||||||
*) break;;
|
*) break;;
|
||||||
|
@ -2351,7 +2506,7 @@ exit((PHP_VERSION_ID < $version)? 0: 1);
|
||||||
function _local_mvn() {
|
function _local_mvn() {
|
||||||
if [ -n "$java" ]; then
|
if [ -n "$java" ]; then
|
||||||
urequire java
|
urequire java
|
||||||
select_java_exact "$java" || die
|
select_java_exact "$java" || die "mvn: Java $java introuvable"
|
||||||
export MVN_JAVA_VERSION="$java"
|
export MVN_JAVA_VERSION="$java"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2428,6 +2583,7 @@ exit((PHP_VERSION_ID < $version)? 0: 1);
|
||||||
-e group="$group"
|
-e group="$group"
|
||||||
-e projdir="$projdir"
|
-e projdir="$projdir"
|
||||||
-e setup="$setup"
|
-e setup="$setup"
|
||||||
|
-e setup_image="$setup_image"
|
||||||
-e mvn="$mvn"
|
-e mvn="$mvn"
|
||||||
-e args="$args"
|
-e args="$args"
|
||||||
${java:+-e JAVA="$java"}
|
${java:+-e JAVA="$java"}
|
||||||
|
@ -2453,32 +2609,33 @@ cd "$projdir"
|
||||||
|
|
||||||
if [ -n "$setup" ]; then
|
if [ -n "$setup" ]; then
|
||||||
local project_name container_name ctid
|
local project_name container_name ctid
|
||||||
|
local setup_image="$setup_image"
|
||||||
|
|
||||||
# lancement dans un container docker à préparer
|
# lancement dans un container docker à préparer
|
||||||
[ -n "$project_name" ] || setx project_name=get_project_name
|
[ -n "$project_name" ] || setx project_name=get_project_name
|
||||||
setx container_name=get_container_name "$project_name"
|
setx container_name=get_container_name "$project_name"
|
||||||
container_name="dkbuild_maven_${container_name}"
|
[ -n "$setup_image" ] || setup_image="dkbuild_maven_${container_name}_image"
|
||||||
|
|
||||||
# vérifier l'existence de l'image
|
# vérifier l'existence de l'image
|
||||||
setx ctid=docker image ls --format '{{.ID}}' "${container_name}_image"
|
setx ctid=docker image ls --format '{{.ID}}' "$setup_image"
|
||||||
|
|
||||||
# créer le container le cas échéant
|
# créer le container le cas échéant
|
||||||
if [ -z "$ctid" ]; then
|
if [ -z "$ctid" ]; then
|
||||||
estep "Création du container $container_name à partir de l'image $image"
|
estep "Création de l'image $setup_image à partir de $image"
|
||||||
cmd=(
|
cmd=(
|
||||||
docker create -it --name "${container_name}_ct"
|
docker create -it --name "${setup_image}_tmpct"
|
||||||
"${basecmd[@]}"
|
"${basecmd[@]}"
|
||||||
"$image"
|
"$image"
|
||||||
bash -c "$setupscript"
|
bash -c "$setupscript"
|
||||||
)
|
)
|
||||||
setx ctid="${cmd[@]}" &&
|
setx ctid="${cmd[@]}" &&
|
||||||
docker container start -ai "$ctid" &&
|
docker container start -ai "$ctid" &&
|
||||||
docker container commit "$ctid" "${container_name}_image" &&
|
docker container commit "$ctid" "$setup_image" &&
|
||||||
docker container rm "$ctid" || die
|
docker container rm "$ctid" || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prendre comme image le container créé
|
# prendre comme image le container créé
|
||||||
image="${container_name}_image"
|
image="$setup_image"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
|
@ -2523,6 +2680,7 @@ cd "$projdir"
|
||||||
[ "$host_mappings" == __UNDEFINED__ ] && host_mappings="${DEFAULTS[docker_host-mappings]}"
|
[ "$host_mappings" == __UNDEFINED__ ] && host_mappings="${DEFAULTS[docker_host-mappings]}"
|
||||||
local mvn="${DEFAULTS[mvn_mvn]}"
|
local mvn="${DEFAULTS[mvn_mvn]}"
|
||||||
local setup="${DEFAULTS[mvn_setup]}"
|
local setup="${DEFAULTS[mvn_setup]}"
|
||||||
|
local setup_image="${DEFAULTS[mvn_setup-image]}"
|
||||||
local project_name="${DEFAULTS[mvn_project-name]}"
|
local project_name="${DEFAULTS[mvn_project-name]}"
|
||||||
if [ -f "$destdir/.maven.conf" ]; then
|
if [ -f "$destdir/.maven.conf" ]; then
|
||||||
eval "$(
|
eval "$(
|
||||||
|
@ -2531,12 +2689,14 @@ cd "$projdir"
|
||||||
MAVEN_MACHINE=-u
|
MAVEN_MACHINE=-u
|
||||||
MAVEN_CMD=
|
MAVEN_CMD=
|
||||||
MAVEN_SETUP=
|
MAVEN_SETUP=
|
||||||
|
MAVEN_SETUP_IMAGE=
|
||||||
source "$destdir/.maven.conf"
|
source "$destdir/.maven.conf"
|
||||||
[ -z "$java" ] && echo_setv java="$MAVEN_JAVA"
|
[ -z "$java" ] && echo_setv java="$MAVEN_JAVA"
|
||||||
[ -z "$image" ] && echo_setv image="$MAVEN_IMAGE"
|
[ -z "$image" ] && echo_setv image="$MAVEN_IMAGE"
|
||||||
[ -z "$machine" ] && echo_setv machine="$MAVEN_MACHINE"
|
[ -z "$machine" ] && echo_setv machine="$MAVEN_MACHINE"
|
||||||
[ -z "$mvn" ] && echo_setv mvn="$MAVEN_CMD"
|
[ -z "$mvn" ] && echo_setv mvn="$MAVEN_CMD"
|
||||||
[ -z "$setup" ] && echo_setv setup="$MAVEN_SETUP"
|
[ -z "$setup" ] && echo_setv setup="$MAVEN_SETUP"
|
||||||
|
[ -z "$setup_image" ] && echo_setv setup_image="$MAVEN_SETUP_IMAGE"
|
||||||
)"
|
)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2551,6 +2711,7 @@ cd "$projdir"
|
||||||
host-mappings=*) host_mappings="${1#host-mappings=}";;
|
host-mappings=*) host_mappings="${1#host-mappings=}";;
|
||||||
mvn=*) mvn="${1#mvn=}";;
|
mvn=*) mvn="${1#mvn=}";;
|
||||||
setup=*) setup="${1#setup=}";;
|
setup=*) setup="${1#setup=}";;
|
||||||
|
setup-image=*) setup_image="${1#setup-image=}";;
|
||||||
project-name=*) project_name="${1#project-name=}";;
|
project-name=*) project_name="${1#project-name=}";;
|
||||||
*=*) ewarn "mvn: $1: argument ignoré";;
|
*=*) ewarn "mvn: $1: argument ignoré";;
|
||||||
*) break;;
|
*) break;;
|
||||||
|
@ -2632,9 +2793,10 @@ cd "$projdir"
|
||||||
}
|
}
|
||||||
function runb() {
|
function runb() {
|
||||||
local build="${DEFAULTS[build_build]-1}"
|
local build="${DEFAULTS[build_build]-1}"
|
||||||
if [ -n "$build" ]; then
|
if [ -z "$build" ]; then
|
||||||
run "$@"
|
[ $# -eq 0 ] && return 1 || return 0
|
||||||
fi
|
fi
|
||||||
|
run "$@"
|
||||||
}
|
}
|
||||||
function call() {
|
function call() {
|
||||||
edebug "call $(qvals "$@")"
|
edebug "call $(qvals "$@")"
|
||||||
|
@ -2644,9 +2806,10 @@ cd "$projdir"
|
||||||
}
|
}
|
||||||
function callb() {
|
function callb() {
|
||||||
local build="${DEFAULTS[build_build]-1}"
|
local build="${DEFAULTS[build_build]-1}"
|
||||||
if [ -n "$build" ]; then
|
if [ -z "$build" ]; then
|
||||||
call "$@"
|
[ $# -eq 0 ] && return 1 || return 0
|
||||||
fi
|
fi
|
||||||
|
call "$@"
|
||||||
}
|
}
|
||||||
function dkbuild() {
|
function dkbuild() {
|
||||||
edebug "dkbuild $(qvals "$@")"
|
edebug "dkbuild $(qvals "$@")"
|
||||||
|
@ -2762,12 +2925,16 @@ function build_action() {
|
||||||
eval "$SHARED_LOCALS1; $SHARED_LOCALS2"
|
eval "$SHARED_LOCALS1; $SHARED_LOCALS2"
|
||||||
local action=build
|
local action=build
|
||||||
local machine
|
local machine
|
||||||
|
local clean_update clean_opt=-X
|
||||||
local clone_src_only update_src_only update_src sync_src
|
local clone_src_only update_src_only update_src sync_src
|
||||||
local build no_cache pull_image
|
local build no_cache progress pull_image
|
||||||
local push_image
|
local push_image
|
||||||
local -a args; args=(
|
local -a args; args=(
|
||||||
"${SHARED_ARGS1[@]}" "${SHARED_ARGS2[@]}"
|
"${SHARED_ARGS1[@]}" "${SHARED_ARGS2[@]}"
|
||||||
-m:,--machine: machine=
|
-m:,--machine: machine=
|
||||||
|
-u,--clean-update clean_update=1
|
||||||
|
-X,--clean-ignored clean_opt=-X
|
||||||
|
-x,--clean-untracked clean_opt=-x
|
||||||
--clone-src-only clone_src_only=1
|
--clone-src-only clone_src_only=1
|
||||||
--update-src-only update_src_only=1
|
--update-src-only update_src_only=1
|
||||||
--update-src update_src=1
|
--update-src update_src=1
|
||||||
|
@ -2777,7 +2944,8 @@ function build_action() {
|
||||||
--no-sync-src sync_src=no
|
--no-sync-src sync_src=no
|
||||||
-b,--build build=1
|
-b,--build build=1
|
||||||
--no-cache no_cache=1
|
--no-cache no_cache=1
|
||||||
-u,--pull-image pull_image=1
|
--plain-output progress=plain
|
||||||
|
-U,--pull-image pull_image=1
|
||||||
-p,--push-image push_image=1
|
-p,--push-image push_image=1
|
||||||
)
|
)
|
||||||
parse_args "$@"; set -- "${args[@]}"
|
parse_args "$@"; set -- "${args[@]}"
|
||||||
|
@ -2788,12 +2956,16 @@ function build_action() {
|
||||||
action=update_src
|
action=update_src
|
||||||
else
|
else
|
||||||
action=build
|
action=build
|
||||||
[ -n "$update_src" ] || update_src=1
|
if [ -z "$clean_update" -a -z "$sync_src" -a -z "$build" -a -z "$push_image" ]; then
|
||||||
[ "$update_src" == no ] && update_src=
|
|
||||||
if [ -z "$sync_src" -a -z "$build" -a -z "$push_image" ]; then
|
|
||||||
sync_src=1
|
sync_src=1
|
||||||
build=1
|
build=1
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$build" ]; then
|
||||||
|
[ -n "$update_src" ] || update_src=1
|
||||||
|
[ "$update_src" == no ] && update_src=
|
||||||
|
else
|
||||||
|
update_src=
|
||||||
|
fi
|
||||||
[ "$sync_src" == no ] && sync_src=
|
[ "$sync_src" == no ] && sync_src=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2806,6 +2978,17 @@ function build_action() {
|
||||||
setarg "${TMPARGS[@]}"
|
setarg "${TMPARGS[@]}"
|
||||||
setarg "$@"
|
setarg "$@"
|
||||||
|
|
||||||
|
if [ -n "$clean_update" ]; then
|
||||||
|
edebug "clean"
|
||||||
|
_clean_git_clean -f || die
|
||||||
|
|
||||||
|
edebug "update"
|
||||||
|
git pull || die
|
||||||
|
|
||||||
|
edebug "sync"
|
||||||
|
[ -n "$build" ] && sync_src=1
|
||||||
|
fi
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
clone_src)
|
clone_src)
|
||||||
die "Pas encore implémenté" #XXX
|
die "Pas encore implémenté" #XXX
|
||||||
|
@ -2830,10 +3013,10 @@ function _build_before() {
|
||||||
PREV_PROFILE=
|
PREV_PROFILE=
|
||||||
}
|
}
|
||||||
function _build_each() {
|
function _build_each() {
|
||||||
if [ "$PROFILE-$PVERSION" != "$PREV_PROFILE" ]; then
|
|
||||||
[ -n "$PREV_PROFILE" ] && eend
|
|
||||||
fi
|
|
||||||
if [ -n "$DIST" -a "$DIST-$DVERSION" != "$PREV_DIST" ]; then
|
if [ -n "$DIST" -a "$DIST-$DVERSION" != "$PREV_DIST" ]; then
|
||||||
|
[ -n "$PREV_PROFILE" ] && eend
|
||||||
|
PREV_PROFILE=
|
||||||
|
|
||||||
[ -n "$PREV_DIST" ] && eend
|
[ -n "$PREV_DIST" ] && eend
|
||||||
PREV_DIST="$DIST-$DVERSION"
|
PREV_DIST="$DIST-$DVERSION"
|
||||||
etitle "Distribution ${DVERSION:+$DVERSION-}$DIST"
|
etitle "Distribution ${DVERSION:+$DVERSION-}$DIST"
|
||||||
|
@ -2861,7 +3044,7 @@ function _build_after() {
|
||||||
## clean
|
## clean
|
||||||
|
|
||||||
function _clean_git_clean() {
|
function _clean_git_clean() {
|
||||||
LANG=C git clean -d $opt "$@" |
|
LANG=C git clean -d $clean_opt "$@" |
|
||||||
grep -vE '^(Would skip|Skipping) ' |
|
grep -vE '^(Would skip|Skipping) ' |
|
||||||
sed -r 's/^Would remove //'
|
sed -r 's/^Would remove //'
|
||||||
}
|
}
|
||||||
|
@ -2873,16 +3056,16 @@ function _clean_git_status() {
|
||||||
|
|
||||||
function clean_action() {
|
function clean_action() {
|
||||||
eval "$SHARED_LOCALS1"
|
eval "$SHARED_LOCALS1"
|
||||||
local opt=-X all=
|
local clean_opt=-X all=
|
||||||
local -a args; args=(
|
local -a args; args=(
|
||||||
"${SHARED_ARGS1[@]}"
|
"${SHARED_ARGS1[@]}"
|
||||||
-X,--ignored opt=-X
|
-X,--ignored clean_opt=-X
|
||||||
-x,--untracked opt=-x
|
-x,--untracked clean_opt=-x
|
||||||
-a,--all all=1
|
-a,--all all=1
|
||||||
)
|
)
|
||||||
parse_args "$@"; set -- "${args[@]}"
|
parse_args "$@"; set -- "${args[@]}"
|
||||||
|
|
||||||
[ -n "$all" ] && opt=-x
|
[ -n "$all" ] && clean_opt=-x
|
||||||
|
|
||||||
edebug "clean_action"
|
edebug "clean_action"
|
||||||
ensure_projdir
|
ensure_projdir
|
||||||
|
@ -2975,10 +3158,10 @@ function _dump_before() {
|
||||||
PREV_PROFILE=
|
PREV_PROFILE=
|
||||||
}
|
}
|
||||||
function _dump_each() {
|
function _dump_each() {
|
||||||
if [ "$PROFILE-$PVERSION" != "$PREV_PROFILE" ]; then
|
|
||||||
[ -n "$PREV_PROFILE" ] && eend
|
|
||||||
fi
|
|
||||||
if [ -n "$DIST" -a "$DIST-$DVERSION" != "$PREV_DIST" ]; then
|
if [ -n "$DIST" -a "$DIST-$DVERSION" != "$PREV_DIST" ]; then
|
||||||
|
[ -n "$PREV_PROFILE" ] && eend
|
||||||
|
PREV_PROFILE=
|
||||||
|
|
||||||
[ -n "$PREV_DIST" ] && eend
|
[ -n "$PREV_DIST" ] && eend
|
||||||
PREV_DIST="$DIST-$DVERSION"
|
PREV_DIST="$DIST-$DVERSION"
|
||||||
etitle "Distribution ${DVERSION:+$DVERSION-}$DIST"
|
etitle "Distribution ${DVERSION:+$DVERSION-}$DIST"
|
||||||
|
|
4
lgrep
4
lgrep
|
@ -3,10 +3,10 @@
|
||||||
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: frontend de grep pour lire des fichiers encodés en latin1
|
uecho "$scriptname: frontend de grep pour chercher dans un fichier encodé en latin1
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
$scriptname [options] files...
|
$scriptname [options] FILE
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
options de grep qui sont reprises telles quelles"
|
options de grep qui sont reprises telles quelles"
|
||||||
|
|
|
@ -20,10 +20,5 @@
|
||||||
#MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
#MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
||||||
|
|
||||||
# Image à utiliser pour les builds
|
# Image à utiliser pour les builds
|
||||||
#DEFAULT_COMPOSER_IMAGE=docker.univ-reunion.fr/image/phpbuilder:d10
|
#DEFAULT_COMPOSER_IMAGE=pubdocker.univ-reunion.fr/image/php:d11
|
||||||
#DEFAULT_MAVEN_IMAGE=docker.univ-reunion.fr/image/javabuilder:d10
|
#DEFAULT_MAVEN_IMAGE=pubdocker.univ-reunion.fr/image/javabuilder:d11
|
||||||
|
|
||||||
# Mappings d'hôtes à activer pour les builds à base d'image
|
|
||||||
#DEFAULT_HOST_MAPPINGS=()
|
|
||||||
#prod_HOST_MAPPINGS=(docker.univ-reunion.fr:10.82.70.154 repos.univ-reunion.fr:10.82.70.246 git.univ-reunion.fr:10.82.70.247)
|
|
||||||
#test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS}")
|
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
# -*- 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
|
default_profile "${DKBUILD_PROFILE:-prod}"
|
||||||
setenv REGISTRY=docker.univ-reunion.fr
|
|
||||||
else
|
if profile jclain; then
|
||||||
setenv REGISTRY=docker.self
|
setenv REGISTRY=docker.jclain.fr
|
||||||
|
setenv PRIVAREG=docker.jclain.fr
|
||||||
|
elif profile prod test; then
|
||||||
|
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||||
|
setenv PRIVAREG=pridocker.univ-reunion.fr
|
||||||
|
host_mappings=(
|
||||||
|
pridocker.univ-reunion.fr:10.85.1.56
|
||||||
|
pubdocker.univ-reunion.fr:10.85.1.57
|
||||||
|
repos.univ-reunion.fr:10.85.1.57
|
||||||
|
git.univ-reunion.fr:10.85.1.55
|
||||||
|
)
|
||||||
|
default docker host-mappings="${host_mappings[*]}"
|
||||||
|
elif profile devel; then
|
||||||
|
setenv REGISTRY=docker.devel.self
|
||||||
|
setenv PRIVAREG=docker.devel.self
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# -*- 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
|
||||||
setenv REGISTRY=docker.univ-reunion.fr
|
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||||
setenv IMAGE=$REGISTRY/GROUP/NAME
|
setenv IMAGE=$REGISTRY/GROUP/NAME
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# -*- 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
|
||||||
setenv REGISTRY=docker.univ-reunion.fr
|
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||||
setenv IMAGE=$REGISTRY/GROUP/NAME
|
setenv IMAGE=$REGISTRY/GROUP/NAME
|
||||||
setenv DIST=d11
|
setenv DIST=d11
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# -*- 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
|
||||||
setenv REGISTRY=docker.univ-reunion.fr
|
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||||
setenv IMAGE=$REGISTRY/GROUP/NAME
|
setenv IMAGE=$REGISTRY/GROUP/NAME
|
||||||
setenv DIST=d11
|
setenv DIST=d11
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
# tests
|
||||||
|
|
||||||
|
Lancer un test de cette façon
|
||||||
|
~~~sh
|
||||||
|
../../../dkbuild -j test-xxx
|
||||||
|
~~~
|
||||||
|
|
||||||
|
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary
|
|
@ -1,2 +1,2 @@
|
||||||
# -*- 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
|
||||||
setenv REGISTRY=jclain.fr
|
setenv REGISTRY=docker.jclain.fr
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# -*- 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
|
||||||
setenv REGISTRY=docker.univ-reunion.fr
|
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||||
setenv IMAGE=$REGISTRY/group/name
|
setenv IMAGE=$REGISTRY/group/name
|
||||||
|
|
||||||
info "IMAGE=$IMAGE"
|
info "IMAGE=$IMAGE"
|
||||||
if [ "$REGISTRY" == docker.univ-reunion.fr ]; then
|
if [ "$REGISTRY" == pubdocker.univ-reunion.fr ]; then
|
||||||
note "\
|
note "\
|
||||||
Essayer de relancer avec
|
Essayer de relancer avec
|
||||||
$(qvals dkbuild -j "$(relpath "$DKBUILD")" -c registry.env)
|
$(qvals dkbuild -j "$(relpath "$DKBUILD")" -c registry.env)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
setdists v1-d11 v2-d11 v1-d10
|
||||||
|
|
||||||
|
if dist LATEST; then
|
||||||
|
info "$DIST est la distribution la plus récente"
|
||||||
|
fi
|
||||||
|
info "version=$VERSION"
|
||||||
|
|
||||||
|
# pas de build automatique
|
||||||
|
AUTOBUILD=
|
|
@ -0,0 +1,10 @@
|
||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
setprofiles v1-prod v2-prod test
|
||||||
|
|
||||||
|
if profile DEFAULT; then
|
||||||
|
info "$PROFILE est le profil par défaut"
|
||||||
|
fi
|
||||||
|
info "version=$VERSION"
|
||||||
|
|
||||||
|
# pas de build automatique
|
||||||
|
AUTOBUILD=
|
|
@ -14,19 +14,21 @@ 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}
|
||||||
|
|
||||||
# compiler les modules python de support
|
if progexists python2; then
|
||||||
estep "Compilation des modules python"
|
# compiler les modules python de support
|
||||||
progexists python2 && PYTHON=python2 || PYTHON=python
|
estep "Compilation des modules python"
|
||||||
"$PYTHON" -m compileall lib/ulib/support/python
|
PYTHON=python2
|
||||||
#"$PYTHON" -m compileall lib/nulib/python
|
"$PYTHON" -m compileall lib/ulib/support/python
|
||||||
|
#"$PYTHON" -m compileall lib/nulib/python
|
||||||
|
|
||||||
# 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 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
|
||||||
|
@ -66,6 +68,9 @@ if [ "$UINST_LOCAL_PROFILES" != auto ]; then
|
||||||
export UTOOLS_LOCAL_PROFILES=$(qvalr "$UINST_LOCAL_PROFILES")" ~/.nutoolsrc
|
export UTOOLS_LOCAL_PROFILES=$(qvalr "$UINST_LOCAL_PROFILES")" ~/.nutoolsrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# copier .dkbuild.env
|
||||||
|
[ -f ~/.dkbuild.env ] || cp lib/dkbuild/dot-dkbuild.env ~/.dkbuild.env
|
||||||
|
|
||||||
# identification du système
|
# identification du système
|
||||||
echo "##@before *" >lib/profile.d/0nutools
|
echo "##@before *" >lib/profile.d/0nutools
|
||||||
echo_setv UNAME_SYSTEM "$UNAME_SYSTEM" >>lib/profile.d/0nutools
|
echo_setv UNAME_SYSTEM "$UNAME_SYSTEM" >>lib/profile.d/0nutools
|
||||||
|
|
|
@ -5,15 +5,18 @@ source "$ULIBDIR/ulib" || exit 1
|
||||||
urequire DEFAULTS
|
urequire DEFAULTS
|
||||||
|
|
||||||
cd "$scriptdir/../.."
|
cd "$scriptdir/../.."
|
||||||
log=/tmp/nutools-pyulib-install.log
|
|
||||||
etitle -s "Installation des packages python"
|
|
||||||
enote "Le log de l'installation se trouve dans $log"
|
|
||||||
./uinst -y lib/pyulib >&"$log"
|
|
||||||
eend
|
|
||||||
|
|
||||||
# setup.py laisse des fichiers avec les droits de root, et ces fichiers ne
|
if progexists python2; then
|
||||||
# peuvent être supprimés par l'utilisateur qui lance uinst. Les supprimer ici.
|
log=/tmp/nutools-pyulib-install.log
|
||||||
rm -rf lib/pyulib/build
|
etitle -s "Installation des packages python"
|
||||||
|
enote "Le log de l'installation se trouve dans $log"
|
||||||
|
./uinst -y lib/pyulib >&"$log"
|
||||||
|
eend
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
rm -rf lib/pyulib/build
|
||||||
|
fi
|
||||||
|
|
||||||
dest="@@dest@@"
|
dest="@@dest@@"
|
||||||
for i in ulib ulibsh; do
|
for i in ulib ulibsh; do
|
||||||
|
|
|
@ -1424,7 +1424,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}"
|
[ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && name="${name%.sh}"
|
||||||
[ "$name" != "$1" ]
|
[ "$name" != "$1" ]
|
||||||
}
|
}
|
||||||
function extract_archive() {
|
function extract_archive() {
|
||||||
|
@ -1446,7 +1446,7 @@ function extract_archive() {
|
||||||
cd "$destdir"
|
cd "$destdir"
|
||||||
jar xf "$arch" "$@"
|
jar xf "$arch" "$@"
|
||||||
) || return
|
) || return
|
||||||
elif [ "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && endswith "$arch" .sh; then
|
elif [ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && endswith "$arch" .sh; then
|
||||||
(
|
(
|
||||||
arch="$(abspath "$arch")"
|
arch="$(abspath "$arch")"
|
||||||
cd "$destdir"
|
cd "$destdir"
|
||||||
|
@ -1469,7 +1469,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}"
|
[ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && basename="${basename%.sh}"
|
||||||
# résultat
|
# résultat
|
||||||
echo "$basename"
|
echo "$basename"
|
||||||
}
|
}
|
||||||
|
@ -1489,10 +1489,13 @@ 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}"
|
[ -n "$NUTOOLS_SH_ARCHIVE_SUPPORT" ] && appname="${appname%.sh}"
|
||||||
# supprimer la version et afficher
|
# supprimer la version et afficher
|
||||||
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]{5}(_(VA|VSR)[0-9]+)?)$/, vs)) {
|
||||||
|
# version style AMUE, e.g 64070 ou 64070_VA1
|
||||||
|
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]*)?)$/)) {
|
||||||
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)
|
||||||
|
@ -1511,7 +1514,10 @@ function get_archive_versionsuffix() {
|
||||||
# --> -0.1
|
# --> -0.1
|
||||||
local basename="$(get_archive_basename "$1")"
|
local basename="$(get_archive_basename "$1")"
|
||||||
echo "$basename" | awk '{
|
echo "$basename" | awk '{
|
||||||
if (match($0, /([-_.][0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
|
if (match($0, /(-[0-9]{5}(_(VA|VSR)[0-9]+)?)$/, vs)) {
|
||||||
|
# version style AMUE, e.g 64070 ou 64070_VA1
|
||||||
|
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"]
|
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"]
|
||||||
|
@ -1528,7 +1534,10 @@ function get_archive_version() {
|
||||||
# --> 0.1
|
# --> 0.1
|
||||||
local basename="$(get_archive_basename "$1")"
|
local basename="$(get_archive_basename "$1")"
|
||||||
echo "$basename" | awk '{
|
echo "$basename" | awk '{
|
||||||
if (match($0, /[-_.]([0-9]+([-_.][0-9]+)*([a-zA-Z][0-9]*|[-_.][0-9]+[a-zA-Z][0-9]*)?)$/, vs)) {
|
if (match($0, /-([0-9]{5}(_(VA|VSR)[0-9]+)?)$/, vs)) {
|
||||||
|
# version style AMUE, e.g 64070 ou 64070_VA1
|
||||||
|
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"]
|
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"]
|
||||||
|
|
|
@ -154,7 +154,7 @@ function ctmatch_one(ctval, ref, parts, part, i, j, start, end, ste
|
||||||
#print "final: is " ref " ~ " ctval " ? " (ok? "yes": "no") #DEBUG
|
#print "final: is " ref " ~ " ctval " ? " (ok? "yes": "no") #DEBUG
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow, Mok, Hok, domok, monok, dowok) {
|
function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow, Mok, Hok, alldom, domok, monok, alldow, dowok, doxok) {
|
||||||
if (refM == "**ANY**") return 1
|
if (refM == "**ANY**") return 1
|
||||||
|
|
||||||
gsub(/\*/, "0-59", M)
|
gsub(/\*/, "0-59", M)
|
||||||
|
@ -163,16 +163,28 @@ function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow,
|
||||||
gsub(/\*/, "0-23", H)
|
gsub(/\*/, "0-23", H)
|
||||||
Hok = ctmatch_one(H, refH)
|
Hok = ctmatch_one(H, refH)
|
||||||
|
|
||||||
|
alldom = dom == "*"
|
||||||
gsub(/\*/, "1-31", dom)
|
gsub(/\*/, "1-31", dom)
|
||||||
domok = ctmatch_one(dom, refdom)
|
domok = ctmatch_one(dom, refdom)
|
||||||
|
|
||||||
gsub(/\*/, "1-12", mon)
|
gsub(/\*/, "1-12", mon)
|
||||||
monok = ctmatch_one(mon, refmon)
|
monok = ctmatch_one(mon, refmon)
|
||||||
|
|
||||||
|
alldow = dow == "*"
|
||||||
gsub(/\*/, "1-7", dow)
|
gsub(/\*/, "1-7", dow)
|
||||||
dowok = ctmatch_one(dow, refdow)
|
dowok = ctmatch_one(dow, refdow)
|
||||||
|
|
||||||
return Mok && Hok && monok && (domok || dowok)
|
if (alldom && alldow) {
|
||||||
|
doxok = 1
|
||||||
|
} else if (alldom) {
|
||||||
|
doxok = dowok
|
||||||
|
} else if (alldow) {
|
||||||
|
doxok = domok
|
||||||
|
} else {
|
||||||
|
doxok = domok || dowok
|
||||||
|
}
|
||||||
|
|
||||||
|
return Mok && Hok && monok && doxok
|
||||||
}
|
}
|
||||||
function print_cmd(cmd) {
|
function print_cmd(cmd) {
|
||||||
print "__ctexec " quote_value(cmd)
|
print "__ctexec " quote_value(cmd)
|
||||||
|
|
104
lib/ulib/java
104
lib/ulib/java
|
@ -15,6 +15,7 @@ JAVA_VMS6=(); JAVA_HOMES6=()
|
||||||
JAVA_VMS7=(); JAVA_HOMES7=()
|
JAVA_VMS7=(); JAVA_HOMES7=()
|
||||||
JAVA_VMS8=(); JAVA_HOMES8=()
|
JAVA_VMS8=(); JAVA_HOMES8=()
|
||||||
JAVA_VMS11=(); JAVA_HOMES11=()
|
JAVA_VMS11=(); JAVA_HOMES11=()
|
||||||
|
JAVA_VMS17=(); JAVA_HOMES17=()
|
||||||
# versions locales 32 bits
|
# versions locales 32 bits
|
||||||
JAVA32_VMS1_3=(); JAVA32_HOMES1_3=()
|
JAVA32_VMS1_3=(); JAVA32_HOMES1_3=()
|
||||||
JAVA32_VMS1_4=(); JAVA32_HOMES1_4=()
|
JAVA32_VMS1_4=(); JAVA32_HOMES1_4=()
|
||||||
|
@ -23,12 +24,14 @@ JAVA32_VMS6=(); JAVA32_HOMES6=()
|
||||||
JAVA32_VMS7=(); JAVA32_HOMES7=()
|
JAVA32_VMS7=(); JAVA32_HOMES7=()
|
||||||
JAVA32_VMS8=(); JAVA32_HOMES8=()
|
JAVA32_VMS8=(); JAVA32_HOMES8=()
|
||||||
JAVA32_VMS11=(); JAVA32_HOMES11=()
|
JAVA32_VMS11=(); JAVA32_HOMES11=()
|
||||||
|
JAVA32_VMS17=(); JAVA32_HOMES17=()
|
||||||
# versions locales 64 bits
|
# versions locales 64 bits
|
||||||
JAVA64_VMS5=(); JAVA64_HOMES5=()
|
JAVA64_VMS5=(); JAVA64_HOMES5=()
|
||||||
JAVA64_VMS6=(); JAVA64_HOMES6=()
|
JAVA64_VMS6=(); JAVA64_HOMES6=()
|
||||||
JAVA64_VMS7=(); JAVA64_HOMES7=()
|
JAVA64_VMS7=(); JAVA64_HOMES7=()
|
||||||
JAVA64_VMS8=(); JAVA64_HOMES8=()
|
JAVA64_VMS8=(); JAVA64_HOMES8=()
|
||||||
JAVA64_VMS11=(); JAVA64_HOMES11=()
|
JAVA64_VMS11=(); JAVA64_HOMES11=()
|
||||||
|
JAVA64_VMS17=(); JAVA64_HOMES17=()
|
||||||
# version sélectionnée
|
# version sélectionnée
|
||||||
SELECTED_JAVA_VM=; SELECTED_JAVA_HOME=
|
SELECTED_JAVA_VM=; SELECTED_JAVA_HOME=
|
||||||
SELECTED_JAVA=; SELECTED_JAVAC=
|
SELECTED_JAVA=; SELECTED_JAVAC=
|
||||||
|
@ -109,6 +112,14 @@ function __java_compute_vms() {
|
||||||
__java_add HOMES8 "$HOME/opt/jvm64/$vm" 64
|
__java_add HOMES8 "$HOME/opt/jvm64/$vm" 64
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
array_from_lines vms "$(list_dirs "$HOME/opt/jvm64" jdk17)"
|
||||||
|
for vm in "${vms[@]}"; do
|
||||||
|
v="${vm#jdk}"
|
||||||
|
if [ "$v" == 17 ]; then
|
||||||
|
__java_add VMS17 "$vm" 64
|
||||||
|
__java_add HOMES17 "$HOME/opt/jvm64/$vm" 64
|
||||||
|
fi
|
||||||
|
done
|
||||||
array_from_lines vms "$(list_dirs "$HOME/opt/jvm64" jdk11)"
|
array_from_lines vms "$(list_dirs "$HOME/opt/jvm64" jdk11)"
|
||||||
for vm in "${vms[@]}"; do
|
for vm in "${vms[@]}"; do
|
||||||
v="${vm#jdk}"
|
v="${vm#jdk}"
|
||||||
|
@ -142,6 +153,11 @@ function __java_compute_vms() {
|
||||||
__java_add VMS11 "$vm" 64
|
__java_add VMS11 "$vm" 64
|
||||||
__java_add HOMES11 "$HOME/opt/jvm64/$vm" 64
|
__java_add HOMES11 "$HOME/opt/jvm64/$vm" 64
|
||||||
done
|
done
|
||||||
|
array_from_lines vms "$(list_dirs "$HOME/opt/jvm64" "jdk-17.*" | LANG=C sort -r)"
|
||||||
|
for vm in "${vms[@]}"; do
|
||||||
|
__java_add VMS17 "$vm" 64
|
||||||
|
__java_add HOMES17 "$HOME/opt/jvm64/$vm" 64
|
||||||
|
done
|
||||||
# Puis chercher dans les JVMs installées manuellement dans ~/opt
|
# Puis chercher dans les JVMs installées manuellement dans ~/opt
|
||||||
array_from_lines vms "$(list_dirs "$HOME/opt" "sun-jdk-*")"
|
array_from_lines vms "$(list_dirs "$HOME/opt" "sun-jdk-*")"
|
||||||
for vm in "${vms[@]}"; do
|
for vm in "${vms[@]}"; do
|
||||||
|
@ -171,6 +187,14 @@ function __java_compute_vms() {
|
||||||
__java_add HOMES11 "$HOME/opt/$vm"
|
__java_add HOMES11 "$HOME/opt/$vm"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
array_from_lines vms "$(list_dirs "$HOME/opt" jdk17)"
|
||||||
|
for vm in "${vms[@]}"; do
|
||||||
|
v="${vm#jdk}"
|
||||||
|
if [ "$v" == 17 ]; then
|
||||||
|
__java_add VMS17 "$vm"
|
||||||
|
__java_add HOMES17 "$HOME/opt/$vm"
|
||||||
|
fi
|
||||||
|
done
|
||||||
array_from_lines vms "$(list_dirs "$HOME/opt" "j2sdk1.4.2*" | LANG=C sort -r)"
|
array_from_lines vms "$(list_dirs "$HOME/opt" "j2sdk1.4.2*" | LANG=C sort -r)"
|
||||||
for vm in "${vms[@]}"; do
|
for vm in "${vms[@]}"; do
|
||||||
__java_add VMS1_4 "$vm"
|
__java_add VMS1_4 "$vm"
|
||||||
|
@ -201,6 +225,11 @@ function __java_compute_vms() {
|
||||||
__java_add VMS11 "$vm"
|
__java_add VMS11 "$vm"
|
||||||
__java_add HOMES11 "$HOME/opt/$vm"
|
__java_add HOMES11 "$HOME/opt/$vm"
|
||||||
done
|
done
|
||||||
|
array_from_lines vms "$(list_dirs "$HOME/opt" "jdk-17.*" | LANG=C sort -r)"
|
||||||
|
for vm in "${vms[@]}"; do
|
||||||
|
__java_add VMS17 "$vm"
|
||||||
|
__java_add HOMES17 "$HOME/opt/$vm"
|
||||||
|
done
|
||||||
# Puis chercher dans les JVMs installées manuellement dans /opt
|
# Puis chercher dans les JVMs installées manuellement dans /opt
|
||||||
array_from_lines vms "$(list_dirs "/opt" "sun-jdk-*")"
|
array_from_lines vms "$(list_dirs "/opt" "sun-jdk-*")"
|
||||||
for vm in "${vms[@]}"; do
|
for vm in "${vms[@]}"; do
|
||||||
|
@ -230,6 +259,14 @@ function __java_compute_vms() {
|
||||||
__java_add HOMES11 "/opt/$vm"
|
__java_add HOMES11 "/opt/$vm"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
array_from_lines vms "$(list_dirs "/opt" jdk17)"
|
||||||
|
for vm in "${vms[@]}"; do
|
||||||
|
v="${vm#jdk}"
|
||||||
|
if [ "$v" == 17 ]; then
|
||||||
|
__java_add VMS17 "$vm"
|
||||||
|
__java_add HOMES17 "/opt/$vm"
|
||||||
|
fi
|
||||||
|
done
|
||||||
array_from_lines vms "$(list_dirs "/opt" "j2sdk1.4.2*" | LANG=C sort -r)"
|
array_from_lines vms "$(list_dirs "/opt" "j2sdk1.4.2*" | LANG=C sort -r)"
|
||||||
for vm in "${vms[@]}"; do
|
for vm in "${vms[@]}"; do
|
||||||
__java_add VMS1_4 "$vm"
|
__java_add VMS1_4 "$vm"
|
||||||
|
@ -260,6 +297,11 @@ function __java_compute_vms() {
|
||||||
__java_add VMS11 "$vm"
|
__java_add VMS11 "$vm"
|
||||||
__java_add HOMES11 "/opt/$vm"
|
__java_add HOMES11 "/opt/$vm"
|
||||||
done
|
done
|
||||||
|
array_from_lines vms "$(list_dirs "/opt" "jdk-17.*" | LANG=C sort -r)"
|
||||||
|
for vm in "${vms[@]}"; do
|
||||||
|
__java_add VMS17 "$vm"
|
||||||
|
__java_add HOMES17 "/opt/$vm"
|
||||||
|
done
|
||||||
# Puis chercher dans les JVMs installées par le système dans
|
# Puis chercher dans les JVMs installées par le système dans
|
||||||
# /usr/lib/jvm
|
# /usr/lib/jvm
|
||||||
if check_sysinfos -d gentoo; then
|
if check_sysinfos -d gentoo; then
|
||||||
|
@ -312,6 +354,9 @@ function __java_compute_vms() {
|
||||||
elif [ "$v" == 11 ]; then
|
elif [ "$v" == 11 ]; then
|
||||||
__java_add VMS11 "$vm"
|
__java_add VMS11 "$vm"
|
||||||
__java_add HOMES11 "/usr/lib/jvm/$vm"
|
__java_add HOMES11 "/usr/lib/jvm/$vm"
|
||||||
|
elif [ "$v" == 17 ]; then
|
||||||
|
__java_add VMS17 "$vm"
|
||||||
|
__java_add HOMES17 "/usr/lib/jvm/$vm"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -d /usr/lib/j2sdk1.4-sun ]; then
|
if [ -d /usr/lib/j2sdk1.4-sun ]; then
|
||||||
|
@ -353,7 +398,7 @@ function __java_compute_vms() {
|
||||||
|
|
||||||
function __java_dump_vms() {
|
function __java_dump_vms() {
|
||||||
local v b i vms homes
|
local v b i vms homes
|
||||||
for v in 1_3 1_4 5 6 7 8 11; do
|
for v in 1_3 1_4 5 6 7 8 11 17; do
|
||||||
for b in "" 32 64; do
|
for b in "" 32 64; do
|
||||||
vms="JAVA${b}_VMS${v}[@]"; vms=("${!vms}")
|
vms="JAVA${b}_VMS${v}[@]"; vms=("${!vms}")
|
||||||
homes="JAVA${b}_HOMES${v}[@]"; homes=("${!homes}")
|
homes="JAVA${b}_HOMES${v}[@]"; homes=("${!homes}")
|
||||||
|
@ -384,7 +429,7 @@ function __java_select_vms() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __java_select() {
|
function __java_select() {
|
||||||
# Sélectionner la version de java $1 (qui peut être 1_3, 1_4, 5, 6, 7, 8 ou 11)
|
# Sélectionner la version de java $1 (qui peut être 1_3, 1_4, 5, 6, 7, 8, 11, 17)
|
||||||
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
||||||
# version 32bits ou 64 bits. Sinon, la version sélectionnée peut être 32bits
|
# version 32bits ou 64 bits. Sinon, la version sélectionnée peut être 32bits
|
||||||
# ou 64bits selon ce qui est disponible.
|
# ou 64bits selon ce qui est disponible.
|
||||||
|
@ -428,7 +473,7 @@ function __java_select() {
|
||||||
|
|
||||||
function __java_select_default() {
|
function __java_select_default() {
|
||||||
# Sélectionner la version de java par défaut. Si JAVA_HOME est défini,
|
# Sélectionner la version de java par défaut. Si JAVA_HOME est défini,
|
||||||
# prendre cette valeur. Sinon, essayer dans l'ordre 5, 6, 7, 8, 11 puis 1_4
|
# prendre cette valeur. Sinon, essayer dans l'ordre 5, 6, 7, 8, 11, 17 puis 1_4
|
||||||
# la version 1_3 n'est jamais sélectionnée automatiquement
|
# la version 1_3 n'est jamais sélectionnée automatiquement
|
||||||
if [ -n "$JAVA_HOME" ]; then
|
if [ -n "$JAVA_HOME" ]; then
|
||||||
export JAVA_HOME # s'assurer que cette variable est exportée
|
export JAVA_HOME # s'assurer que cette variable est exportée
|
||||||
|
@ -440,7 +485,7 @@ function __java_select_default() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local vm
|
local vm
|
||||||
for vm in 5 6 7 8 11 1_4; do
|
for vm in 5 6 7 8 11 17 1_4; do
|
||||||
__java_select "$vm" && return 0
|
__java_select "$vm" && return 0
|
||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
|
@ -448,44 +493,49 @@ function __java_select_default() {
|
||||||
|
|
||||||
function select_java() {
|
function select_java() {
|
||||||
# sélectionner la version *minimum* de java correspondant à $1
|
# sélectionner la version *minimum* de java correspondant à $1
|
||||||
# $1 == 1.3|1.3+|1.4|1.4+|1.5|1.5+|1.6|1.6+|1.7|1.7+|1.8|1.8+|11|11+
|
# $1 == 1.3|1.3+|1.4|1.4+|1.5|1.5+|1.6|1.6+|1.7|1.7+|1.8|1.8+|11|11+|17|17+
|
||||||
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
||||||
# version 32bits ou 64 bits
|
# version 32bits ou 64 bits
|
||||||
local v vms homes
|
local v vms homes
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
1.3|1.3+)
|
1.3|1.3+)
|
||||||
for v in 1_3 1_4 5 6 7 8 11; do
|
for v in 1_3 1_4 5 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
1.4|1.4+)
|
1.4|1.4+)
|
||||||
for v in 1_4 5 6 7 8 11; do
|
for v in 1_4 5 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
1.5|1.5+|5|5+)
|
1.5|1.5+|5|5+)
|
||||||
for v in 5 6 7 8 11; do
|
for v in 5 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
1.6|1.6+|6|6+)
|
1.6|1.6+|6|6+)
|
||||||
for v in 6 7 8 11; do
|
for v in 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
1.7|1.7+|7|7+)
|
1.7|1.7+|7|7+)
|
||||||
for v in 7 8 11; do
|
for v in 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
1.8|1.8+|8|8+)
|
1.8|1.8+|8|8+)
|
||||||
for v in 8 11; do
|
for v in 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
11|11+)
|
11|11+)
|
||||||
for v in 11; do
|
for v in 11 17; do
|
||||||
|
__java_select "$v" "$2" && return 0
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
17|17+)
|
||||||
|
for v in 17; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -495,8 +545,8 @@ function select_java() {
|
||||||
|
|
||||||
function select_java_exact() {
|
function select_java_exact() {
|
||||||
# sélectionner la version *exacte* de java correspondant à $1
|
# sélectionner la version *exacte* de java correspondant à $1
|
||||||
# $1 == 1.3|1.4|1.5|1.6|1.7|1.8|11 pour une correspondance exacte
|
# $1 == 1.3|1.4|1.5|1.6|1.7|1.8|11|17 pour une correspondance exacte
|
||||||
# $1 == 1.3+|1.4+|1.5+|1.6+|1.7+|1.8+|11+ pour une version minimum
|
# $1 == 1.3+|1.4+|1.5+|1.6+|1.7+|1.8+|11+|17+ pour une version minimum
|
||||||
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
# Si $2 est défini, il peut s'agit de 32 ou 64 selon que l'on requière la
|
||||||
# version 32bits ou 64 bits
|
# version 32bits ou 64 bits
|
||||||
local v vms homes
|
local v vms homes
|
||||||
|
@ -506,7 +556,7 @@ function select_java_exact() {
|
||||||
__java_select 1_3 && return 0
|
__java_select 1_3 && return 0
|
||||||
;;
|
;;
|
||||||
1.3+)
|
1.3+)
|
||||||
for v in 1_3 1_4 5 6 7 8 11; do
|
for v in 1_3 1_4 5 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -514,7 +564,7 @@ function select_java_exact() {
|
||||||
__java_select 1_4 && return 0
|
__java_select 1_4 && return 0
|
||||||
;;
|
;;
|
||||||
1.4+)
|
1.4+)
|
||||||
for v in 1_4 5 6 7 8 11; do
|
for v in 1_4 5 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -522,7 +572,7 @@ function select_java_exact() {
|
||||||
__java_select 5 "$2" && return 0
|
__java_select 5 "$2" && return 0
|
||||||
;;
|
;;
|
||||||
1.5+|5+)
|
1.5+|5+)
|
||||||
for v in 5 6 7 8 11; do
|
for v in 5 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -530,7 +580,7 @@ function select_java_exact() {
|
||||||
__java_select 6 "$2" && return 0
|
__java_select 6 "$2" && return 0
|
||||||
;;
|
;;
|
||||||
1.6+|6+)
|
1.6+|6+)
|
||||||
for v in 6 7 8 11; do
|
for v in 6 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -538,7 +588,7 @@ function select_java_exact() {
|
||||||
__java_select 7 "$2" && return 0
|
__java_select 7 "$2" && return 0
|
||||||
;;
|
;;
|
||||||
1.7+|7+)
|
1.7+|7+)
|
||||||
for v in 7 8 11; do
|
for v in 7 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -546,7 +596,7 @@ function select_java_exact() {
|
||||||
__java_select 8 "$2" && return 0
|
__java_select 8 "$2" && return 0
|
||||||
;;
|
;;
|
||||||
1.8+|8+)
|
1.8+|8+)
|
||||||
for v in 8 11; do
|
for v in 8; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -554,7 +604,15 @@ function select_java_exact() {
|
||||||
__java_select 11 "$2" && return 0
|
__java_select 11 "$2" && return 0
|
||||||
;;
|
;;
|
||||||
11+)
|
11+)
|
||||||
for v in 11; do
|
for v in 11 17; do
|
||||||
|
__java_select "$v" "$2" && return 0
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
17)
|
||||||
|
__java_select 17 "$2" && return 0
|
||||||
|
;;
|
||||||
|
17+)
|
||||||
|
for v in 17; do
|
||||||
__java_select "$v" "$2" && return 0
|
__java_select "$v" "$2" && return 0
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -566,9 +624,9 @@ function select_java_any() {
|
||||||
# Sélectionner la version exacte de java correspondant aux arguments, dans
|
# Sélectionner la version exacte de java correspondant aux arguments, dans
|
||||||
# l'ordre, jusqu'à ce qu'un argument corresponde. DEFAULT correspond à la
|
# l'ordre, jusqu'à ce qu'un argument corresponde. DEFAULT correspond à la
|
||||||
# valeur actuelle de JAVA_HOME, si elle est définie.
|
# valeur actuelle de JAVA_HOME, si elle est définie.
|
||||||
# Si aucun argument n'est défini, on assume "DEFAULT 5 6 7 8 11 1.4"
|
# Si aucun argument n'est défini, on assume "DEFAULT 5 6 7 8 11 17 1.4"
|
||||||
local v
|
local v
|
||||||
[ -n "$*" ] || set -- DEFAULT 5 6 7 8 11 1.4
|
[ -n "$*" ] || set -- DEFAULT 5 6 7 8 11 17 1.4
|
||||||
for v in "$@"; do
|
for v in "$@"; do
|
||||||
if [ "$v" == DEFAULT ]; then
|
if [ "$v" == DEFAULT ]; then
|
||||||
if [ -n "$JAVA_HOME" ]; then
|
if [ -n "$JAVA_HOME" ]; then
|
||||||
|
|
|
@ -213,7 +213,7 @@ function tl_modifyattr() {
|
||||||
dn = ""
|
dn = ""
|
||||||
}
|
}
|
||||||
sub(/:+$/, "", attr)
|
sub(/:+$/, "", attr)
|
||||||
if (lastattr != attr) {
|
if (tolower(lastattr) != tolower(attr)) {
|
||||||
if (lastattr != "") {
|
if (lastattr != "") {
|
||||||
print "-"
|
print "-"
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ function tl_deleteattr() {
|
||||||
dn = ""
|
dn = ""
|
||||||
}
|
}
|
||||||
sub(/:+$/, "", attr)
|
sub(/:+$/, "", attr)
|
||||||
if (lastattr != attr) {
|
if (tolower(lastattr) != tolower(attr)) {
|
||||||
if (lastattr != "") {
|
if (lastattr != "") {
|
||||||
print "-"
|
print "-"
|
||||||
}
|
}
|
||||||
|
|
30
lib/ulib/pff
30
lib/ulib/pff
|
@ -117,8 +117,21 @@ function pff_get_first_profile() {
|
||||||
function pff_get_local_files() {
|
function pff_get_local_files() {
|
||||||
# afficher tous les fichiers locaux exprimés relativement au répertoire du
|
# afficher tous les fichiers locaux exprimés relativement au répertoire du
|
||||||
# projet pff $1
|
# projet pff $1
|
||||||
local pffdir="$1"
|
local pffdir="$1" files file dirs dir isald
|
||||||
find "$pffdir/pff/Base" -type f | sed "s|^$pffdir/pff/Base/||" | grep -v '__pv-.*__$'
|
files="$(find "$pffdir/pff/Base" -type f | sed "s|^$pffdir/pff/Base/||" | grep -v '/__pv-[^/_]*__[^/]*$')"
|
||||||
|
dirs="$(echo "$files" | grep '/\.pffdir$' | sed 's/\.pffdir$//')"
|
||||||
|
setx -a files=echo "$files"
|
||||||
|
setx -a dirs=echo "$dirs"
|
||||||
|
for file in "${files[@]}"; do
|
||||||
|
isald=
|
||||||
|
for dir in "${dirs[@]}"; do
|
||||||
|
if [ "${file#$dir}" != "$file" ]; then
|
||||||
|
isald=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ -z "$isald" -o "$file" == "${dir}.pffdir" ] && echo "$file"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function pff_get_rfile() {
|
function pff_get_rfile() {
|
||||||
|
@ -253,7 +266,18 @@ function pff_select_profile() {
|
||||||
setx -a lfiles=pff_get_local_files "$pffdir"
|
setx -a lfiles=pff_get_local_files "$pffdir"
|
||||||
for lfile in "${lfiles[@]}"; do
|
for lfile in "${lfiles[@]}"; do
|
||||||
src="$pffdir/pff/Current/$lfile"
|
src="$pffdir/pff/Current/$lfile"
|
||||||
if [ -f "$pffdir/pff/$profile/$lfile" ]; then
|
if [[ "$lfile" == */.pffdir ]]; then
|
||||||
|
# répertoires entiers
|
||||||
|
lfile="${lfile%/.pffdir}"
|
||||||
|
src="${src%/.pffdir}"
|
||||||
|
if [ -d "$pffdir/pff/$profile/$lfile" ]; then
|
||||||
|
dest="$profile/$lfile"
|
||||||
|
elif [ "$profile" != Common -a -d "$pffdir/pff/Common/$lfile" ]; then
|
||||||
|
dest="Common/$lfile"
|
||||||
|
else
|
||||||
|
dest="Base/$lfile"
|
||||||
|
fi
|
||||||
|
elif [ -f "$pffdir/pff/$profile/$lfile" ]; then
|
||||||
dest="$profile/$lfile"
|
dest="$profile/$lfile"
|
||||||
elif [ "$profile" != Common -a -f "$pffdir/pff/Common/$lfile" ]; then
|
elif [ "$profile" != Common -a -f "$pffdir/pff/Common/$lfile" ]; then
|
||||||
dest="Common/$lfile"
|
dest="Common/$lfile"
|
||||||
|
|
|
@ -18,11 +18,11 @@ function is_any_branch() {
|
||||||
case "$spec" in
|
case "$spec" in
|
||||||
m|master)
|
m|master)
|
||||||
[ -n "$r" ] || r=1
|
[ -n "$r" ] || r=1
|
||||||
[ "$branch" == "master" ] && return 0
|
[ "$branch" == master ] && return 0
|
||||||
;;
|
;;
|
||||||
d|develop)
|
d|develop)
|
||||||
[ -n "$r" ] || r=1
|
[ -n "$r" ] || r=1
|
||||||
[ "$branch" == "develop" ] && return 0
|
[ "$branch" == develop ] && return 0
|
||||||
;;
|
;;
|
||||||
r|release)
|
r|release)
|
||||||
[ -n "$r" ] || r=1
|
[ -n "$r" ] || r=1
|
||||||
|
@ -34,20 +34,21 @@ function is_any_branch() {
|
||||||
;;
|
;;
|
||||||
f|feature|t|topic)
|
f|feature|t|topic)
|
||||||
[ -n "$r" ] || r=1
|
[ -n "$r" ] || r=1
|
||||||
[ "$branch" == "master" ] && continue
|
[ "$branch" == master ] && continue
|
||||||
[ "$branch" == "develop" ] && continue
|
[ "$branch" == develop ] && continue
|
||||||
[[ "$branch" == release-* ]] && continue
|
[[ "$branch" == release-* ]] && continue
|
||||||
[[ "$branch" == hotfix-* ]] && continue
|
[[ "$branch" == hotfix-* ]] && continue
|
||||||
[ -n "$annex" -a "$branch" == "git-annex" ] && continue
|
[ -n "$annex" -a "$branch" == "git-annex" ] && continue
|
||||||
|
[[ "$branch" == wip/* ]] && return 0
|
||||||
[[ "$branch" == */* ]] && continue
|
[[ "$branch" == */* ]] && continue
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-m|-master)
|
-m|-master)
|
||||||
[ -n "$r" ] || r=0
|
[ -n "$r" ] || r=0
|
||||||
[ "$branch" == "master" ] && return 1;;
|
[ "$branch" == master ] && return 1;;
|
||||||
-d|-develop)
|
-d|-develop)
|
||||||
[ -n "$r" ] || r=0
|
[ -n "$r" ] || r=0
|
||||||
[ "$branch" == "develop" ] && return 1;;
|
[ "$branch" == develop ] && return 1;;
|
||||||
-r|-release)
|
-r|-release)
|
||||||
[ -n "$r" ] || r=0
|
[ -n "$r" ] || r=0
|
||||||
[[ "$branch" == release-* ]] && return 1;;
|
[[ "$branch" == release-* ]] && return 1;;
|
||||||
|
@ -56,11 +57,12 @@ function is_any_branch() {
|
||||||
[[ "$branch" == hotfix-* ]] && return 1;;
|
[[ "$branch" == hotfix-* ]] && return 1;;
|
||||||
-f|-feature|-t|-topic)
|
-f|-feature|-t|-topic)
|
||||||
[ -n "$r" ] || r=0
|
[ -n "$r" ] || r=0
|
||||||
[ "$branch" == "master" ] && continue
|
[ "$branch" == master ] && continue
|
||||||
[ "$branch" == "develop" ] && continue
|
[ "$branch" == develop ] && continue
|
||||||
[[ "$branch" == release-* ]] && continue
|
[[ "$branch" == release-* ]] && continue
|
||||||
[[ "$branch" == hotfix-* ]] && continue
|
[[ "$branch" == hotfix-* ]] && continue
|
||||||
[ -n "$annex" -a "$branch" == "git-annex" ] && continue
|
[ -n "$annex" -a "$branch" == "git-annex" ] && continue
|
||||||
|
[[ "$branch" == wip/* ]] && return 1
|
||||||
[[ "$branch" == */* ]] && continue
|
[[ "$branch" == */* ]] && continue
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
|
@ -89,7 +91,7 @@ function list_feature_branches() {
|
||||||
grep -vF develop |
|
grep -vF develop |
|
||||||
grep -v '^release-' |
|
grep -v '^release-' |
|
||||||
grep -v '^hotfix-' |
|
grep -v '^hotfix-' |
|
||||||
grep -v '/' |
|
grep -Pv '(?<!^wip)/' |
|
||||||
if git_have_annex; then
|
if git_have_annex; then
|
||||||
grep -vF git-annex
|
grep -vF git-annex
|
||||||
else
|
else
|
||||||
|
|
|
@ -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
|
|
||||||
[ "${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
|
|
||||||
|
|
||||||
function setyesval() {
|
function set_array_cmd() {
|
||||||
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
|
if [ $# -eq 1 ]; then echo_seta2 "$1"
|
||||||
|
elif [ "$2" == @ ]; then echo_seta "$1" "${@:3}"
|
||||||
|
else eval "echo_seta \"\$1\" \"\${$2[@]}\""
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
function normyesval() {
|
function set_array() {
|
||||||
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
|
eval "$(set_array_cmd "$@")"
|
||||||
}
|
|
||||||
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(/&/, "\\&", s)
|
gsub(/&/, "\\&", 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
|
||||||
|
|
|
@ -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
|
||||||
|
|
4
lless
4
lless
|
@ -3,10 +3,10 @@
|
||||||
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: frontend de less pour lire des fichiers encodés en latin1
|
uecho "$scriptname: frontend de less pour lire un fichier encodé en latin1
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
$scriptname [options] files...
|
$scriptname [options] FILE
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-S, --chop-long-lines
|
-S, --chop-long-lines
|
||||||
|
|
90
pff
90
pff
|
@ -197,9 +197,16 @@ pff:
|
||||||
NOUPSTREAM -- indiquer qu'il n'y a pas de distribution upstream ni de
|
NOUPSTREAM -- indiquer qu'il n'y a pas de distribution upstream ni de
|
||||||
fichiers origine. pff est alors uniquement utilisé pour gérer des
|
fichiers origine. pff est alors uniquement utilisé pour gérer des
|
||||||
profils de fichier.
|
profils de fichier.
|
||||||
Pour le moment, la seule différence est que le mode des fichiers de
|
Pour le moment, la seule différence fonctionnelle est que le mode des
|
||||||
pff/Base n'est pas forcé à 0444. Ainsi, ces fichiers sont traités au
|
fichiers de pff/Base n'est pas forcé à 0444. Ainsi, ces fichiers sont
|
||||||
même titre que ceux du répertoire pff/Common
|
traités au même titre que ceux du répertoire pff/Common
|
||||||
|
Dans ce mode, on supporte aussi les liens vers des répertoires entiers:
|
||||||
|
il suffit de créer le répertoire dans pff/Base avec un unique fichier
|
||||||
|
.pffdir à l'intérieur. Lors du switch le répertoire correspondant est
|
||||||
|
lié s'il existe dans un profil.
|
||||||
|
NB: s'il existe d'autres fichiers dans le répertoire, ils sont ignorés.
|
||||||
|
Cela permet d'avoir un ensemble de fichiers par défaut, mais les liens
|
||||||
|
symboliques doivent être faits manuellement.
|
||||||
|
|
||||||
COMMANDES / OPTIONS
|
COMMANDES / OPTIONS
|
||||||
Les arguments du script dépendent de la commande utilisée. Les commandes
|
Les arguments du script dépendent de la commande utilisée. Les commandes
|
||||||
|
@ -347,6 +354,21 @@ function flexists() {
|
||||||
[ -e "$1" -o -L "$1" ]
|
[ -e "$1" -o -L "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function multiups() {
|
||||||
|
# afficher un chemin vers le haut e.g ../../.. avec autant d'éléments que
|
||||||
|
# les répertoires du chemin relatif $1.
|
||||||
|
# méthode: commencer avec la valeur de départ $2 et préfixer avec autant de
|
||||||
|
# ../ que nécessaire. puis afficher le résultat.
|
||||||
|
local tmp="$1" link="$2"
|
||||||
|
setx tmp=dirname -- "$tmp"
|
||||||
|
while [ "$tmp" != . ]; do
|
||||||
|
[ -n "$link" ] && link="/$link"
|
||||||
|
link="..$link"
|
||||||
|
setx tmp=dirname -- "$tmp"
|
||||||
|
done
|
||||||
|
echo "$link"
|
||||||
|
}
|
||||||
|
|
||||||
function find_pffdir() {
|
function find_pffdir() {
|
||||||
# trouver le répertoire du projet pff à partir du répertoire $2(=.) et
|
# trouver le répertoire du projet pff à partir du répertoire $2(=.) et
|
||||||
# mettre le chemin absolu dans la variable $1(=pffdir)
|
# mettre le chemin absolu dans la variable $1(=pffdir)
|
||||||
|
@ -413,23 +435,22 @@ function get_first_profile() {
|
||||||
function get_local_files() {
|
function get_local_files() {
|
||||||
# afficher tous les fichiers locaux exprimés relativement au répertoire du
|
# afficher tous les fichiers locaux exprimés relativement au répertoire du
|
||||||
# projet pff $1
|
# projet pff $1
|
||||||
local pffdir="$1"
|
# pour les répertoires liés, ne lister que le fichier .pffdir
|
||||||
find "$pffdir/pff/Base" -type f | sed "s|^$pffdir/pff/Base/||" | grep -v '/__pv-[^/_]*__[^/]*$'
|
local pffdir="$1" files file dirs dir isald
|
||||||
}
|
files="$(find "$pffdir/pff/Base" -type f | sed "s|^$pffdir/pff/Base/||" | grep -v '/__pv-[^/_]*__[^/]*$')"
|
||||||
|
dirs="$(echo "$files" | grep '/\.pffdir$' | sed 's/\.pffdir$//')"
|
||||||
function multiups() {
|
setx -a files=echo "$files"
|
||||||
# afficher un chemin vers le haut e.g ../../.. avec autant d'éléments que
|
setx -a dirs=echo "$dirs"
|
||||||
# les répertoires du chemin relatif $1.
|
for file in "${files[@]}"; do
|
||||||
# méthode: commencer avec la valeur de départ $2 et préfixer avec autant de
|
isald=
|
||||||
# ../ que nécessaire. puis afficher le résultat.
|
for dir in "${dirs[@]}"; do
|
||||||
local tmp="$1" link="$2"
|
if [ "${file#$dir}" != "$file" ]; then
|
||||||
setx tmp=dirname -- "$tmp"
|
isald=1
|
||||||
while [ "$tmp" != . ]; do
|
break
|
||||||
[ -n "$link" ] && link="/$link"
|
fi
|
||||||
link="..$link"
|
done
|
||||||
setx tmp=dirname -- "$tmp"
|
[ -z "$isald" -o "$file" == "${dir}.pffdir" ] && echo "$file"
|
||||||
done
|
done
|
||||||
echo "$link"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_rfile() {
|
function get_rfile() {
|
||||||
|
@ -595,7 +616,18 @@ function select_profile() {
|
||||||
setx -a lfiles=get_local_files "$pffdir"
|
setx -a lfiles=get_local_files "$pffdir"
|
||||||
for lfile in "${lfiles[@]}"; do
|
for lfile in "${lfiles[@]}"; do
|
||||||
src="$pffdir/pff/Current/$lfile"
|
src="$pffdir/pff/Current/$lfile"
|
||||||
if [ -f "$pffdir/pff/$profile/$lfile" ]; then
|
if [[ "$lfile" == */.pffdir ]]; then
|
||||||
|
# répertoires entiers
|
||||||
|
lfile="${lfile%/.pffdir}"
|
||||||
|
src="${src%/.pffdir}"
|
||||||
|
if [ -d "$pffdir/pff/$profile/$lfile" ]; then
|
||||||
|
dest="$profile/$lfile"
|
||||||
|
elif [ "$profile" != Common -a -d "$pffdir/pff/Common/$lfile" ]; then
|
||||||
|
dest="Common/$lfile"
|
||||||
|
else
|
||||||
|
dest="Base/$lfile"
|
||||||
|
fi
|
||||||
|
elif [ -f "$pffdir/pff/$profile/$lfile" ]; then
|
||||||
dest="$profile/$lfile"
|
dest="$profile/$lfile"
|
||||||
elif [ "$profile" != Common -a -f "$pffdir/pff/Common/$lfile" ]; then
|
elif [ "$profile" != Common -a -f "$pffdir/pff/Common/$lfile" ]; then
|
||||||
dest="Common/$lfile"
|
dest="Common/$lfile"
|
||||||
|
@ -1456,7 +1488,7 @@ function list_locals_cmd() {
|
||||||
local pffdir="$1"
|
local pffdir="$1"
|
||||||
|
|
||||||
ensure_pffdir pffdir "$pffdir"
|
ensure_pffdir pffdir "$pffdir"
|
||||||
get_local_files "$pffdir"
|
get_local_files "$pffdir" | sed 's/\/.pffdir$/\//'
|
||||||
}
|
}
|
||||||
|
|
||||||
#===========================================================
|
#===========================================================
|
||||||
|
@ -1739,7 +1771,21 @@ function infos_cmd() {
|
||||||
setx -a vlfiles=get_vlfiles "$pffdir" "$rfile" "$profile"
|
setx -a vlfiles=get_vlfiles "$pffdir" "$rfile" "$profile"
|
||||||
setx Pfile=get_pfile "$pffdir/$rfile" "$profile" "$pffdir"
|
setx Pfile=get_pfile "$pffdir/$rfile" "$profile" "$pffdir"
|
||||||
setx Cfile=get_Cfile "$pffdir/$rfile" "$pffdir"
|
setx Cfile=get_Cfile "$pffdir/$rfile" "$pffdir"
|
||||||
if [ ${#vlfiles[*]} -gt 0 ]; then
|
if [[ "$rfile" == */.pffdir ]]; then
|
||||||
|
# répertoires entiers
|
||||||
|
rfile="${rfile%.pffdir}"
|
||||||
|
Pfile="${Pfile%/.pffdir}"
|
||||||
|
Cfile="${Cfile%/.pffdir}"
|
||||||
|
if [ -d "$Pfile" ]; then
|
||||||
|
flag="${COULEUR_BLEUE}*${COULEUR_NORMALE} "
|
||||||
|
elif [ "$profile" != Common -a -d "$Cfile" ]; then
|
||||||
|
flag="$(get_color YELLOW)C${COULEUR_NORMALE} "
|
||||||
|
elif [ -z "$show_all" ]; then
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
flag=" "
|
||||||
|
fi
|
||||||
|
elif [ ${#vlfiles[*]} -gt 0 ]; then
|
||||||
flag="${COULEUR_ROUGE}P${COULEUR_NORMALE} "
|
flag="${COULEUR_ROUGE}P${COULEUR_NORMALE} "
|
||||||
elif [ -f "$Pfile" ]; then
|
elif [ -f "$Pfile" ]; then
|
||||||
flag="${COULEUR_BLEUE}*${COULEUR_NORMALE} "
|
flag="${COULEUR_BLEUE}*${COULEUR_NORMALE} "
|
||||||
|
|
139
reginc
139
reginc
|
@ -12,62 +12,111 @@ remplacer les nombres de FROMmin à FROMmax par leur valeur correspondante,
|
||||||
sachant que FROMmin doit être remplacé par TO. On peut mentionner autant de
|
sachant que FROMmin doit être remplacé par TO. On peut mentionner autant de
|
||||||
couples (FROM, TO) que nécessaire: ils seront traités dans l'ordre
|
couples (FROM, TO) que nécessaire: ils seront traités dans l'ordre
|
||||||
|
|
||||||
|
$scriptname -r FROMmin-FROMmax TO FILEs...
|
||||||
|
|
||||||
|
renommer les fichiers en remplaçant les nombres de FROMmin à FROMmax par leur
|
||||||
|
valeur correspondante, sachant que FROMmin doit être remplacé par TO
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-n, --fake
|
-n, --fake
|
||||||
Afficher le fichier tel qu'il serait modifié au lieu de le modifier en
|
Afficher le fichier tel qu'il serait modifié au lieu de le modifier en
|
||||||
place"
|
place
|
||||||
|
-r, --rename
|
||||||
|
Renommer les fichiers au lieu de modifier le texte à l'intérieur du
|
||||||
|
fichier. Attention, l'ordre des arguments est différent avec cette
|
||||||
|
option"
|
||||||
}
|
}
|
||||||
|
|
||||||
fake=
|
function process_file() {
|
||||||
|
local file from to fromb frome seds r
|
||||||
|
|
||||||
|
file="$1"; shift
|
||||||
|
[ -n "$file" ] || die "vous devez spécifier le fichier à modifier"
|
||||||
|
|
||||||
|
seds=
|
||||||
|
while [ $# -ge 2 ]; do
|
||||||
|
from="$1"
|
||||||
|
if [[ "$from" == *-* ]]; then
|
||||||
|
let fromb="${from%-*}"
|
||||||
|
let frome="${from#*-}"
|
||||||
|
else
|
||||||
|
let fromb="$from"
|
||||||
|
let frome="$from"
|
||||||
|
fi
|
||||||
|
let to="$2"; shift 2
|
||||||
|
|
||||||
|
if [ "$to" -eq "$fromb" ]; then
|
||||||
|
einfo "$fromb --> $to aucune modification n'est nécessaire"
|
||||||
|
|
||||||
|
elif [ "$to" -lt "$fromb" ]; then
|
||||||
|
einfo "$fromb-$frome --> $to-$((to+frome-fromb))"
|
||||||
|
|
||||||
|
let from=fromb
|
||||||
|
while [ "$from" -le "$frome" ]; do
|
||||||
|
seds="$seds${seds:+; }s/$from/$to/g"
|
||||||
|
let from=from+1
|
||||||
|
let to=to+1
|
||||||
|
done
|
||||||
|
|
||||||
|
elif [ "$to" -gt "$fromb" ]; then
|
||||||
|
einfo "$frome-$fromb --> $((to+frome-fromb))-$to"
|
||||||
|
|
||||||
|
let from=frome
|
||||||
|
let to=to+frome-fromb
|
||||||
|
while [ "$from" -ge "$fromb" ]; do
|
||||||
|
seds="$seds${seds:+; }s/$from/$to/g"
|
||||||
|
let from=from-1
|
||||||
|
let to=to-1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
edebug "Script sed: $seds"
|
||||||
|
|
||||||
|
[ -n "$Fake" ] && args=() || args=(-i)
|
||||||
|
args+=("$seds" "$file")
|
||||||
|
sed "${args[@]}"; r=$?
|
||||||
|
|
||||||
|
[ -z "$Fake" -a $r -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
Fake=
|
||||||
|
rename=
|
||||||
args=(
|
args=(
|
||||||
--help '$exit_with display_help'
|
--help '$exit_with display_help'
|
||||||
-n,--fake fake=1
|
-n,--Fake Fake=1
|
||||||
|
-r,--rename rename=1
|
||||||
)
|
)
|
||||||
parse_args "$@"; set -- "${args[@]}"
|
parse_args "$@"; set -- "${args[@]}"
|
||||||
|
|
||||||
file="$1"; shift
|
if [ -n "$rename" ]; then
|
||||||
[ -n "$file" ] || die "vous devez spécifier le fichier à modifier"
|
from="$1"; to="$2"; shift 2
|
||||||
|
|
||||||
seds=
|
froms=("$@")
|
||||||
while [ $# -ge 2 ]; do
|
ac_set_tmpfile tmptos
|
||||||
from="$1"
|
echo "tos=(" >>"$tmptos"
|
||||||
if [[ "$from" == *-* ]]; then
|
for file in "${froms[@]}"; do
|
||||||
let fromb="${from%-*}"
|
qval "$file" >>"$tmptos"
|
||||||
let frome="${from#*-}"
|
done
|
||||||
else
|
echo ")" >>"$tmptos"
|
||||||
let fromb="$from"
|
|
||||||
let frome="$from"
|
|
||||||
fi
|
|
||||||
let to="$2"; shift 2
|
|
||||||
|
|
||||||
if [ "$to" -eq "$fromb" ]; then
|
Fake= process_file "$tmptos" "$from" "$to"
|
||||||
einfo "$fromb --> $to aucune modification n'est nécessaire"
|
eval "$(<"$tmptos")"
|
||||||
|
|
||||||
elif [ "$to" -lt "$fromb" ]; then
|
i=0
|
||||||
einfo "$fromb-$frome --> $to-$((to+frome-fromb))"
|
count=${#froms[*]}
|
||||||
|
while [ $i -lt $count ]; do
|
||||||
|
from="${froms[$i]}"
|
||||||
|
to="${tos[$i]}"
|
||||||
|
if [ "$to" == "$from" ]; then
|
||||||
|
ewarn "$from: renommage non nécessaire"
|
||||||
|
else
|
||||||
|
estep "$from --> $to"
|
||||||
|
[ -z "$Fake" ] && mv "$from" "$to"
|
||||||
|
fi
|
||||||
|
let i=i+1
|
||||||
|
done
|
||||||
|
|
||||||
let from=fromb
|
else
|
||||||
while [ "$from" -le "$frome" ]; do
|
process_file "$@"
|
||||||
seds="$seds${seds:+; }s/$from/$to/g"
|
fi
|
||||||
let from=from+1
|
|
||||||
let to=to+1
|
|
||||||
done
|
|
||||||
|
|
||||||
elif [ "$to" -gt "$fromb" ]; then
|
|
||||||
einfo "$frome-$fromb --> $((to+frome-fromb))-$to"
|
|
||||||
|
|
||||||
let from=frome
|
|
||||||
let to=to+frome-fromb
|
|
||||||
while [ "$from" -ge "$fromb" ]; do
|
|
||||||
seds="$seds${seds:+; }s/$from/$to/g"
|
|
||||||
let from=from-1
|
|
||||||
let to=to-1
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
edebug "Script sed: $seds"
|
|
||||||
|
|
||||||
[ -n "$fake" ] && args=() || args=(-i)
|
|
||||||
args+=("$seds" "$file")
|
|
||||||
sed "${args[@]}"
|
|
||||||
|
|
689
ucrontab
689
ucrontab
|
@ -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
|
|
||||||
[ "${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
|
|
||||||
|
|
||||||
function setyesval() {
|
function set_array_cmd() {
|
||||||
is_yes "$2" && _setv "$1" 1 || _setv "$1" ""
|
if [ $# -eq 1 ]; then echo_seta2 "$1"
|
||||||
|
elif [ "$2" == @ ]; then echo_seta "$1" "${@:3}"
|
||||||
|
else eval "echo_seta \"\$1\" \"\${$2[@]}\""
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
function normyesval() {
|
function set_array() {
|
||||||
is_yes "${2:-"${!1}"}" && _setv "$1" 1 || _setv "$1" ""
|
eval "$(set_array_cmd "$@")"
|
||||||
}
|
|
||||||
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(/&/, "\\&", s)
|
gsub(/&/, "\\&", 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
|
||||||
|
|
2
ufile
2
ufile
|
@ -11,7 +11,7 @@ Les règles sont spécifiées dans le fichier ~/etc/default/ufile
|
||||||
Dans ce fichier, deux tableaux contiennent les règles applicables:
|
Dans ce fichier, deux tableaux contiennent les règles applicables:
|
||||||
* le tableau RULES contient des règles de la forme pattern:destdir[:renamef] et
|
* le tableau RULES contient des règles de la forme pattern:destdir[:renamef] et
|
||||||
permet de classer des fichiers correspondant à des patterns
|
permet de classer des fichiers correspondant à des patterns
|
||||||
* le tableau NRULES contient des règles de fle forme name:destdir[:renamef] et
|
* le tableau NRULES contient des règles de la forme name:destdir[:renamef] et
|
||||||
permet de classer des fichiers quelconques en spécifiant la règle à utiliser
|
permet de classer des fichiers quelconques en spécifiant la règle à utiliser
|
||||||
|
|
||||||
Les champs sont:
|
Les champs sont:
|
||||||
|
|
Loading…
Reference in New Issue