Compare commits
1 Commits
master
...
update-usc
Author | SHA1 | Date |
---|---|---|
Jephté Clain | c0431d866d |
244
CHANGES.md
244
CHANGES.md
|
@ -1,247 +1,3 @@
|
|||
## 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
|
||||
|
||||
* `f36be0d` uscrontab: s'assurer que USER est défini
|
||||
* `63674ef` cosmetic
|
||||
* `ee80091` cosmetic
|
||||
|
||||
## Version 9.15.0 du 14/06/2023-15:41
|
||||
|
||||
* `2a02307` update-nutools: prendre le dépôt public par défaut
|
||||
* `27a82e4` ajouter les numéros de version des debian et ubuntu
|
||||
* `92157de` regins: implémentation initiale
|
||||
* `efe9fbb` dk: ajout de XX pour prune-cache
|
||||
* `dc94b5c` dkbuild: bug avec les chemins
|
||||
* `5e87665` dk: X supprimer aussi le cache
|
||||
* `9c1a8e6` dk: composer.phar est cherché dans sbin/ aussi
|
||||
* `81cefdc` regcp: activer support regexp-extended
|
||||
* `c5796d6` modifs.mineures sans commentaires
|
||||
* `6919352` maj du message de commit par défaut
|
||||
* `7ba7d1c` pcxone: correction de l'url généré des dépôts git
|
||||
* `9d75943` repoctl: correction de l'url généré des dépôts git
|
||||
|
||||
## Version 9.14.0 du 15/03/2023-17:48
|
||||
|
||||
* `3ecb127` support docker compose v2
|
||||
* `432ab6f` dkbuild: composer et mvn ne sont lancés qu'en mode build
|
||||
* `01c14bb` regcp: ajout de l'option -n
|
||||
* `0913c2e` upassword: rendre configurable le nombre de blocs
|
||||
* `61433fb` dkbuild: revert image par défaut pour javabuilder
|
||||
* `e4e0a55` pff: support mode vcs offline
|
||||
* `e08c66b` pff: support des archives sh de l'amue
|
||||
* `0d11932` dkbuild: corriger l'image javabuilder par défaut
|
||||
* `3ead1f3` dkbuild: utiliser automatiquement l'image si nécessaire pour composer ou maven
|
||||
* `93de256` ajout de regcp et regmv
|
||||
* `5e33a36` rendre cohérent les en-têtes des scripts
|
||||
* `9e13515` ajout exemple .dkbuild.env
|
||||
* `c9e8110` dkbuild: corriger calcul des tags
|
||||
* `c671cb3` dkbuild: fin support tag & last version
|
||||
* `1a764f1` dkbuild: début support tag & last version
|
||||
* `027f9b8` dkbuild: ajout de from_glob()
|
||||
* `2293239` maj doc
|
||||
* `9fc07bb` dkbuild: ajout build add-tags=
|
||||
* `7b15f94` dkbuild: support préfixe et suffixe pour version
|
||||
* `f2cfaee` dkbuild: calculer extract automatiquement
|
||||
* `c36b8fb` dkbuild: corriger le support des paramètres sans argument
|
||||
* `68a42d0` dkbuild: maj templates
|
||||
* `306e77f` dkbuild: calcul de la version à partir d'un fichier ou d'un chemin
|
||||
* `b006bb4` Maj des fichiers
|
||||
* `6963d41` uproject: push -f force le push
|
||||
* `9665d5a` cx-conndev: maj doc
|
||||
* `137dfa9` repoctl, uproject: ne plus enlever le suffixe .git
|
||||
* `440d2aa` upassword: maj nombre de blocs par défaut
|
||||
* `f4047a3` ipaddr: forcer la sortie couleur
|
||||
* `af1bdd3` Maj des fichiers
|
||||
* `85e77e4` dkbuild: corriger le calcul de la dernière version d'une distribution
|
||||
* `a56ec0e` dkbuild: améliorer clean
|
||||
* `d6e78b9` dkbuild: maj messages debug
|
||||
* `1699cc5` dkbuild: les fichiers d'environnement par défaut ont l'extension .env
|
||||
* `2ae8406` maj doc dkbuild
|
||||
* `1db7d08` maj doc cx-shelldev
|
||||
* `aba08c2` maj update-nutools
|
||||
* `e83b6d1` possibilité de choisir l'adresse IP
|
||||
* `af9096d` ajouter le template fichier vide
|
||||
* `89f0c09` typo
|
||||
* `fb434c2` bug parse_date
|
||||
* `f7ab14f` dkbuild: implémentation initiale
|
||||
* `f46812f` cx-conndev: maj doc
|
||||
|
||||
## Version 9.13.0 du 07/02/2022-22:20
|
||||
|
||||
* `06686d9` pff: support nettoyage wsdl/
|
||||
* `9a018a6` pdev: ajout de --check
|
||||
* `a932a1a` la branche par défaut est master en prod
|
||||
* `cb09f4d` maj template yaml
|
||||
* `f895222` foreach: rendre -g et -S compatibles
|
||||
* `4f7bcbc` maj template CSS
|
||||
* `5cdd93d` upassword: réintégrer password wom
|
||||
* `7030b87` dk: ajouter mvn_action=install
|
||||
* `8a682ed` upassword: changer le générateur aléatoire
|
||||
* `a85cdf6` Maj des fichiers
|
||||
* `d75783b` dmcerts: cosmetic
|
||||
* `11e6021` dmcerts: certificat client avec la même durée que le CA
|
||||
* `938307c` ajout dmcerts
|
||||
* `8b49084` typo
|
||||
* `98c1ac8` ajouter le support de bullseye
|
||||
* `28d42b0` authftp: support des mots de passe avec des caractères spéciaux
|
||||
* `dfdfd59` sélectionner java 1.6 par défaut pour worun
|
||||
* `6af0359` pff: ajout de la commande normalisée new_cmd_amue_clean_libs
|
||||
* `b3a44d0` pff: bug
|
||||
* `111463a` pff: ajout AUTO_CMDS et NEW_CMDS, supprimer MKDIRS
|
||||
* `fe839f4` woinst: bug
|
||||
* `ba8e1a1` upasword: ajout des mot de passe javamonitor de webobjects
|
||||
* `a75b91e` network: utiliser 127.0.1.1 pour dhcp
|
||||
* `dfb5fc3` maj ulib/redhat
|
||||
* `40c9cb9` supprimer docker/ qui est obsolète
|
||||
* `580e20b` supprimer nulib de la distribution de nutools
|
||||
* `da28d8b` pff: changer le format des fichiers de version
|
||||
|
||||
## Version 9.12.0 du 29/03/2021-09:41
|
||||
|
||||
* `3d54e37` pff: bug origext
|
||||
* `4607f0f` possibilité de spécifier compat bash_completion si pas debian
|
||||
* `4bf4f6d` authftp: info pour host key verification failed
|
||||
* `47e0583` forcer l'utilisation de python2
|
||||
* `026b849` dmctl: support de l'import de plusieurs machines avec -l
|
||||
* `31e43da` dk: support de 'system' comme alias de 'none' pour COMPOSER_PHP et MAVEN_JAVA
|
||||
* `b191552` dk: bug dans le mapping par défaut dans le profil test
|
||||
* `1d4c4b4` dk: support COMPOSER_PHP=none
|
||||
* `b3983ed` dk: support des mappings d'hôtes
|
||||
* `543d2d2` dk: mvn est aussi un frontend pour lancer java
|
||||
* `f1a9c7a` dk: début support projets maven
|
||||
* `ad44a1c` dk: support build dans une image pour les projets composer
|
||||
|
||||
## Version 9.11.0 du 11/12/2020-15:43
|
||||
|
||||
* `01e940b` repoctl: permettre create -u
|
||||
* `e453ed2` maj doc
|
||||
* `434a8bc` compileAndGo: support java 11
|
||||
|
||||
## Version 9.10.0 du 12/11/2020-23:05
|
||||
|
||||
* `24d0519` dk: support merge .shared_env et .machine_env
|
||||
* `45c40d7` dk: support de --pull
|
||||
* `c921d2a` pff: support de NOUPSTREAM
|
||||
* `edf956f` dk: BRANCH peut aussi être un ^COMMIT
|
||||
* `85842f3` renommer start-screen en Sscreen
|
||||
* `e395720` maj doc
|
||||
* `4603b1a` bug
|
||||
* `a91542b` maj .gitattributes par défaut
|
||||
* `51c4c33` support sélection java 11
|
||||
* `82a7952` dm: support des aliases pour ssh aussi
|
||||
* `d1d32de` dk: bug avec update-devel
|
||||
* `037cb1a` maj template sql
|
||||
* `04d037f` support rhel8 / ol8
|
||||
* `725ba6d` cssh: donner un nom à la session
|
||||
|
||||
## Version 9.9.0 du 21/09/2020-18:08
|
||||
|
||||
* `2ec6c21` support gros doigt de python2 sur les systèmes modernes
|
||||
* `bc1a740` bug
|
||||
* `ada594a` dm: support des aliases
|
||||
* `856c948` repoctl: ajout de update-origin
|
||||
* `cc1b45d` support de l'option -u
|
||||
* `28ceb74` cosmetic
|
||||
* `751e372` bug
|
||||
* `c5e1536` support de la définition des aliases et des profils dans les répertoires de cluster
|
||||
* `14beb13` dk: support minimal maven
|
||||
* `f474657` dk: ajout de COMPOSER_ARGS
|
||||
* `1097975` cosmetic
|
||||
* `bb7a4fc` foreach: ajout de l'option -S
|
||||
* `e0e6178` dk: support de la sélection d'un service et de la machine sur laquelle tourne un service
|
||||
* `07bea2c` cx-conndev: support klean
|
||||
* `7254661` dk: support du nommage du répertoire pour le checkout
|
||||
* `fb285e0` ne vérifier conndev.php que si c'est nécessaire
|
||||
|
||||
## Version 9.8.0 du 28/04/2020-16:42
|
||||
|
||||
* `e2b2f49` dk: vérifier que le répertoire destination existe avant rsync
|
||||
* `c147a0c` dk: possibilité de spécifier les options de rsync
|
||||
|
||||
## Version 9.7.0 du 17/04/2020-10:20
|
||||
|
||||
* `f4f9b69` dk: bug avec la synchro d'un fichier
|
||||
* `74190f7` dk: par défaut, les suffixes courants sont supprimés
|
||||
* `9fad992` dk: support répertoire/fichier source
|
||||
* `1d7e2d0` bug
|
||||
* `7268cec` pff: workaround pour certaines erreurs de packaging
|
||||
* `aa26966` dk: support build args avec la syntaxe NAME=VALUE
|
||||
* `f7b3f90` dk: augmenter la largeur de la colonne node
|
||||
* `1c4c1c3` dmctl: l'option -a supporte les répertoires
|
||||
* `ccf3c67` dk: aliases de filtres
|
||||
* `1b12cee` dk: afficher un warning si le profil n'est pas défini pour une machine
|
||||
* `45976f4` dk: sta affiche le statut pour tous les services
|
||||
* `1960c0c` dk: implémenter status
|
||||
* `4f206d7` dk: frontend plus 'transparent'
|
||||
* `d666859` dk: supprimer avec image:tag si possible
|
||||
* `4ee346b` maj chemin ip
|
||||
* `c9796b2` ipaddr: frontend pour ip addr
|
||||
* `668eec1` dmctl: possibilité d'importer toutes les machines d'un répertoire
|
||||
|
||||
## Version 9.6.0 du 24/02/2020-09:13
|
||||
|
||||
* `b7492fc` dk: ajout de l'option -e
|
||||
|
|
4
EnsureVM
4
EnsureVM
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
urequire service
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS service
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: s'assurer que les services sont lancés pour un type de virtualisation
|
||||
|
|
4
SKvm
4
SKvm
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
urequire virsh
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS virsh
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: lancer une machine virtuelle kvm
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: lancer une machine virtuelle VirtualBox
|
||||
|
|
7
TODO.md
7
TODO.md
|
@ -1,10 +1,3 @@
|
|||
# TODO
|
||||
|
||||
dkbuild
|
||||
* setversion peut prendre la version depuis la branche git d'un dépôt
|
||||
* un argument permettrait de spécifier comment la version est calculée à
|
||||
partir du dépôt
|
||||
* si cela a du sens, une commande setlatest qui permet de désigner quelle
|
||||
distribution/version est la dernière
|
||||
|
||||
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary
|
|
@ -1 +1 @@
|
|||
11.3.0
|
||||
9.6.0
|
||||
|
|
2
_root
2
_root
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/ulib" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire base
|
||||
|
||||
function display_help() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
urequire template apache.tools
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS template apache.tools
|
||||
apacheconfig_initvars
|
||||
|
||||
function display_help() {
|
||||
|
|
18
authftp
18
authftp
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: Se connecter sur un site FTP authentifié
|
||||
|
@ -39,14 +40,6 @@ façon dont le proxy ftp est configuré, il n'est pas possible de se connecter
|
|||
avec un mot de passe qui contient le caractère @"
|
||||
}
|
||||
|
||||
function hostkeyfailed_apropos() {
|
||||
eecho "\
|
||||
------------------------------------------------------------------------------------
|
||||
Si le message 'Host key verification failed' apparait, lancer la commande suivante:
|
||||
ssh -o StrictHostKeyChecking=no -o BatchMode=yes $1
|
||||
------------------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
AUTHFTP_PROXY_DISABLED=1 # par défaut, ne pas utiliser le proxy
|
||||
set_defaults proxy
|
||||
set_defaults authftp
|
||||
|
@ -83,22 +76,19 @@ read_value -i "Entrez le chemin" path "$4" N
|
|||
|
||||
if [ -n "$lftp" ]; then
|
||||
if [ -n "$noproxy" ]; then
|
||||
export LFTP_PASSWORD="$password"
|
||||
if [ -n "$sftp" ]; then
|
||||
url="sftp://$host/$path"
|
||||
hostkeyfailed_apropos "$login@$host"
|
||||
else
|
||||
url="ftp://$host/$path"
|
||||
fi
|
||||
exec lftp "${options[@]}" -e "\
|
||||
set ssl:verify-certificate $verify_certificate
|
||||
open -u $login --env-password $url"
|
||||
open -u $login,$password $url"
|
||||
else
|
||||
export LFTP_PASSWORD="${password}@${my_password}"
|
||||
url="ftp://$AUTHFTP_PROXY_HOST/$path"
|
||||
exec lftp "${options[@]}" -e "\
|
||||
set ssl:verify-certificate $verify_certificate
|
||||
open -u ${login}@${my_login}@${host} --env-password $url"
|
||||
open -u ${login}@${my_login}@${host},${password}@${my_password} $url"
|
||||
fi
|
||||
else
|
||||
if [ -n "$noproxy" ]; then
|
||||
|
|
3
caturl
3
caturl
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: Afficher une url
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
u"""Afficher un chronomètre"""
|
||||
|
|
|
@ -411,7 +411,7 @@ javac* | jikes*)
|
|||
fi
|
||||
[[ ! -z "${execute:="${compilerDir}java -cp $cacheDir${classPath:+:$classPath} $mainClass"}" ]]
|
||||
# Prepare to tell javac to compile for the latest language version it supports
|
||||
sourceVersion="-source $(${compilerDir}java -version 2>&1 | sed -n '1{s/.*"\(.*\)".*/\1/; s/^1\.//; s/\..*//; p}')"
|
||||
sourceVersion="-source $(${compilerDir}java -version 2>&1 | sed -n '1s,[^"]*"\([1-9][1-9]*\.[1-9][1-9]*\).*,\1,p')"
|
||||
;;
|
||||
jikes*)
|
||||
if [[ -z "$classPath" && -z "$compilerArgs" && -z "$CLASSPATH" ]] ; then
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: créer un utilisateur sudoer et lui installer une clé publique ssh
|
||||
|
|
10
cssh
10
cssh
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: Faire une connexion ssh en lançant automatiquement un screen sur l'hôte distant
|
||||
|
@ -23,16 +24,15 @@ eval "$vars"
|
|||
[ "${#hosts[*]}" -gt 0 ] || die "Vous devez spécifier l'hôte sur lequel se connecter"
|
||||
|
||||
[ ${#args[*]} -gt 0 ] && cmd="$(qvals "${args[@]}"); " || cmd=
|
||||
cmd="$cmd
|
||||
export LOCKPRG=/bin/true; $(<"$scriptdir/Sscreen")"
|
||||
cmd="$cmd$(<"$scriptdir/start-screen")"
|
||||
cmd="'${cmd//\'/\'\\\'\'}'"
|
||||
|
||||
for host in "${hosts[@]}"; do
|
||||
"$ssh" \
|
||||
"${options[@]}" -qt "$host" -- \
|
||||
"export LOCKPRG=/bin/true; [ -x /usr/local/nutools/Sscreen ] && exec /usr/local/nutools/Sscreen $(qvals "${args[@]}") || exit 123"
|
||||
"[ -x /usr/local/nutools/start-screen ] && exec /usr/local/nutools/start-screen $(qvals "${args[@]}") || exit 123"
|
||||
if [ $? -eq 123 ]; then
|
||||
# pas de Sscreen en face, le faire à la main
|
||||
# pas de start-screen en face, le faire à la main
|
||||
${exec:+exec} \
|
||||
"$ssh" "${options[@]}" -t "$host" -- \
|
||||
/bin/bash -c "$cmd"
|
||||
|
|
52
cx-conndev
52
cx-conndev
|
@ -1,55 +1,39 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
|
||||
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: se connecter à la base MySQL
|
||||
|
||||
USAGE
|
||||
$scriptname [DATABASE]
|
||||
$scriptname -d [-uUSER [-pPASSWORD]] DATABASES... >backup.sql
|
||||
$scriptname -c [-uUSER [-pPASSWORD]] <backup.sql
|
||||
$scriptname -c|-d [-uUSER [-pPASSWORD]] ...
|
||||
|
||||
OPTIONS
|
||||
--compose-v1
|
||||
Forcer l'utilisation de docker-compose v1
|
||||
-h, -s, --service SERVICE
|
||||
Spécifier le nom du service. La valeur par défaut est db
|
||||
-i, --ipnum IPNUM
|
||||
Si le service est dans plusieurs réseaux, sélectionner le numéro du
|
||||
réseau à attaquer en commençant à 1 (la liste sera affichée si cette
|
||||
option n'est pas spécifiée)
|
||||
-c, --mysql-cmd
|
||||
Lancer 'mysql -hSERVICE_IP' avec les arguments supplémentaires fournis
|
||||
sur la ligne de commande
|
||||
-d, --mysqldump-cmd
|
||||
Lancer 'mysqldump --databases --add-drop-database -hSERVICE_IP' avec
|
||||
les arguments supplémentaires fournis sur la ligne de commande
|
||||
-k, --klean
|
||||
Lancer la commande 'klean' dans le container spécifié (supprime toutes
|
||||
les données et relance le container)
|
||||
-u, --user USER
|
||||
-p, --password PASSWORD
|
||||
Paramètres supplémentaires utilisés uniquement avec les options -c et -d"
|
||||
}
|
||||
|
||||
service=db
|
||||
ipnum=
|
||||
mysql_cmd=
|
||||
mysqldump_cmd=
|
||||
klean=
|
||||
user=
|
||||
password=
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
--compose-v1 '$DOCKER_COMPOSE=(docker-compose)'
|
||||
-h:,-s:,--service: service=
|
||||
-i:,--ipnum: ipnum=
|
||||
-c,--mysql-cmd mysql_cmd=1
|
||||
-d,--mysqldump-cmd mysqldump_cmd=1
|
||||
-k,--klean klean=1
|
||||
-u:,--user: user=
|
||||
-p:,--password: password=
|
||||
)
|
||||
|
@ -74,29 +58,17 @@ if [ -z "$first" ]; then
|
|||
enote "Le répertoire du projet est $(ppath . ~)"
|
||||
fi
|
||||
|
||||
[ -f bin/conndev.php ] || die "Impossible de trouver le script compagnon conndev.php"
|
||||
|
||||
###
|
||||
|
||||
function die_not_found() { die "$service: service introuvable. vérifiez que le projet est actuellement up"; }
|
||||
setx cid="${DOCKER_COMPOSE[@]}" ps -q "$service" 2>/dev/null || die_not_found
|
||||
setx cid=docker-compose ps -q "$service" 2>/dev/null || die_not_found
|
||||
[ -n "$cid" ] || die_not_found
|
||||
edebug "$service id: $cid"
|
||||
|
||||
function die_not_found() { die "$service: $cid: ip introuvable"; }
|
||||
setx ip=docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}},{{end}}' "$cid" || die_not_found
|
||||
[ -n "$ip" ] || die_not_found
|
||||
ipdesc="${ip%,}"
|
||||
if [ -z "$ipnum" ] && [[ "$ipdesc" == *,* ]]; then
|
||||
enote "Le service est accessible sur plusieurs adresses ip: $ipdesc"
|
||||
enote "Pensez à spécifier l'option -i pour désigner l'adresse à utiliser (-i1 pour la première, -i2 pour la seconde, etc.)"
|
||||
fi
|
||||
if [ -n "$ipnum" ]; then
|
||||
let ipnum=ipnum-1
|
||||
while [ $ipnum -gt 0 ]; do
|
||||
ip="${ip#*,}"
|
||||
let ipnum=ipnum-1
|
||||
done
|
||||
fi
|
||||
ip="${ip%%,*}"
|
||||
setx ip=docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid" || die_not_found
|
||||
[ -n "$ip" ] || die_not_found
|
||||
edebug "$service ip: $ip"
|
||||
|
||||
|
@ -106,17 +78,7 @@ if [ -n "$mysql_cmd" ]; then
|
|||
elif [ -n "$mysqldump_cmd" ]; then
|
||||
mysqldump --databases --add-drop-database -h"$ip" ${user:+-u"$user"} ${password:+-p"$password"} "$@"
|
||||
|
||||
elif [ -n "$klean" ]; then
|
||||
estep "klean"
|
||||
docker exec "$cid" klean
|
||||
estep "wait 10sec..."
|
||||
sleep 10
|
||||
estep "start"
|
||||
"${DOCKER_COMPOSE[@]}" start "$service"
|
||||
|
||||
else
|
||||
[ -f bin/conndev.php ] || die "Impossible de trouver le script compagnon conndev.php"
|
||||
|
||||
mysql_cmd="$(php bin/conndev.php "$ip" "$@")"
|
||||
edebug "mysql_cmd: $mysql_cmd"
|
||||
|
||||
|
|
22
cx-shelldev
22
cx-shelldev
|
@ -1,33 +1,29 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
|
||||
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: ouvrir un shell dans le container
|
||||
|
||||
USAGE
|
||||
$scriptname [CMD...]
|
||||
$scriptname [SHELL]
|
||||
|
||||
OPTIONS
|
||||
--compose-v1
|
||||
Forcer l'utilisation de docker-compose v1
|
||||
-h, -s, --service SERVICE
|
||||
Spécifier le nom du service sur lequel ouvrir le shell
|
||||
-d, --db
|
||||
-d
|
||||
équivalent à -s db
|
||||
-w, --web
|
||||
-w
|
||||
équivalent à -s web (c'est la valeur par défaut)"
|
||||
}
|
||||
|
||||
service=web
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
--compose-v1 '$DOCKER_COMPOSE=(docker-compose)'
|
||||
-h:,-s:,--service: service=
|
||||
-d,--db service=db
|
||||
-w,--web service=web
|
||||
-d service=db
|
||||
-w service=web
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
|
@ -52,9 +48,9 @@ fi
|
|||
|
||||
###
|
||||
|
||||
setx cid="${DOCKER_COMPOSE[@]}" ps -q "$service" 2>/dev/null || die "$service: service introuvable"
|
||||
setx cid=docker-compose ps -q "$service" 2>/dev/null || die "$service: service introuvable"
|
||||
|
||||
cmd=("$@")
|
||||
[ ${#cmd[*]} -gt 0 ] || cmd=(bash)
|
||||
|
||||
"${DOCKER_COMPOSE[@]}" exec "$service" "${cmd[@]}"
|
||||
docker-compose exec "$service" "${cmd[@]}"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: mettre à jour un module ur/* ou lib/* sans utiliser composer
|
||||
|
|
132
dmcerts
132
dmcerts
|
@ -1,132 +0,0 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
urequire install
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: gérer les certificats de docker-machine
|
||||
|
||||
Les certificats créés par docker-machine ont une durée trop courte à mon goût.
|
||||
Ce script permet de les recréer avec une durée de 30 ans pour le CA et le
|
||||
certificat client, et de 10 ans pour chaque machine
|
||||
|
||||
USAGE
|
||||
$scriptname [host]"
|
||||
}
|
||||
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
dmdir="$HOME/.docker/machine"
|
||||
|
||||
cadir="$dmdir/dmcerts"
|
||||
cakey="$cadir/dmca.key"
|
||||
cacsr="$cadir/dmca.csr"
|
||||
cacrt="$cadir/dmca.crt"
|
||||
cacrl="$cadir/dmca.crl"
|
||||
if [ ! -d "$cadir" ]; then
|
||||
enote "Le répertoire $cadir va être créé. Ne faites cela que si c'est la première fois. Sinon, récupérez le répertoire déjà créé par ailleurs"
|
||||
ask_yesno "Voulez-vous continuer?" N || die
|
||||
|
||||
mkdir "$cadir"
|
||||
chmod 700 "$cadir"
|
||||
mkdir "$cadir"/{openssl,newcerts}
|
||||
touch "$cadir/index.txt"
|
||||
echo 01 >"$cadir/serial"
|
||||
|
||||
for src in "$scriptdir"/lib/dmcerts_openssl_*.cnf; do
|
||||
dest="$cadir/openssl/${src#$scriptdir/lib/dmcerts_openssl_}"
|
||||
cp "$src" "$dest"
|
||||
done
|
||||
sed -i "s/^dir = .*/dir = ${cadir//\//\\\/}/" "$cadir/openssl/"*.cnf
|
||||
|
||||
openssl req -config "$cadir/openssl/ca.cnf" -batch -new -nodes -keyout "$cakey" -out "$cacsr" &&
|
||||
openssl ca -config "$cadir/openssl/ca.cnf" -batch -notext -out "$cacrt" -days 10950 -keyfile "$cakey" -selfsign -extensions v3_ca -infiles "$cacsr" &&
|
||||
openssl ca -config "$cadir/openssl/ca.cnf" -batch -gencrl -out "$cacrl" ||
|
||||
die "Une erreur s'est produite. Veuillez supprimer $cadir et recommencer"
|
||||
fi
|
||||
|
||||
clientkey="$cadir/dmclient.key"
|
||||
clientcsr="$cadir/dmclient.csr"
|
||||
clientcrt="$cadir/dmclient.crt"
|
||||
clientcnf="$cadir/openssl/client.cnf"
|
||||
if [ ! -f "$clientcrt" ]; then
|
||||
#sed -i "s/^dir = .*/dir = ${cadir//\//\\\/}/" "$clientcnf"
|
||||
|
||||
subj="/countryName=FR/stateOrProvinceName=La Reunion/localityName=Sainte Clotilde/organizationName=jclain/CN=dmclient/"
|
||||
openssl req -config "$clientcnf" -batch -new -nodes -subj "$subj" -keyout "$clientkey" -out "$clientcsr" &&
|
||||
openssl ca -config "$clientcnf" -batch -keyfile "$cakey" -notext -out "$clientcrt" -infiles "$clientcsr" &&
|
||||
chmod 644 "$clientcrt" &&
|
||||
chmod 600 "$clientkey" &&
|
||||
rm -f "$clientcsr" ||
|
||||
die "Une erreur s'est produite pendant la génération du certificat client"
|
||||
fi
|
||||
|
||||
estep "Vérification certificats locaux"
|
||||
copy_update "$cacrt" "$dmdir/certs/ca.pem"
|
||||
copy_update "$cakey" "$dmdir/certs/ca-key.pem"
|
||||
copy_update "$clientcrt" "$dmdir/certs/cert.pem"
|
||||
copy_update "$clientkey" "$dmdir/certs/key.pem"
|
||||
|
||||
first=1
|
||||
for host in "$@"; do
|
||||
if [ -n "$first" ]; then
|
||||
servercnf="$cadir/openssl/server.cnf"
|
||||
#sed -i "s/^dir = .*/dir = ${cadir//\//\\\/}/" "$servercnf"
|
||||
else
|
||||
first=
|
||||
fi
|
||||
|
||||
etitle "$host"
|
||||
machine="${host%%.*}"
|
||||
machinedir="$dmdir/machines/$machine"
|
||||
if [ ! -d "$machinedir" ]; then
|
||||
eerror "$machine: machine inexistante"
|
||||
fi
|
||||
|
||||
serverkey="${machine}-server.key"
|
||||
servercsr="${machine}-server.csr"
|
||||
servercrt="${machine}-server.crt"
|
||||
if [ ! -f "$servercrt" ]; then
|
||||
subj="/countryName=FR/stateOrProvinceName=La Reunion/localityName=Sainte Clotilde/organizationName=jclain/CN=dmserver-$host/"
|
||||
sans="DNS:$host,DNS:localhost"
|
||||
sed -i "s/^subjectAltName = .*/subjectAltName = $sans/" "$servercnf"
|
||||
openssl req -config "$servercnf" -batch -new -nodes -subj "$subj" -keyout "$serverkey" -out "$servercsr" &&
|
||||
openssl ca -config "$servercnf" -batch -keyfile "$cakey" -notext -out "$servercrt" -infiles "$servercsr" &&
|
||||
chmod 644 "$servercrt" &&
|
||||
chmod 600 "$serverkey" &&
|
||||
rm -f "$servercsr" ||
|
||||
die "Une erreur s'est produite pendant la génération du certificat serveur"
|
||||
fi
|
||||
|
||||
estep "machine: $machine"
|
||||
ask_yesno "Voulez-vous remplacer les certificats distants et locaux?" O || continue
|
||||
|
||||
estep "Copie distante"
|
||||
scp "$cacrt" "root@$host:/etc/docker/ca.pem" || die
|
||||
scp "$servercrt" "root@$host:/etc/docker/server.pem" || die
|
||||
scp "$serverkey" "root@$host:/etc/docker/server-key.pem" || die
|
||||
|
||||
estep "Redémarrage docker distant"
|
||||
ssh "root@$host" "service docker restart" || die
|
||||
|
||||
estep "Copie locale"
|
||||
copy_update "$cacrt" "$machinedir/ca.pem"
|
||||
copy_update "$cakey" "$machinedir/ca-key.pem"
|
||||
copy_update "$clientcrt" "$machinedir/cert.pem"
|
||||
copy_update "$clientkey" "$machinedir/key.pem"
|
||||
copy_update "$servercrt" "$machinedir/server.pem"
|
||||
copy_update "$serverkey" "$machinedir/server-key.pem"
|
||||
|
||||
estep "Test de l'accès au serveur"
|
||||
setx env=docker-machine env "$machine" || die
|
||||
eval "$env"
|
||||
echo "$machine docker version: $(docker system info -f '{{.ServerVersion}}')"
|
||||
|
||||
estep "Suppression des fichiers temporaires"
|
||||
rm -f "$servercrt" "$serverkey"
|
||||
done
|
||||
|
||||
enote "N'oubliez pas de re-exporter les docker-machines qui ont été regénérées"
|
18
dmctl
18
dmctl
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source /etc/ulibauto || exit 1
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: import/exporter une docker-machine
|
||||
|
@ -14,9 +14,9 @@ OPTIONS
|
|||
-d, --dump
|
||||
Exporter la machine
|
||||
-l, --load
|
||||
Importer la machine à partir de l'archive spécifiée
|
||||
Import la machine
|
||||
-a, --load-all
|
||||
Importer toutes les machines depuis le répertoire spécifié"
|
||||
Importer toutes les machines"
|
||||
}
|
||||
|
||||
function dump_machine() {
|
||||
|
@ -129,16 +129,8 @@ if [ -z "$action" ]; then
|
|||
fi
|
||||
|
||||
case "$action" in
|
||||
dump)
|
||||
dump_machine "$1"
|
||||
;;
|
||||
load)
|
||||
for archive in "$@"; do
|
||||
etitle "$archive"
|
||||
load_machine "$archive"
|
||||
eend
|
||||
done
|
||||
;;
|
||||
dump) dump_machine "$1";;
|
||||
load) load_machine "$1";;
|
||||
loadall)
|
||||
[ $# -gt 0 ] || set -- .
|
||||
archives=()
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/b/t/
|
|
@ -0,0 +1,2 @@
|
|||
/b/
|
||||
/build.env.local
|
|
@ -0,0 +1,12 @@
|
|||
FROM ur/d9base
|
||||
|
||||
ARG date
|
||||
ARG version
|
||||
LABEL date=$date version=$version
|
||||
|
||||
ENV I=/install/nutools
|
||||
COPY . $I
|
||||
RUN $I/uinst -y $I && rm -rf $I
|
||||
|
||||
ENV PATH="$PATH:/usr/local/nutools"
|
||||
CMD ["/bin/bash", "-il"]
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source /etc/ulibauto || exit 1
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: construire $NAME
|
||||
|
||||
USAGE
|
||||
$scriptname [options]
|
||||
|
||||
OPTIONS
|
||||
-b, --build
|
||||
-n, --no-cache"
|
||||
}
|
||||
|
||||
function do_prereqs() {
|
||||
:
|
||||
}
|
||||
function do_build() {
|
||||
local date; local -a args
|
||||
setx date=date +%y%m%d
|
||||
args=(
|
||||
-f Dockerfile
|
||||
-t $NAME:latest
|
||||
--build-arg "date=$date"
|
||||
${no_cache:+--no-cache}
|
||||
)
|
||||
|
||||
etitle "Création de l'image docker $NAME" \
|
||||
docker build "${args[@]}" "$CTXDIR"
|
||||
}
|
||||
function do_run() {
|
||||
docker run -it --rm "$NAME"
|
||||
}
|
||||
|
||||
cd "$scriptdir"
|
||||
source ./build.env || die "Impossible de trouver build.env"
|
||||
[ -f build.env.local ] && source build.env.local
|
||||
|
||||
auto=1
|
||||
prereqs=
|
||||
build=
|
||||
no_cache=
|
||||
run=
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
--prereqs '$prereqs=1; auto='
|
||||
-b,--build '$build=1; auto='
|
||||
-n,--no-cache no_cache=1
|
||||
-r,--run '$run=1; auto='
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
if [ -n "$prereqs" ]; then
|
||||
build=
|
||||
run=
|
||||
elif [ -n "$auto" ]; then
|
||||
build=1
|
||||
fi
|
||||
|
||||
if [ -n "$prereqs" ]; then
|
||||
do_prereqs "$@" || die
|
||||
fi
|
||||
|
||||
if [ -n "$build" ]; then
|
||||
do_build "$@" || die
|
||||
fi
|
||||
|
||||
if [ -n "$run" ]; then
|
||||
do_run "$@" || die
|
||||
fi
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Nom de l'image
|
||||
NAME=ur/nutools
|
||||
# Build context pour docker
|
||||
CTXDIR=..
|
||||
# Répertoire contenant les fichiers nécessaire au build
|
||||
BUILDDIR=b
|
||||
# Répertoire temporaire pour construire les fichiers de BUILDDIR. Ce répertoire
|
||||
# n'est pas transmis au daemon docker
|
||||
TRANSDIR=b/t
|
||||
|
||||
# Fonctions spécifiques
|
||||
#function do_prereqs() { :; }
|
||||
#function do_build() { :; }
|
||||
#function do_run() { :; }
|
|
@ -11,7 +11,7 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
source "$(dirname -- "$0")/lib/ulib/ulib" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire base
|
||||
|
||||
function display_help() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: afficher les connexions TCP entrantes sur un port
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
urequire ipcalc
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS ipcalc
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: s'assurer que l'hôte courant a l'adresse IP spécifiée
|
||||
|
|
3
fconv
3
fconv
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: convertir un fichier ou les fichiers d'un répertoire
|
||||
|
|
3
fnconv
3
fnconv
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: renommer un fichier ou les fichiers d'un répertoire
|
||||
|
|
3
fndate
3
fndate
|
@ -11,7 +11,8 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: manipuler des noms de fichier pour les dater
|
||||
|
|
17
foreach
17
foreach
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: lancer une commande pour un ensemble d'arguments
|
||||
|
@ -80,9 +81,6 @@ OPTIONS
|
|||
la commande. Par défaut, l'affichage est effectué.
|
||||
Avec --parent-title, pour chaque correspondance afficher plutôt le
|
||||
répertoire parent (valide uniquement avec l'option -p)
|
||||
-S, --git-status
|
||||
Equivalent à spécifier la commande 'git status --p'
|
||||
Utiliser par exemple avec -g, -G ou -C
|
||||
-G, --git-projects
|
||||
Equivalent à '--ptitle -p */.git --' e.g '$scriptname -G git pull' pour
|
||||
mettre à jour les dépôts situés dans un répertoire
|
||||
|
@ -98,7 +96,6 @@ changedir=
|
|||
parentdir=
|
||||
expand=1
|
||||
title=auto
|
||||
command=
|
||||
shortcut=
|
||||
args=(+
|
||||
--help '$exit_with display_help'
|
||||
|
@ -114,22 +111,12 @@ args=(+
|
|||
--title title=1
|
||||
--pt,--parent-title title=p
|
||||
--nt,--no-title title=
|
||||
-S,--git-status command=git-status-p
|
||||
-G,--git-projects shortcut=git
|
||||
-C,--composer-projects shortcut=composer
|
||||
--cc,--composer-cmd shortcut=composer-cmd
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
case "$command" in
|
||||
git-status-p)
|
||||
if [ -n "$shortcut" ]; then
|
||||
set -- git status --p "$@"
|
||||
else
|
||||
set -- "$@" -- git status --p
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
case "$shortcut" in
|
||||
git)
|
||||
set -- */.git -- "$@"
|
||||
|
|
3
geturl
3
geturl
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
||||
urequire DEFAULTS
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: Télécharger un fichier avec wget ou curl
|
||||
|
|
4
ipaddr
4
ipaddr
|
@ -7,9 +7,7 @@ elif [ -x /bin/ip ]; then IP=/bin/ip
|
|||
else IP=ip
|
||||
fi
|
||||
|
||||
if [ -n "IPADDR_COLOR" ]; then isatty=1
|
||||
else tty -s <&1 && isatty=1 || isatty=
|
||||
fi
|
||||
tty -s <&1 && isatty=1 || isatty=
|
||||
|
||||
"$IP" addr "$@" | awk -v isatty="$isatty" '
|
||||
isatty && $0 ~ /^[0-9]/ {
|
||||
|
|
33
ldiff
33
ldiff
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: frontend de diff pour comparer deux fichiers encodés en latin1
|
||||
|
||||
USAGE
|
||||
$scriptname [options] Lfile Rfile
|
||||
|
||||
OPTIONS
|
||||
-u, -U, --unified N
|
||||
-w, --ignore-all-space
|
||||
-B, --ignore-blank-lines
|
||||
options de diff qui sont reprises telles quelles"
|
||||
}
|
||||
|
||||
diffopts=()
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
-u '$diffopts+=(-u)'
|
||||
-U:,--unified: '$diffopts+=(-U "$value_")'
|
||||
-w,--ignore-all-space '$diffopts+=(-w)'
|
||||
-B,--ignore-blank-lines '$diffopts+=(-B)'
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
Lfile="$1"
|
||||
Rfile="$2"
|
||||
[ -n "$Lfile" -a -n "$Rfile" ] || die "vous devez spécifier les deux fichiers"
|
||||
[ -d "$Lfile" -o -d "$Rfile" ] && die "il faut absolument comparer deux fichiers"
|
||||
|
||||
diff "${diffopts[@]}" <(iconv -f latin1 -t utf-8 "$Lfile") <(iconv -f latin1 -t utf-8 "$Rfile")
|
41
lgrep
41
lgrep
|
@ -1,41 +0,0 @@
|
|||
#!/bin/bash
|
||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
||||
|
||||
function display_help() {
|
||||
uecho "$scriptname: frontend de grep pour chercher dans un fichier encodé en latin1
|
||||
|
||||
USAGE
|
||||
$scriptname [options] FILE
|
||||
|
||||
OPTIONS
|
||||
options de grep qui sont reprises telles quelles"
|
||||
}
|
||||
|
||||
grepopts=()
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
-E,--extended-regexp '$grepopts+=(-E)'
|
||||
-F,--fixed-strings '$grepopts+=(-F)'
|
||||
-G,--basic-regexp '$grepopts+=(-G)'
|
||||
-P,--perl-regexp '$grepopts+=(-P)'
|
||||
-i,--ignore-case '$grepopts+=(-i)'
|
||||
-v,--invert-match '$grepopts+=(-v)'
|
||||
-L,--files-without-match '$grepopts+=(-L)'
|
||||
-l,--files-with-matches '$grepopts+=(-l)'
|
||||
-q,--quiet,--silent '$grepopts+=(-q)'
|
||||
-s,--no-messages '$grepopts+=(-s)'
|
||||
-H,--with-filename '$grepopts+=(-H)'
|
||||
-h,--no-filename '$grepopts+=(-h)'
|
||||
-a,--text '$grepopts+=(-a)'
|
||||
-r,--recursive '$grepopts+=(-r)'
|
||||
-R,--dereference-recursive '$grepopts+=(-R)'
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
pattern="$1"
|
||||
args=("${@:2}")
|
||||
#XXX ajouter le support de -r, -h, -H, notamment si ${args[@]} contient un
|
||||
# répertoire
|
||||
|
||||
iconv -f latin1 -t utf-8 "${args[@]}" | grep "${grepopts[@]}" "$pattern"
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
u"""%(scriptname)s: afficher le hash SHA-1 d'un fichier exprimé en base 36
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
|
||||
function __bash_completion_enabled() { return 1; }
|
||||
function __bash_completion_module_enabled() { return 1; }
|
||||
_file=
|
||||
if [ -n "$UTOOLS_BASH_COMPLETION_COMPAT" ]; then
|
||||
_file="@@dest@@/lib/ulib/$UTOOLS_BASH_COMPLETION_COMPAT/bash_completion"
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
if [ -f /etc/debian_version ]; then
|
||||
case "$(</etc/debian_version)" in
|
||||
6*|squeeze*)
|
||||
# le code suivant n'est compatible qu'avec debian squeeze (plus
|
||||
|
@ -20,9 +17,9 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
|
|||
_file="@@dest@@/lib/ulib/bash41/bash_completion"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
[ -f "$_file" ] && source "$_file"
|
||||
unset _file
|
||||
fi
|
||||
if __bash_completion_enabled; then
|
||||
for i in "@@dest@@/lib/completion.d/"*; do
|
||||
[ -f "$i" ] || continue
|
||||
|
|
|
@ -1,52 +1,11 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
if [ -n "$UTOOLS_DOCKER_ALIASES" ]; then
|
||||
#if [ "$DOCKER_MACHINE_WRAPPED" == true ]; then
|
||||
# alias dm=__docker_machine_wrapper
|
||||
#else
|
||||
# alias dm=docker-machine
|
||||
#fi
|
||||
function dm() {
|
||||
case "$1" in
|
||||
use|ssh)
|
||||
if [ -n "$2" -a -f ~/etc/default/dk ]; then
|
||||
# chercher les aliases éventuels
|
||||
local cmd="$1"; shift
|
||||
local machine="$1"; shift
|
||||
machine="$(
|
||||
CLUSTERDIRS=()
|
||||
DM_ALIASES=()
|
||||
source ~/etc/default/dk
|
||||
for alias_machine in "${DM_ALIASES[@]}"; do
|
||||
if [ "${alias_machine%%:*}" == "$machine" ]; then
|
||||
echo "${alias_machine#*:}"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
for clusterdir in "${CLUSTERDIRS[@]}"; do
|
||||
if [ -f "$clusterdir/0config/configure.conf" ]; then
|
||||
DM_ALIASES=()
|
||||
source "$clusterdir/0config/configure.conf"
|
||||
for alias_machine in "${DM_ALIASES[@]}"; do
|
||||
if [ "${alias_machine%%:*}" == "$machine" ]; then
|
||||
echo "${alias_machine#*:}"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
echo "$machine"
|
||||
)"
|
||||
set -- "$cmd" "$machine" "$@"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ "$DOCKER_MACHINE_WRAPPED" == true ]; then
|
||||
__docker_machine_wrapper "$@"
|
||||
alias dm=__docker_machine_wrapper
|
||||
else
|
||||
docker-machine "$@"
|
||||
alias dm=docker-machine
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
|
||||
complete -F _docker_machine dm
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
# Activer l'auto complétion de bash pour les outils de nutools
|
||||
#export UTOOLS_BASH_COMPLETION=1
|
||||
#export UTOOLS_BASH_COMPLETION_COMPAT=bash41
|
||||
|
||||
# utools utilise su plutôt que sudo pour la fonction run_as_root et le script
|
||||
# _root. Par défaut, ce n'est le cas que si sudo n'est pas installé. Si sudo est
|
||||
|
|
|
@ -3,22 +3,8 @@
|
|||
# Profil par défaut
|
||||
#PROFILE=prod
|
||||
|
||||
# Aliases pour docker-machine
|
||||
#DM_ALIASES=(alias:name)
|
||||
|
||||
# Profiles pour docker-machine
|
||||
#DM_PROFILES=(name:profile...)
|
||||
|
||||
# Répertoires de gestion de cluster. Dans chacun de ces répertoires, le fichier
|
||||
# 0config/configure.conf est sourcé à la recherche de définitions de profils et
|
||||
# d'aliases
|
||||
#CLUSTERDIRS=(~/wop/containers/*.univ.run)
|
||||
|
||||
# Répertoire de base par défaut des projets en mode devel
|
||||
#DEFAULT_DEVEL_SRCDIR="$HOME/wop"
|
||||
#COMPOSER_DEVEL_SRCDIR="$HOME/wop/php"
|
||||
#MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
||||
|
||||
# Image à utiliser pour les builds
|
||||
#DEFAULT_COMPOSER_IMAGE=pubdocker.univ-reunion.fr/image/php:d11
|
||||
#DEFAULT_MAVEN_IMAGE=pubdocker.univ-reunion.fr/image/javabuilder:d11
|
||||
# Image à utiliser pour lancer composer
|
||||
#COMPOSER_IMAGE=docker.univ-reunion.fr/image/apache-php-myiccas-utils:d10
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
default_profile "${DKBUILD_PROFILE:-prod}"
|
||||
|
||||
if profile jclain; then
|
||||
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
|
|
@ -1 +0,0 @@
|
|||
php
|
|
@ -1,3 +0,0 @@
|
|||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
|
@ -1,2 +0,0 @@
|
|||
.~lock*#
|
||||
.*.swp
|
|
@ -1,3 +0,0 @@
|
|||
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
FROM $REGISTRY/debian/min:$DIST
|
||||
#RUN /debian/pkg i
|
|
@ -1,2 +0,0 @@
|
|||
/b/t/
|
||||
**/.git/
|
|
@ -1,3 +0,0 @@
|
|||
/b/
|
||||
/Dockerfile
|
||||
# autogénéré
|
|
@ -1,11 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setdists d11
|
||||
|
||||
# fichiers communs
|
||||
copy ../common/ ./ gitignore=.
|
||||
|
||||
dockerfile "" Dockerfile.in sed="
|
||||
s/\\\$REGISTRY/$REGISTRY/
|
||||
s/\\\$DIST/$DIST/
|
||||
"
|
||||
build
|
|
@ -1 +0,0 @@
|
|||
../dkbuild.env
|
|
@ -1,9 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
dists=(
|
||||
d11
|
||||
)
|
||||
setdists "${dists[@]}"
|
||||
|
||||
if dist d11; then
|
||||
include d11
|
||||
fi
|
|
@ -1,3 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||
setenv IMAGE=$REGISTRY/GROUP/NAME
|
|
@ -1,3 +0,0 @@
|
|||
/Dockerfile
|
||||
.~lock*#
|
||||
.*.swp
|
|
@ -1,25 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
if profile prod; then
|
||||
default checkout branch=master
|
||||
elif profile test devel; then
|
||||
default checkout branch=develop
|
||||
fi
|
||||
default composer image=$REGISTRY/image/phpbuilder:$DIST
|
||||
|
||||
## web ########################################################################
|
||||
checkout https://git.univ-reunion.fr/sda-php/NAME-app b/web
|
||||
composer b/web
|
||||
|
||||
dockerfile
|
||||
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
FROM $REGISTRY/image/apache-php-myiccas:$DIST
|
||||
#RUN /debian/pkg i
|
||||
|
||||
#ENV MSMTP_ENABLE=1
|
||||
#COPY b/web/config/msmtp /msmtp-config
|
||||
COPY b/web/config/ssl /ssl-config
|
||||
COPY b/web/config/apache /apache-config
|
||||
COPY b/web/config/php /php-config
|
||||
#COPY b/web/config/before-start-apache /
|
||||
COPY b/web /var/www/app
|
||||
build
|
|
@ -1,4 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||
setenv IMAGE=$REGISTRY/GROUP/NAME
|
||||
setenv DIST=d11
|
|
@ -1,6 +0,0 @@
|
|||
/docker-compose.yml
|
||||
/docker-compose.*.yml
|
||||
/web/Dockerfile
|
||||
/db/Dockerfile
|
||||
.~lock*#
|
||||
.*.swp
|
|
@ -1,37 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setprofiles prod test devel
|
||||
|
||||
if profile prod; then
|
||||
default checkout branch=master
|
||||
elif profile test devel; then
|
||||
default checkout branch=develop
|
||||
fi
|
||||
default composer image=$REGISTRY/image/phpbuilder:$DIST
|
||||
|
||||
## web ########################################################################
|
||||
|
||||
checkout https://git.univ-reunion.fr/sda-php/NAME-app web/b/web
|
||||
composer web/b/web
|
||||
|
||||
dockerfile context=web
|
||||
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
FROM $REGISTRY/image/apache-php-myiccas:$DIST
|
||||
#RUN /debian/pkg i
|
||||
|
||||
#ENV MSMTP_ENABLE=1
|
||||
#COPY b/web/config/msmtp /msmtp-config
|
||||
COPY b/web/config/ssl /ssl-config
|
||||
COPY b/web/config/apache /apache-config
|
||||
COPY b/web/config/php /php-config
|
||||
#COPY b/web/config/before-start-apache /
|
||||
COPY b/web /var/www/app
|
||||
|
||||
## db #########################################################################
|
||||
|
||||
copy web/b/web/config/sqlmig db/config/mariadb/sqlmig
|
||||
|
||||
dockerfile context=db
|
||||
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
FROM $REGISTRY/image/mariadb:$DIST
|
||||
|
||||
COPY config/mariadb /mariadb-config
|
|
@ -1,4 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||
setenv IMAGE=$REGISTRY/GROUP/NAME
|
||||
setenv DIST=d11
|
|
@ -1,12 +0,0 @@
|
|||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: $REGISTRY/devel/GROUP/NAME-db
|
||||
|
||||
web:
|
||||
image: $REGISTRY/devel/GROUP/NAME-web
|
||||
environment:
|
||||
- APP_PROFILE=devel
|
||||
- BASE_URL=http://NAME.self
|
|
@ -1,14 +0,0 @@
|
|||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: $REGISTRY/GROUP/NAME-db
|
||||
|
||||
web:
|
||||
image: $REGISTRY/GROUP/NAME-web
|
||||
environment:
|
||||
- APP_PROFILE=prod
|
||||
- BASE_URL=https://NAME.univ-reunion.fr
|
||||
extra_hosts:
|
||||
- "casn.univ-reunion.fr:10.85.1.15"
|
|
@ -1,14 +0,0 @@
|
|||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: $REGISTRY/test/GROUP/NAME-db
|
||||
|
||||
web:
|
||||
image: $REGISTRY/test/GROUP/NAME-web
|
||||
environment:
|
||||
- APP_PROFILE=test
|
||||
- BASE_URL=https://NAME-test.univ-reunion.fr
|
||||
extra_hosts:
|
||||
- "casn.univ-reunion.fr:10.85.1.15"
|
|
@ -1,34 +0,0 @@
|
|||
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
db:
|
||||
build: db
|
||||
volumes:
|
||||
- db-data:/var/lib/mysql
|
||||
networks:
|
||||
default:
|
||||
aliases:
|
||||
- NAMEdb
|
||||
deploy:
|
||||
update_config:
|
||||
order: stop-first
|
||||
|
||||
web:
|
||||
build: web
|
||||
volumes:
|
||||
- log-data:/var/log/apache2
|
||||
- session-data:/var/lib/php/sessions
|
||||
extra_hosts:
|
||||
- "smtp.univ.run:10.82.70.46"
|
||||
- "vs-apoprod-bdd.univ.run:10.82.91.11"
|
||||
- "vs-apotest-bdd.univ.run:10.82.91.13"
|
||||
- "vs-apodevp-bdd.univ.run:10.82.91.15"
|
||||
deploy:
|
||||
update_config:
|
||||
order: start-first
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
log-data:
|
||||
session-data:
|
|
@ -1,8 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
# Description des templates de ce répertoire
|
||||
|
||||
TEMPLATES=(
|
||||
[image]="Image générique basée sur debian"
|
||||
[php]="Application web PHP"
|
||||
[php_db]="Application web PHP avec base de données"
|
||||
)
|
|
@ -1,5 +0,0 @@
|
|||
/Dockerfile
|
||||
/src
|
||||
/dest
|
||||
/srcdir/
|
||||
/destdir/
|
|
@ -1,8 +0,0 @@
|
|||
# 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 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setenv REGISTRY=docker.jclain.fr
|
|
@ -1,16 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
section "variables de build"
|
||||
setarg A="arg A"
|
||||
resetarg B="arg B"
|
||||
|
||||
info "A=${ARGS[A]}, B=${ARGS[B]}"
|
||||
if [ "${ARGS[A]}" != x ]; then
|
||||
note "\
|
||||
Essayer de relancer avec
|
||||
$(qvals dkbuild -j "$(relpath "$DKBUILD")" --arg A=x --arg B=y)
|
||||
on ne devrait pas pouvoir modifier la valeur de B"
|
||||
fi
|
||||
|
||||
# pas de build automatique
|
||||
AUTOBUILD=
|
|
@ -1,13 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setenv REGISTRY=pubdocker.univ-reunion.fr
|
||||
setenv IMAGE=$REGISTRY/group/name
|
||||
|
||||
info "IMAGE=$IMAGE"
|
||||
if [ "$REGISTRY" == pubdocker.univ-reunion.fr ]; then
|
||||
note "\
|
||||
Essayer de relancer avec
|
||||
$(qvals dkbuild -j "$(relpath "$DKBUILD")" -c registry.env)
|
||||
La valeur de IMAGE devrait changer"
|
||||
fi
|
||||
|
||||
AUTOBUILD=
|
|
@ -1,15 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
run rm -rf src dest srcdir destdir
|
||||
|
||||
run mkdir srcdir
|
||||
genfile srcdir/src <<<"file"
|
||||
run ln -s src srcdir/link
|
||||
|
||||
copy srcdir destdir
|
||||
if run; then
|
||||
[ -f destdir/src ] || die "destdir/src n'a pas été créé"
|
||||
diff -qr srcdir destdir || die "srcdir et destdir ne sont pas identiques"
|
||||
fi
|
||||
|
||||
AUTOBUILD=
|
|
@ -1,13 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
run rm -rf src dest srcdir destdir
|
||||
|
||||
run mkdir srcdir
|
||||
genfile srcdir/src <<<"file"
|
||||
run ln -s src srcdir/link
|
||||
genfile dest <<<"dest"
|
||||
|
||||
copy srcdir dest
|
||||
info "on ne devrait pas arriver ici"
|
||||
|
||||
AUTOBUILD=
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setdists v1-d11 v2-d11 v1-d10
|
||||
setenv IMAGE=dkbuild-tests/distversions
|
||||
|
||||
dockerfile
|
||||
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
FROM scratch
|
||||
ENV var=$DIST-$VERSION
|
||||
build
|
||||
|
||||
info "vérifier les images construites avec
|
||||
dk ls dkbuild-tests/distversions
|
||||
on devrait avoir les images suivantes:
|
||||
dkbuild-tests/distversions:v1-d10
|
||||
dkbuild-tests/distversions:d10 -> v1-d10
|
||||
dkbuild-tests/distversions:v1-d11
|
||||
dkbuild-tests/distversions:v2-d11
|
||||
dkbuild-tests/distversions:d11 -> v2-d11
|
||||
dkbuild-tests/distversions:latest -> v2-d11
|
||||
"
|
|
@ -1,14 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
run rm -rf src dest srcdir destdir
|
||||
|
||||
genfile src <<<"file"
|
||||
run mkdir destdir
|
||||
|
||||
copy src destdir
|
||||
if run; then
|
||||
[ -f destdir/src ] || die "destdir/src n'a pas été créé"
|
||||
diff -q src destdir/src || die "src et destdir/src ne sont pas identiques"
|
||||
fi
|
||||
|
||||
AUTOBUILD=
|
|
@ -1,13 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
run rm -rf src dest srcdir destdir
|
||||
|
||||
genfile src <<<"file"
|
||||
|
||||
copy src dest
|
||||
if run; then
|
||||
[ -f dest ] || die "dest n'a pas été créé"
|
||||
diff -q src dest || die "src et dest ne sont pas identiques"
|
||||
fi
|
||||
|
||||
AUTOBUILD=
|
|
@ -1,27 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
run rm -rf src dest srcdir destdir
|
||||
|
||||
run mkdir srcdir
|
||||
genfile srcdir/src <<<"file"
|
||||
run ln -s src srcdir/link
|
||||
|
||||
run mkdir destdir
|
||||
genfile destdir/.gitignore <<<"/a/"
|
||||
|
||||
copy srcdir destdir/a gitignore=destdir
|
||||
copy srcdir destdir/b gitignore=destdir
|
||||
if run; then
|
||||
[ -f destdir/a/src ] || die "destdir/a/src n'a pas été créé"
|
||||
[ -f destdir/b/src ] || die "destdir/b/src n'a pas été créé"
|
||||
[ -L destdir/a/link ] || die "destdir/a/link n'a pas été créé"
|
||||
[ -L destdir/b/link ] || die "destdir/b/link n'a pas été créé"
|
||||
ignored="$(<destdir/.gitignore)"
|
||||
expected="\
|
||||
/a/
|
||||
/b/link
|
||||
/b/src"
|
||||
[ "$ignored" == "$expected" ] || die "les fichiers n'ont pas été ignorés"
|
||||
fi
|
||||
|
||||
AUTOBUILD=
|
|
@ -1,13 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setdists d11 d10
|
||||
setprofiles prod test
|
||||
|
||||
if dist LATEST; then
|
||||
info "$DIST est la distribution la plus récente"
|
||||
fi
|
||||
if profile DEFAULT; then
|
||||
info "$PROFILE est le profil par défaut"
|
||||
fi
|
||||
|
||||
# pas de build automatique
|
||||
AUTOBUILD=
|
|
@ -1,10 +0,0 @@
|
|||
# -*- 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=
|
|
@ -1,10 +0,0 @@
|
|||
# -*- 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=
|
|
@ -1,16 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
if machine fast5; then
|
||||
setprofiles prod
|
||||
elif machine fast4; then
|
||||
setprofiles test
|
||||
else
|
||||
setprofiles devel test prod
|
||||
fi
|
||||
|
||||
if run; then
|
||||
echo "PROFILE=$PROFILE"
|
||||
fi
|
||||
|
||||
# pas de build automatique
|
||||
AUTOBUILD=
|
|
@ -1,16 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
section "première section"
|
||||
note "une note"
|
||||
info "une première info"
|
||||
info "une deuxième info"
|
||||
debug "message de debug"
|
||||
|
||||
section "deuxième section"
|
||||
note "une note"
|
||||
info "une première info"
|
||||
info "une deuxième info"
|
||||
debug "message de debug"
|
||||
|
||||
# pas de build automatique
|
||||
AUTOBUILD=
|
|
@ -1,8 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setenv IMAGE=dkbuild-tests/tags0
|
||||
|
||||
dockerfile
|
||||
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
FROM scratch
|
||||
ENV var=empty
|
||||
build
|
|
@ -1,9 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
setprofiles v1-prod v2-prod
|
||||
setenv IMAGE=dkbuild-tests/tags1
|
||||
|
||||
dockerfile
|
||||
# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
FROM scratch
|
||||
ENV var=empty
|
||||
build
|
|
@ -1,16 +0,0 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
section "variables d'environnement"
|
||||
setenv A="env A"
|
||||
resetenv B="env B"
|
||||
|
||||
info "A=$A, B=$B"
|
||||
if [ "$A" != x ]; then
|
||||
note "\
|
||||
Essayer de relancer avec
|
||||
$(qvals dkbuild -j "$(relpath "$DKBUILD")" -e A=x -e B=y)
|
||||
on ne devrait pas pouvoir modifier la valeur de B"
|
||||
fi
|
||||
|
||||
# pas de build automatique
|
||||
AUTOBUILD=
|
|
@ -1,106 +0,0 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
[ca]
|
||||
default_ca = dmca
|
||||
|
||||
[dmca]
|
||||
dir = @@cadir@@
|
||||
certs = $dir/certs
|
||||
crl_dir = $dir/crl
|
||||
database = $dir/index.txt
|
||||
unique_subject = no
|
||||
new_certs_dir = $dir/newcerts
|
||||
|
||||
certificate = $dir/dmca.crt
|
||||
serial = $dir/serial
|
||||
crl = $dir/dmca.crl
|
||||
private_key = $dir/dmca.key
|
||||
RANDFILE = $dir/private/.rand
|
||||
|
||||
x509_extensions = usr_cert
|
||||
|
||||
name_opt = ca_default
|
||||
cert_opt = ca_default
|
||||
|
||||
default_days = 10950
|
||||
default_crl_days = 30
|
||||
default_md = sha256
|
||||
preserve = no
|
||||
|
||||
policy = policy_match
|
||||
|
||||
[policy_match]
|
||||
countryName = match
|
||||
stateOrProvinceName = match
|
||||
organizationName = match
|
||||
organizationalUnitName = optional
|
||||
commonName = supplied
|
||||
emailAddress = optional
|
||||
|
||||
[req]
|
||||
default_bits = 2048
|
||||
default_md = sha256
|
||||
default_keyfile = privkey.pem
|
||||
distinguished_name = req_distinguished_name
|
||||
attributes = req_attributes
|
||||
x509_extensions = v3_ca
|
||||
string_mask = utf8only
|
||||
|
||||
[req_distinguished_name]
|
||||
countryName = Country Name (2 letter code)
|
||||
countryName_default = FR
|
||||
countryName_min = 2
|
||||
countryName_max = 2
|
||||
|
||||
stateOrProvinceName = State or Province Name (full name)
|
||||
stateOrProvinceName_default = La Reunion
|
||||
|
||||
localityName = Locality Name (eg, city)
|
||||
localityName_default = Sainte-Clotilde
|
||||
|
||||
0.organizationName = Organization Name (eg, company)
|
||||
0.organizationName_default = jclain
|
||||
|
||||
organizationalUnitName = Organizational Unit Name (eg, section)
|
||||
organizationalUnitName_default =
|
||||
|
||||
commonName = Common Name (eg, your name or your server\'s hostname)
|
||||
commonName_default = dmca
|
||||
commonName_max = 64
|
||||
|
||||
emailAddress = Email Address
|
||||
emailAddress_default = jephte.clain@univ-reunion.fr
|
||||
emailAddress_max = 64
|
||||
|
||||
[req_attributes]
|
||||
challengePassword = A challenge password
|
||||
challengePassword_min = 4
|
||||
challengePassword_max = 20
|
||||
|
||||
unstructuredName = dmca
|
||||
|
||||
[usr_cert]
|
||||
|
||||
basicConstraints=CA:FALSE
|
||||
|
||||
nsComment = "dmca certificate"
|
||||
|
||||
subjectKeyIdentifier=hash
|
||||
authorityKeyIdentifier=keyid,issuer:always
|
||||
|
||||
[v3_req]
|
||||
|
||||
basicConstraints = CA:FALSE
|
||||
keyUsage = nonRepudiation,digitalSignature,keyEncipherment
|
||||
|
||||
[v3_ca]
|
||||
|
||||
#subjectKeyIdentifier=hash
|
||||
#authorityKeyIdentifier=keyid:always,issuer
|
||||
basicConstraints = critical,CA:true
|
||||
keyUsage = critical,keyCertSign,digitalSignature,keyEncipherment,keyAgreement
|
||||
|
||||
[crl_ext]
|
||||
|
||||
#issuerAltName=issuer:copy
|
||||
authorityKeyIdentifier=keyid:always
|
|
@ -1,99 +0,0 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
[ca]
|
||||
default_ca = dmca
|
||||
|
||||
[dmca]
|
||||
dir = @@cadir@@
|
||||
certs = $dir/certs
|
||||
crl_dir = $dir/crl
|
||||
database = $dir/index.txt
|
||||
unique_subject = no
|
||||
new_certs_dir = $dir/newcerts
|
||||
|
||||
certificate = $dir/dmca.crt
|
||||
serial = $dir/serial
|
||||
crl = $dir/dmca.crl
|
||||
private_key = $dir/dmca.key
|
||||
RANDFILE = $dir/private/.rand
|
||||
|
||||
x509_extensions = usr_ext
|
||||
|
||||
name_opt = ca_default
|
||||
cert_opt = ca_default
|
||||
|
||||
copy_extensions = copy
|
||||
|
||||
default_days = 10950
|
||||
default_crl_days = 30
|
||||
default_md = sha256
|
||||
preserve = no
|
||||
|
||||
policy = policy_match
|
||||
|
||||
[policy_match]
|
||||
#countryName = match
|
||||
#stateOrProvinceName = match
|
||||
#organizationName = match
|
||||
countryName = supplied
|
||||
stateOrProvinceName = supplied
|
||||
organizationName = supplied
|
||||
organizationalUnitName = optional
|
||||
commonName = supplied
|
||||
emailAddress = optional
|
||||
|
||||
[req]
|
||||
default_bits = 2048
|
||||
default_md = sha256
|
||||
default_keyfile = privkey.pem
|
||||
distinguished_name = req_distinguished_name
|
||||
attributes = req_attributes
|
||||
x509_extensions = usr_ext
|
||||
string_mask = utf8only
|
||||
|
||||
#input_password = secret
|
||||
#output_password = secret
|
||||
|
||||
[req_distinguished_name]
|
||||
countryName = Country Name (2 letter code)
|
||||
countryName_default = FR
|
||||
countryName_min = 2
|
||||
countryName_max = 2
|
||||
|
||||
stateOrProvinceName = State or Province Name (full name)
|
||||
stateOrProvinceName_default = La Reunion
|
||||
|
||||
localityName = Locality Name (eg, city)
|
||||
localityName_default = Sainte-Clotilde
|
||||
|
||||
0.organizationName = Organization Name (eg, company)
|
||||
0.organizationName_default = jclain
|
||||
|
||||
organizationalUnitName = Organizational Unit Name (eg, section)
|
||||
organizationalUnitName_default =
|
||||
|
||||
commonName = Common Name (eg, your name or your server\'s hostname)
|
||||
commonName_max = 64
|
||||
|
||||
emailAddress = Email Address
|
||||
emailAddress_max = 64
|
||||
|
||||
[req_attributes]
|
||||
challengePassword = A challenge password
|
||||
challengePassword_min = 4
|
||||
challengePassword_max = 20
|
||||
|
||||
unstructuredName = jclain
|
||||
|
||||
[usr_ext]
|
||||
|
||||
basicConstraints=critical,CA:FALSE
|
||||
#subjectKeyIdentifier=hash
|
||||
#authorityKeyIdentifier=keyid,issuer:always
|
||||
keyUsage = critical,digitalSignature
|
||||
extendedKeyUsage = clientAuth
|
||||
|
||||
[crl_ext]
|
||||
|
||||
#issuerAltName=issuer:copy
|
||||
authorityKeyIdentifier=keyid:always
|
|
@ -1,101 +0,0 @@
|
|||
# -*- coding: utf-8 mode: conf -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
[ca]
|
||||
default_ca = dmca
|
||||
|
||||
[dmca]
|
||||
dir = @@cadir@@
|
||||
certs = $dir/certs
|
||||
crl_dir = $dir/crl
|
||||
database = $dir/index.txt
|
||||
unique_subject = no
|
||||
new_certs_dir = $dir/newcerts
|
||||
|
||||
certificate = $dir/dmca.crt
|
||||
serial = $dir/serial
|
||||
crl = $dir/dmca.crl
|
||||
private_key = $dir/dmca.key
|
||||
RANDFILE = $dir/private/.rand
|
||||
|
||||
x509_extensions = usr_ext
|
||||
|
||||
name_opt = ca_default
|
||||
cert_opt = ca_default
|
||||
|
||||
copy_extensions = copy
|
||||
|
||||
default_days = 3650
|
||||
default_crl_days = 30
|
||||
default_md = sha256
|
||||
preserve = no
|
||||
|
||||
policy = policy_match
|
||||
|
||||
[policy_match]
|
||||
#countryName = match
|
||||
#stateOrProvinceName = match
|
||||
#organizationName = match
|
||||
countryName = supplied
|
||||
stateOrProvinceName = supplied
|
||||
organizationName = supplied
|
||||
organizationalUnitName = optional
|
||||
commonName = supplied
|
||||
emailAddress = optional
|
||||
|
||||
[req]
|
||||
default_bits = 2048
|
||||
default_md = sha256
|
||||
default_keyfile = privkey.pem
|
||||
distinguished_name = req_distinguished_name
|
||||
attributes = req_attributes
|
||||
x509_extensions = usr_ext
|
||||
string_mask = utf8only
|
||||
|
||||
#input_password = secret
|
||||
#output_password = secret
|
||||
|
||||
[req_distinguished_name]
|
||||
countryName = Country Name (2 letter code)
|
||||
countryName_default = FR
|
||||
countryName_min = 2
|
||||
countryName_max = 2
|
||||
|
||||
stateOrProvinceName = State or Province Name (full name)
|
||||
stateOrProvinceName_default = La Reunion
|
||||
|
||||
localityName = Locality Name (eg, city)
|
||||
localityName_default = Sainte-Clotilde
|
||||
|
||||
0.organizationName = Organization Name (eg, company)
|
||||
0.organizationName_default = jclain
|
||||
|
||||
organizationalUnitName = Organizational Unit Name (eg, section)
|
||||
organizationalUnitName_default =
|
||||
|
||||
commonName = Common Name (eg, your name or your server\'s hostname)
|
||||
commonName_max = 64
|
||||
|
||||
emailAddress = Email Address
|
||||
emailAddress_max = 64
|
||||
|
||||
[req_attributes]
|
||||
challengePassword = A challenge password
|
||||
challengePassword_min = 4
|
||||
challengePassword_max = 20
|
||||
|
||||
unstructuredName = jclain
|
||||
|
||||
[usr_ext]
|
||||
|
||||
basicConstraints = critical,CA:FALSE
|
||||
#subjectKeyIdentifier=hash
|
||||
#authorityKeyIdentifier=keyid,issuer:always
|
||||
keyUsage = critical,digitalSignature,keyEncipherment,keyAgreement
|
||||
extendedKeyUsage = serverAuth
|
||||
|
||||
subjectAltName = DNS:localhost
|
||||
|
||||
[crl_ext]
|
||||
|
||||
#issuerAltName=issuer:copy
|
||||
authorityKeyIdentifier=keyid:always
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>nulib</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||
<path>/${PROJECT_DIR_NAME}/python</path>
|
||||
</pydev_pathproperty>
|
||||
</pydev_project>
|
|
@ -0,0 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//python/nulib/web/bootstrap.py=utf-8
|
||||
encoding//python/nulib/web/model.py=utf-8
|
||||
encoding//python/nulib/web/ui.py=utf-8
|
||||
encoding/<project>=UTF-8
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
line.separator=\n
|
|
@ -0,0 +1,4 @@
|
|||
global-include *
|
||||
global-exclude *.pyc
|
||||
exclude MANIFEST
|
||||
prune dist
|
|
@ -0,0 +1,180 @@
|
|||
# TODO
|
||||
|
||||
## Améliorer rtoinst
|
||||
|
||||
ajouter le support de pffprofile pour deploydb
|
||||
|
||||
## Refaire/repenser les fonctions evalX
|
||||
|
||||
dans chaque exemple, on affiche l'invocation de evalX suivi de l'équivalent en
|
||||
syntaxe standard
|
||||
|
||||
- evala permet de traiter des tableaux
|
||||
~~~
|
||||
evala with array // add a b c
|
||||
array=("${array[@]}" a b c)
|
||||
~~~
|
||||
les fonctions à utiliser pour le traitement sont configurées avec des
|
||||
variables spéciales. par exemple, on peut indiquer que la commande add
|
||||
ci-dessus est en réalité gérée par la fonction array_add et que c'est une
|
||||
commande de type modify qui prend en premier argument le nom du tableau:
|
||||
~~~
|
||||
__evala_add_func=array_add
|
||||
__evala_add_type=m
|
||||
__evala_add_arg=first
|
||||
~~~
|
||||
en fonction du type de fonction, les arguments supplémentaires supportés sont
|
||||
différents. par défaut, la fonction à utiliser est du même nom que la
|
||||
commande, est du type scalar, et prend comme argument @
|
||||
Ainsi les deux commandes suivantes sont équivalentes:
|
||||
~~~
|
||||
evala with array // echo
|
||||
echo "${array[@]}"
|
||||
~~~
|
||||
et assument les définitions suivantes:
|
||||
~~~
|
||||
__evala_echo_func=echo
|
||||
__evala_echo_type=s
|
||||
__evala_echo_arg=@
|
||||
~~~
|
||||
|
||||
- evalx permet d'utiliser toutes ces fonctions ensemble
|
||||
~~~
|
||||
evalx seq 5 //p grep -v 3 //a prepend prefix // append suffix //c echo
|
||||
array=($(seq 5 | grep -v 3)); array=(prefix "${array[@]}"); array=("${array[@]}" suffix); echo "${array[@]}"
|
||||
|
||||
# à partir du mode evala, on peut exécuter directement les arguments du
|
||||
# tableau comme une commande en terminant par //c
|
||||
evalx -a with array // prepend echo //c
|
||||
array=(echo "${array[@]}"); "${array[@]}"
|
||||
~~~
|
||||
evalx commence par défaut en mode evalc. il est possible avec les options -i,
|
||||
-s, -a, -c, -p, -m de forcer respectivement evali, evals, evala, evalc, evalp,
|
||||
evalm
|
||||
|
||||
- Il faudra réfléchir à comment sortir du mode evalm pour utilisation avec
|
||||
evalx. ou alors on part du principe que evalm est toujours en fin de chaine.
|
||||
|
||||
## Faire la fonction cmdx
|
||||
|
||||
cmdx permet de lancer une commande avec les arguments qui sont générés par
|
||||
evalx. cmdx commence par défaut en mode evalm. Par exemple, les deux commandes
|
||||
suivantes sont équivalentes:
|
||||
~~~
|
||||
cmdx etitle //"Copie de " basename "$src" //" vers " ppath "$dest"
|
||||
etitle "Copie de $(basename "$src") vers $(ppath "$dest")"
|
||||
~~~
|
||||
|
||||
Comme pour evalx, les options -i, -s, -a, -c, -p, -m permettent de forcer
|
||||
respectivement les modes evali, evals, evala, evalc, evalp, evalm. Par exemple
|
||||
les deux commandes suivantes sont équivalentes:
|
||||
~~~
|
||||
cmdx -c echo a // b
|
||||
echo "$(b "$(a)")"
|
||||
~~~
|
||||
|
||||
## Faire la fonction checkx
|
||||
|
||||
checkx permet de tester le résultat d'une commande evalx. elle s'utilise de
|
||||
cette manière:
|
||||
~~~
|
||||
checkx cmds... OP VALUE
|
||||
~~~
|
||||
|
||||
Les opérateurs sont de la forme:
|
||||
~~~
|
||||
is -n|notempty
|
||||
is -z|empty
|
||||
is ok
|
||||
is ko
|
||||
== value
|
||||
!= value
|
||||
etc.
|
||||
~~~
|
||||
|
||||
checkx remplace testx avec une syntaxe plus naturelle. si aucun script
|
||||
n'utilise les fonctions testx, peut-être peut-on simplement supprimer les
|
||||
fonctions testx et renommer checkx en testx
|
||||
|
||||
Comme pour evalx, les options -i, -s, -a, -c, -p, -m permettent de forcer
|
||||
respectivement les modes evali, evals, evala, evalc, evalp, evalm. Par exemple
|
||||
les deux commandes suivantes sont équivalentes:
|
||||
~~~
|
||||
checkx -p a // b == c
|
||||
[ "$(evalp a // b)" == c ]
|
||||
~~~
|
||||
|
||||
Les commande suivantes sont équivalentes deux à deux:
|
||||
~~~
|
||||
checkx cmd is -z
|
||||
[ -z "$(evalx cmd)" ]
|
||||
|
||||
checkx cmd is ok
|
||||
evalx cmd; [ $? -eq 0 ]
|
||||
|
||||
checkx cmd is ko
|
||||
evalx cmd; [ $? -ne 0 ]
|
||||
|
||||
checkx cmd == value
|
||||
[ "$(evalx cmd)" == value ]
|
||||
~~~
|
||||
|
||||
## Faire la fonction storex
|
||||
|
||||
storex permet de mettre le résultat d'une fonction evalx dans une variable ou de
|
||||
l'ajouter à un tableau. l'idée est d'avoir la même syntaxe que checkx. je ne
|
||||
suis pas encore tout à fait sûr que ce soit une bonne chose.
|
||||
|
||||
Les commande suivantes sont équivalentes deux à deux:
|
||||
~~~
|
||||
storex cmd to var
|
||||
var="$(evalx cmd)"
|
||||
|
||||
storex cmd to var
|
||||
setx var=cmd
|
||||
|
||||
storex -a cmd to array
|
||||
array_add array "$(evalx cmd)"
|
||||
|
||||
storex -r cmd from array
|
||||
array_del array "$(evalx cmd)"
|
||||
~~~
|
||||
|
||||
syntaxes alternatives
|
||||
~~~
|
||||
storex cmd to var
|
||||
addx cmd to array
|
||||
removex cmd from array
|
||||
~~~
|
||||
|
||||
alternatives
|
||||
~~~
|
||||
setx var=cmd
|
||||
evalx cmd // array_add array
|
||||
evalx cmd // array_del array
|
||||
~~~
|
||||
|
||||
note: il ne semble pas nécessaire au vu de l'alternative d'implémenter storex,
|
||||
addx, removex.
|
||||
|
||||
par contre, il faut corriger un bug d'evalc: la dernière commande doit être
|
||||
exécutée telle quelle. en effet,
|
||||
~~~
|
||||
evalc a // b
|
||||
~~~
|
||||
devrait être équivalent à
|
||||
~~~
|
||||
b "$(a)"
|
||||
~~~
|
||||
mais en fait c'est plutôt
|
||||
~~~
|
||||
echo "$(b "$(a)")"
|
||||
~~~
|
||||
et ça pose problème, notamment si b initialise des variables, etc.
|
||||
|
||||
## Fonctions diverses
|
||||
|
||||
`retcode cmd`
|
||||
: affiche le code de retour de cmd. équivalent à `cmd; echo $?`
|
||||
|
||||
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 mode: awk -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
@include "base.core"
|
||||
@include "base.array"
|
||||
@include "base.date"
|
|
@ -0,0 +1,157 @@
|
|||
# -*- coding: utf-8 mode: awk -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
function mkindices(values, indices, i, j) {
|
||||
array_new(indices)
|
||||
j = 1
|
||||
for (i in values) {
|
||||
indices[j++] = int(i)
|
||||
}
|
||||
return asort(indices)
|
||||
}
|
||||
function array_new(dest) {
|
||||
dest[0] = 0 # forcer awk à considérer dest comme un tableau
|
||||
delete dest
|
||||
}
|
||||
function array_newsize(dest, size, i) {
|
||||
dest[0] = 0 # forcer awk à considérer dest comme un tableau
|
||||
delete dest
|
||||
size = int(size)
|
||||
for (i = 1; i <= size; i++) {
|
||||
dest[i] = ""
|
||||
}
|
||||
}
|
||||
function array_len(values, count, i) {
|
||||
# length(array) a un bug sur awk 3.1.5
|
||||
# cette version est plus lente mais fonctionne toujours
|
||||
count = 0
|
||||
for (i in values) {
|
||||
count++
|
||||
}
|
||||
return count
|
||||
}
|
||||
function array_copy(dest, src, count, indices, i) {
|
||||
array_new(dest)
|
||||
count = mkindices(src, indices)
|
||||
for (i = 1; i <= count; i++) {
|
||||
dest[indices[i]] = src[indices[i]]
|
||||
}
|
||||
}
|
||||
function array_getlastindex(src, count, indices) {
|
||||
count = mkindices(src, indices)
|
||||
if (count == 0) return 0
|
||||
return indices[count]
|
||||
}
|
||||
function array_add(dest, value, lastindex) {
|
||||
lastindex = array_getlastindex(dest)
|
||||
dest[lastindex + 1] = value
|
||||
}
|
||||
function array_deli(dest, i, l) {
|
||||
i = int(i)
|
||||
if (i == 0) return
|
||||
l = array_len(dest)
|
||||
while (i < l) {
|
||||
dest[i] = dest[i + 1]
|
||||
i++
|
||||
}
|
||||
delete dest[l]
|
||||
}
|
||||
function array_del(dest, value, ignoreCase, i) {
|
||||
do {
|
||||
i = key_index(value, dest, ignoreCase)
|
||||
if (i != 0) array_deli(dest, i)
|
||||
} while (i != 0)
|
||||
}
|
||||
function array_extend(dest, src, count, lastindex, indices, i) {
|
||||
lastindex = array_getlastindex(dest)
|
||||
count = mkindices(src, indices)
|
||||
for (i = 1; i <= count; i++) {
|
||||
dest[lastindex + i] = src[indices[i]]
|
||||
}
|
||||
}
|
||||
function array_fill(dest, i) {
|
||||
array_new(dest)
|
||||
for (i = 1; i <= NF; i++) {
|
||||
dest[i] = $i
|
||||
}
|
||||
}
|
||||
function array_getline(src, count, indices, i, j) {
|
||||
$0 = ""
|
||||
count = mkindices(src, indices)
|
||||
for (i = 1; i <= count; i++) {
|
||||
j = indices[i]
|
||||
$j = src[j]
|
||||
}
|
||||
}
|
||||
function array_appendline(src, count, indices, i, nf, j) {
|
||||
count = mkindices(src, indices)
|
||||
nf = NF
|
||||
for (i = 1; i <= count; i++) {
|
||||
j = nf + indices[i]
|
||||
$j = src[indices[i]]
|
||||
}
|
||||
}
|
||||
function in_array(value, values, ignoreCase, i) {
|
||||
if (ignoreCase) {
|
||||
value = tolower(value)
|
||||
for (i in values) {
|
||||
if (tolower(values[i]) == value) return 1
|
||||
}
|
||||
} else {
|
||||
for (i in values) {
|
||||
if (values[i] == value) return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
function key_index(value, values, ignoreCase, i) {
|
||||
if (ignoreCase) {
|
||||
value = tolower(value)
|
||||
for (i in values) {
|
||||
if (tolower(values[i]) == value) return int(i)
|
||||
}
|
||||
} else {
|
||||
for (i in values) {
|
||||
if (values[i] == value) return int(i)
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
function array2s(values, prefix, sep, suffix, noindices, first, i, s) {
|
||||
if (!prefix) prefix = "["
|
||||
if (!sep) sep = ", "
|
||||
if (!suffix) suffix = "]"
|
||||
s = prefix
|
||||
first = 1
|
||||
for (i in values) {
|
||||
if (first) first = 0
|
||||
else s = s sep
|
||||
if (!noindices) s = s "[" i "]="
|
||||
s = s values[i]
|
||||
}
|
||||
s = s suffix
|
||||
return s
|
||||
}
|
||||
function array2so(values, prefix, sep, suffix, noindices, count, indices, i, s) {
|
||||
if (!prefix) prefix = "["
|
||||
if (!sep) sep = ", "
|
||||
if (!suffix) suffix = "]"
|
||||
s = prefix
|
||||
count = mkindices(values, indices)
|
||||
for (i = 1; i <= count; i++) {
|
||||
if (i > 1) s = s sep
|
||||
if (!noindices) s = s "[" indices[i] "]="
|
||||
s = s values[indices[i]]
|
||||
}
|
||||
s = s suffix
|
||||
return s
|
||||
}
|
||||
function array_join(values, sep, prefix, suffix, count, indices, i, s) {
|
||||
s = prefix
|
||||
count = mkindices(values, indices)
|
||||
for (i = 1; i <= count; i++) {
|
||||
if (i > 1) s = s sep
|
||||
s = s values[indices[i]]
|
||||
}
|
||||
s = s suffix
|
||||
return s
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
# -*- coding: utf-8 mode: awk -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
function num(s) {
|
||||
if (s ~ /^[0-9]+$/) return int(s)
|
||||
else return s
|
||||
}
|
||||
function ord(s, i) {
|
||||
s = substr(s, 1, 1)
|
||||
i = index(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", s)
|
||||
if (i != 0) i += 32 - 1
|
||||
return i
|
||||
}
|
||||
function hex(i, s) {
|
||||
s = sprintf("%x", i)
|
||||
if (length(s) < 2) s = "0" s
|
||||
return s
|
||||
}
|
||||
function qhtml(s) {
|
||||
gsub(/&/, "\\&", s)
|
||||
gsub(/"/, "\\"", s)
|
||||
gsub(/>/, "\\>", s)
|
||||
gsub(/</, "\\<", s)
|
||||
return s
|
||||
}
|
||||
function unquote_html(s) {
|
||||
gsub(/</, "<", s)
|
||||
gsub(/>/, ">", s)
|
||||
gsub(/"/, "\"", s)
|
||||
gsub(/&/, "\\&", s)
|
||||
return s
|
||||
}
|
||||
function qawk(s) {
|
||||
gsub(/\\/, "\\\\", s)
|
||||
gsub(/"/, "\\\"", s)
|
||||
gsub(/\n/, "\\n", s)
|
||||
return "\"" s "\""
|
||||
}
|
||||
function qval(s) {
|
||||
gsub(/'/, "'\\''", s)
|
||||
return "'" s "'"
|
||||
}
|
||||
function sqval(s) {
|
||||
return " " qval(s)
|
||||
}
|
||||
function qvals( i, line) {
|
||||
line = ""
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if (i > 1) line = line " "
|
||||
line = line qval($i)
|
||||
}
|
||||
return line
|
||||
}
|
||||
function sqvals() {
|
||||
return " " qvals()
|
||||
}
|
||||
function qarr(values, prefix, i, count, line) {
|
||||
line = prefix
|
||||
count = array_len(values)
|
||||
for (i = 1; i <= count; i++) {
|
||||
if (i > 1 || line != "") line = line " "
|
||||
line = line qval(values[i])
|
||||
}
|
||||
return line
|
||||
}
|
||||
function qregexp(s) {
|
||||
gsub(/[[\\.^$*+?()|{]/, "\\\\&", s)
|
||||
return s
|
||||
}
|
||||
function qsubrepl(s) {
|
||||
gsub(/\\/, "\\\\", s)
|
||||
gsub(/&/, "\\\\&", s)
|
||||
return s
|
||||
}
|
||||
function qgrep(s) {
|
||||
gsub(/[[\\.^$*]/, "\\\\&", s)
|
||||
return s
|
||||
}
|
||||
function qegrep(s) {
|
||||
gsub(/[[\\.^$*+?()|{]/, "\\\\&", s)
|
||||
return s
|
||||
}
|
||||
function qsql(s, suffix) {
|
||||
gsub(/'/, "''", s)
|
||||
return "'" s "'" (suffix != ""? " " suffix: "")
|
||||
}
|
||||
function cqsql(s, suffix) {
|
||||
return "," qsql(s, suffix)
|
||||
}
|
||||
function unquote_mysqlcsv(s) {
|
||||
gsub(/\\n/, "\n", s)
|
||||
gsub(/\\t/, "\t", s)
|
||||
gsub(/\\0/, "\0", s)
|
||||
gsub(/\\\\/, "\\", s)
|
||||
return s
|
||||
}
|
||||
function sval(s) {
|
||||
if (s == "") return s
|
||||
else return " " s
|
||||
}
|
||||
function cval(s, suffix) {
|
||||
suffix = suffix != ""? " " suffix: ""
|
||||
if (s == "") return s
|
||||
else return "," s suffix
|
||||
}
|
||||
|
||||
function printto(s, output) {
|
||||
if (output == "") {
|
||||
print s
|
||||
} else if (output ~ /^>>/) {
|
||||
sub(/^>>/, "", output)
|
||||
print s >>output
|
||||
} else if (output ~ /^>/) {
|
||||
sub(/^>/, "", output)
|
||||
print s >output
|
||||
} else if (output ~ /^\|&/) {
|
||||
sub(/^\|&/, "", output)
|
||||
print s |&output
|
||||
} else if (output ~ /^\|/) {
|
||||
sub(/^\|/, "", output)
|
||||
print s |output
|
||||
} else {
|
||||
print s >output
|
||||
}
|
||||
}
|
||||
function find_line(input, field, value, orig, line) {
|
||||
orig = $0
|
||||
line = ""
|
||||
while ((getline <input) > 0) {
|
||||
if ($field == value) {
|
||||
line = $0
|
||||
break
|
||||
}
|
||||
}
|
||||
close(input)
|
||||
$0 = orig
|
||||
return line
|
||||
}
|
||||
function merge_line(input, field, key, line) {
|
||||
line = find_line(input, field, $key)
|
||||
if (line != "") $0 = $0 FS line
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
# -*- coding: utf-8 mode: awk -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
function date__parse_fr(date, parts, y, m, d) {
|
||||
if (match(date, /([0-9][0-9]?)\/([0-9][0-9]?)\/([0-9][0-9][0-9][0-9])/, parts)) {
|
||||
y = int(parts[3])
|
||||
m = int(parts[2])
|
||||
d = int(parts[1])
|
||||
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
|
||||
}
|
||||
function date__parse_mysql(date, parts, y, m, d) {
|
||||
if (match(date, /([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])/, parts)) {
|
||||
y = int(parts[1])
|
||||
m = int(parts[2])
|
||||
d = int(parts[3])
|
||||
return mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d))
|
||||
}
|
||||
return -1
|
||||
}
|
||||
function date__parse_any(date, serial) {
|
||||
serial = date__parse_fr(date)
|
||||
if (serial == -1) serial = date__parse_mysql(date)
|
||||
return serial
|
||||
}
|
||||
function date_serial(date) {
|
||||
return date__parse_any(date)
|
||||
}
|
||||
function date_parse(date, serial) {
|
||||
serial = date__parse_any(date)
|
||||
if (serial == -1) return date
|
||||
return strftime("%d/%m/%Y", serial)
|
||||
}
|
||||
function date_monday(date, serial, dow) {
|
||||
serial = date__parse_any(date)
|
||||
if (serial == -1) return date
|
||||
dow = strftime("%u", serial)
|
||||
serial -= (dow - 1) * 86400
|
||||
return strftime("%d/%m/%Y", serial)
|
||||
}
|
||||
function date_add(date, nbdays, serial) {
|
||||
serial = date__parse_any(date)
|
||||
if (serial == -1) return date
|
||||
serial += nbdays * 86400
|
||||
return strftime("%d/%m/%Y", serial)
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
# -*- coding: utf-8 mode: awk -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
@include "base.core"
|
||||
@include "base.array"
|
||||
|
||||
function csv__parse_quoted(line, destl, colsep, qchar, echar, pos, tmpl, nextc, resl) {
|
||||
line = substr(line, 2)
|
||||
resl = ""
|
||||
while (1) {
|
||||
pos = index(line, qchar)
|
||||
if (pos == 0) {
|
||||
# chaine mal terminee
|
||||
resl = resl line
|
||||
destl[0] = ""
|
||||
destl[1] = 0
|
||||
return resl
|
||||
}
|
||||
if (echar != "" && pos > 1) {
|
||||
# tenir compte du fait qu"un caratère peut être mis en échappement
|
||||
prevc = substr(line, pos - 1, 1)
|
||||
quotec = substr(line, pos, 1)
|
||||
nextc = substr(line, pos + 1, 1)
|
||||
if (prevc == echar) {
|
||||
# qchar en échappement
|
||||
tmpl = substr(line, 1, pos - 2)
|
||||
resl = resl tmpl quotec
|
||||
line = substr(line, pos + 1)
|
||||
continue
|
||||
}
|
||||
tmpl = substr(line, 1, pos - 1)
|
||||
if (nextc == colsep || nextc == "") {
|
||||
# fin de champ ou fin de ligne
|
||||
resl = resl tmpl
|
||||
destl[0] = substr(line, pos + 2)
|
||||
destl[1] = nextc == colsep
|
||||
return resl
|
||||
} else {
|
||||
# erreur de syntaxe: guillemet non mis en échappement
|
||||
# ignorer cette erreur et prendre le guillemet quand meme
|
||||
resl = resl tmpl quotec
|
||||
line = substr(line, pos + 1)
|
||||
}
|
||||
} else {
|
||||
# pas d"échappement pour qchar. il est éventuellement doublé
|
||||
tmpl = substr(line, 1, pos - 1)
|
||||
quotec = substr(line, pos, 1)
|
||||
nextc = substr(line, pos + 1, 1)
|
||||
if (nextc == colsep || nextc == "") {
|
||||
# fin de champ ou fin de ligne
|
||||
resl = resl tmpl
|
||||
destl[0] = substr(line, pos + 2)
|
||||
destl[1] = nextc == colsep
|
||||
return resl
|
||||
} else if (nextc == qchar) {
|
||||
# qchar en echappement
|
||||
resl = resl tmpl quotec
|
||||
line = substr(line, pos + 2)
|
||||
} else {
|
||||
# erreur de syntaxe: guillemet non mis en échappement
|
||||
# ignorer cette erreur et prendre le guillemet quand meme
|
||||
resl = resl tmpl quotec
|
||||
line = substr(line, pos + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function csv__parse_unquoted(line, destl, colsep, qchar, echar, pos) {
|
||||
pos = index(line, colsep)
|
||||
if (pos == 0) {
|
||||
destl[0] = ""
|
||||
destl[1] = 0
|
||||
return line
|
||||
} else {
|
||||
destl[0] = substr(line, pos + 1)
|
||||
destl[1] = 1
|
||||
return substr(line, 1, pos - 1)
|
||||
}
|
||||
}
|
||||
function csv__array_parse(fields, line, nbfields, colsep, qchar, echar, shouldparse, destl, i) {
|
||||
array_new(fields)
|
||||
array_new(destl)
|
||||
i = 1
|
||||
shouldparse = 0
|
||||
# shouldparse permet de gérer le cas où un champ vide est en fin de ligne.
|
||||
# en effet, après "," il faut toujours parser, même si line==""
|
||||
while (shouldparse || line != "") {
|
||||
if (index(line, qchar) == 1) {
|
||||
value = csv__parse_quoted(line, destl, colsep, qchar, echar)
|
||||
line = destl[0]
|
||||
shouldparse = destl[1]
|
||||
} else {
|
||||
value = csv__parse_unquoted(line, destl, colsep, qchar, echar)
|
||||
line = destl[0]
|
||||
shouldparse = destl[1]
|
||||
}
|
||||
fields[i] = value
|
||||
i = i + 1
|
||||
}
|
||||
if (nbfields) {
|
||||
nbfields = int(nbfields)
|
||||
i = array_len(fields)
|
||||
while (i < nbfields) {
|
||||
i++
|
||||
fields[i] = ""
|
||||
}
|
||||
}
|
||||
return array_len(fields)
|
||||
}
|
||||
BEGIN {
|
||||
DEFAULT_COLSEP = ","
|
||||
DEFAULT_QCHAR = "\""
|
||||
DEFAULT_ECHAR = ""
|
||||
}
|
||||
function array_parsecsv2(fields, line, nbfields, colsep, qchar, echar) {
|
||||
return csv__array_parse(fields, line, nbfields, colsep, qchar, echar)
|
||||
}
|
||||
function array_parsecsv(fields, line, nbfields, colsep, qchar, echar) {
|
||||
if (colsep == "") colsep = DEFAULT_COLSEP
|
||||
if (qchar == "") qchar = DEFAULT_QCHAR
|
||||
if (echar == "") echar = DEFAULT_ECHAR
|
||||
return csv__array_parse(fields, line, nbfields, colsep, qchar, echar)
|
||||
}
|
||||
function parsecsv(line, fields) {
|
||||
array_parsecsv(fields, line)
|
||||
array_getline(fields)
|
||||
return NF
|
||||
}
|
||||
function getlinecsv(file, fields) {
|
||||
if (file) {
|
||||
getline <file
|
||||
} else {
|
||||
getline
|
||||
}
|
||||
return parsecsv($0)
|
||||
}
|
||||
function csv__should_quote(s) {
|
||||
if (s ~ /^[[:blank:][:cntrl:][:space:]]/) return 1
|
||||
if (s ~ /[[:blank:][:cntrl:][:space:]]$/) return 1
|
||||
return 0
|
||||
}
|
||||
function array_formatcsv2(fields, colsep, mvsep, qchar, echar, count, indices, line, i, value) {
|
||||
line = ""
|
||||
count = mkindices(fields, indices)
|
||||
for (i = 1; i <= count; i++) {
|
||||
value = fields[indices[i]]
|
||||
if (i > 1) line = line colsep
|
||||
if (qchar != "" && index(value, qchar) != 0) {
|
||||
if (echar != "") gsub(qchar, quote_subrepl(echar) "&", value);
|
||||
else gsub(qchar, "&&", value);
|
||||
}
|
||||
if (qchar != "" && (index(value, mvsep) != 0 || index(value, colsep) != 0 || index(value, qchar) != 0 || csv__should_quote(value))) {
|
||||
line = line qchar value qchar
|
||||
} else {
|
||||
line = line value
|
||||
}
|
||||
}
|
||||
return line
|
||||
}
|
||||
function array_formatcsv(fields) {
|
||||
return array_formatcsv2(fields, ",", ";", "\"", "")
|
||||
}
|
||||
function array_printcsv(fields, output) {
|
||||
printto(array_formatcsv(fields), output)
|
||||
}
|
||||
function get_formatcsv( fields) {
|
||||
array_fill(fields)
|
||||
return array_formatcsv(fields)
|
||||
}
|
||||
function formatcsv() {
|
||||
$0 = get_formatcsv()
|
||||
}
|
||||
function printcsv(output, fields) {
|
||||
array_fill(fields)
|
||||
array_printcsv(fields, output)
|
||||
}
|
||||
function array_findcsv(fields, input, field, value, nbfields, orig, found, i) {
|
||||
array_new(orig)
|
||||
array_fill(orig)
|
||||
array_new(fields)
|
||||
found = 0
|
||||
while ((getline <input) > 0) {
|
||||
array_parsecsv(fields, $0, nbfields)
|
||||
if (fields[field] == value) {
|
||||
found = 1
|
||||
break
|
||||
}
|
||||
}
|
||||
close(input)
|
||||
array_getline(orig)
|
||||
if (!found) {
|
||||
delete fields
|
||||
if (nbfields) {
|
||||
nbfields = int(nbfields)
|
||||
i = array_len(fields)
|
||||
while (i < nbfields) {
|
||||
i++
|
||||
fields[i] = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
return found
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
# -*- coding: utf-8 mode: awk -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
|
||||
function base64__and(var, x, l_res, l_i) {
|
||||
l_res = 0;
|
||||
for (l_i = 0; l_i < 8; l_i++){
|
||||
if (var%2 == 1 && x%2 == 1) l_res = l_res/2 + 128;
|
||||
else l_res /= 2;
|
||||
var = int(var/2);
|
||||
x = int(x/2);
|
||||
}
|
||||
return l_res;
|
||||
}
|
||||
# Rotate bytevalue left x times
|
||||
function base64__lshift(var, x) {
|
||||
while(x > 0){
|
||||
var *= 2;
|
||||
x--;
|
||||
}
|
||||
return var;
|
||||
}
|
||||
# Rotate bytevalue right x times
|
||||
function base64__rshift(var, x) {
|
||||
while(x > 0){
|
||||
var = int(var/2);
|
||||
x--;
|
||||
}
|
||||
return var;
|
||||
}
|
||||
BEGIN {
|
||||
BASE64__BYTES = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
}
|
||||
function b64decode(src, result, base1, base2, base3, base4) {
|
||||
result = ""
|
||||
while (length(src) > 0) {
|
||||
# Specify byte values
|
||||
base1 = substr(src, 1, 1)
|
||||
base2 = substr(src, 2, 1)
|
||||
base3 = substr(src, 3, 1); if (base3 == "") base3 = "="
|
||||
base4 = substr(src, 4, 1); if (base4 == "") base4 = "="
|
||||
# Now find numerical position in BASE64 string
|
||||
byte1 = index(BASE64__BYTES, base1) - 1
|
||||
if (byte1 < 0) byte1 = 0
|
||||
byte2 = index(BASE64__BYTES, base2) - 1
|
||||
if (byte2 < 0) byte2 = 0
|
||||
byte3 = index(BASE64__BYTES, base3) - 1
|
||||
if (byte3 < 0) byte3 = 0
|
||||
byte4 = index(BASE64__BYTES, base4) - 1
|
||||
if (byte4 < 0) byte4 = 0
|
||||
# Reconstruct ASCII string
|
||||
result = result sprintf( "%c", base64__lshift(base64__and(byte1, 63), 2) + base64__rshift(base64__and(byte2, 48), 4) )
|
||||
if (base3 != "=") result = result sprintf( "%c", base64__lshift(base64__and(byte2, 15), 4) + base64__rshift(base64__and(byte3, 60), 2) )
|
||||
if (base4 != "=") result = result sprintf( "%c", base64__lshift(base64__and(byte3, 3), 6) + byte4 )
|
||||
# Decrease incoming string with 4
|
||||
src = substr(src, 5)
|
||||
}
|
||||
return result
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||
##@cooked nocomments
|
||||
# shim pour les fonctions de nulib.sh au cas où ce module n'est pas chargée
|
||||
if [ -z "$NULIBDIR" -o "$NULIBDIR" != "$NULIBINIT" ]; then
|
||||
function module:() { :; }
|
||||
function function:() { :; }
|
||||
function require:() { :; }
|
||||
function import:() { :; }
|
||||
fi
|
||||
##@include base.init
|
||||
##@include base.core
|
||||
##@include base.str
|
||||
##@include base.arr
|
||||
##@include base.io
|
||||
##@include base.eval
|
||||
##@include base.split
|
||||
##@include base.path
|
||||
##@include base.args
|
||||
module: base base_ "Chargement de tous les modules base.*"
|
||||
NULIB_RECURSIVE_IMPORT=1
|
||||
require: base.init base.core base.str base.arr base.io base.eval base.split base.path base.args
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue