Compare commits
201 Commits
Author | SHA1 | Date | |
---|---|---|---|
3edb672410 | |||
733fdca042 | |||
7cc9629788 | |||
df3986e8dc | |||
e674b316c3 | |||
7611760c3c | |||
056ae579a9 | |||
6f9ab14ffe | |||
c9eaf7d83f | |||
693f447bf4 | |||
6e23aaeeb0 | |||
d32be911b7 | |||
89efc824f9 | |||
c69e3d414f | |||
b9f264f705 | |||
737179b81b | |||
2687e72643 | |||
0527aee96e | |||
3ac6a38e25 | |||
f156fe0b1e | |||
625d5f1d25 | |||
e30820261a | |||
5c03184c94 | |||
0ed5ddf6b9 | |||
f39787c6ec | |||
11145f686a | |||
21042e4677 | |||
e4176dfd94 | |||
1787aa2310 | |||
d1f77aa354 | |||
c2cfd7739a | |||
e7745c2dd4 | |||
ce8f541520 | |||
30594aa84b | |||
2df175ee57 | |||
fbb05f8dee | |||
9d8e3c53d1 | |||
2886c40aa2 | |||
e50a686536 | |||
8570d12ce6 | |||
5d6c6b4053 | |||
90bda71351 | |||
7d7b88a427 | |||
5cc1826744 | |||
0bf0f48ad0 | |||
b818e11c73 | |||
ad14de35ea | |||
54a5b5485d | |||
5a06851b0f | |||
a855b04c21 | |||
e5315532a1 | |||
db1467b8fd | |||
3123d8e65e | |||
d9b1485354 | |||
744a3fa0ac | |||
2803868e16 | |||
4f7bc3f6bf | |||
8cdc3cb2bb | |||
1b7b2744ba | |||
b9951d269d | |||
4ffd43f2e0 | |||
ddfbc00f78 | |||
e33f2a5afe | |||
f245e17138 | |||
efe31b8c9d | |||
5cb4112cd0 | |||
f424f41561 | |||
e5a147351d | |||
771bd1c563 | |||
776cd96fd7 | |||
471315dcbb | |||
bfdf9b5bef | |||
108215fce4 | |||
6ddb870a56 | |||
c0b130fd29 | |||
ae20e49440 | |||
2e5101d6a2 | |||
cff4833370 | |||
9c6e7a8750 | |||
e9d52d8f35 | |||
d3d86c6ff9 | |||
b761cb610c | |||
6e36d26471 | |||
2344a63da7 | |||
61dc4c1154 | |||
f36be0dfb2 | |||
63674ef02b | |||
ee80091650 | |||
e5ab8dd240 | |||
8b0d4713b5 | |||
1025357631 | |||
2a023070e7 | |||
27a82e439b | |||
92157dee42 | |||
efe9fbbbdb | |||
dc94b5c0cf | |||
5e876652f8 | |||
9c1a8e67b2 | |||
81cefdc51e | |||
c5796d6b2d | |||
6919352a59 | |||
7ba7d1c501 | |||
9d7594356e | |||
c0d4e950e9 | |||
e071b81ad7 | |||
d5ff03481d | |||
3ecb127f33 | |||
432ab6f915 | |||
01c14bbeee | |||
0913c2ed9f | |||
61433fbf9c | |||
e4e0a55073 | |||
e08c66bc89 | |||
0d1193278c | |||
3ead1f37bc | |||
93de256914 | |||
5e33a36bcd | |||
9e1351529a | |||
c9e8110ece | |||
c671cb399d | |||
1a764f15ff | |||
027f9b8c45 | |||
2293239614 | |||
9fc07bb4e7 | |||
7b15f945ba | |||
f2cfaeef13 | |||
c36b8fb577 | |||
68a42d0f6a | |||
306e77f307 | |||
b006bb44cd | |||
6963d4109a | |||
9665d5a5d0 | |||
137dfa9674 | |||
440d2aa1fa | |||
f4047a3b64 | |||
af1bdd3ca5 | |||
85e77e4bda | |||
a56ec0e0f1 | |||
d6e78b9665 | |||
1699cc5f44 | |||
2ae8406a4b | |||
1db7d08e82 | |||
aba08c2600 | |||
e83b6d1036 | |||
af9096df0c | |||
89f0c0974d | |||
fb434c2a96 | |||
f7ab14ff7e | |||
f46812f07a | |||
e76a6a6a84 | |||
45bf006040 | |||
d5cc9ca031 | |||
06686d98f1 | |||
9a018a6f51 | |||
a932a1a7cd | |||
cb09f4db83 | |||
f8952225cf | |||
4f7bcbcede | |||
5cdd93d3d8 | |||
7030b8783c | |||
8a682edade | |||
a85cdf6ddc | |||
d75783b0eb | |||
11e6021e77 | |||
938307cb69 | |||
8b49084d91 | |||
98c1ac8843 | |||
28d42b00f3 | |||
dfdfd59eae | |||
6af03598c8 | |||
b3a44d07ad | |||
111463a861 | |||
fe839f4c7b | |||
ba8e1a1dcc | |||
a75b91e2e9 | |||
dfb5fc31d8 | |||
40c9cb968c | |||
580e20b342 | |||
da28d8b429 | |||
b03df72236 | |||
7a4870f8c8 | |||
a4ed8d9a45 | |||
3d54e3771d | |||
4607f0f3c2 | |||
![]() |
4bf4f6d1f3 | ||
![]() |
47e058330f | ||
026b8496fd | |||
![]() |
31e43dabd7 | ||
b191552cb0 | |||
1d4c4b4b04 | |||
b3983edd2a | |||
543d2d2f79 | |||
f1a9c7a5e5 | |||
ad44a1c2e5 | |||
44f719b2e6 | |||
40d6605472 | |||
f64bbbf0ee | |||
01e940b953 | |||
e453ed2533 | |||
434a8bce16 | |||
dac4cb6a73 |
201
CHANGES.md
201
CHANGES.md
@ -1,3 +1,204 @@
|
|||||||
|
## Version 11.4.0 du 27/02/2025-08:44
|
||||||
|
|
||||||
|
* `7cc9629` modifs.mineures sans commentaires
|
||||||
|
* `df3986e` maj chemins registres
|
||||||
|
* `e674b31` améliorer la prise en charge de dkbuild imbriqué
|
||||||
|
* `7611760` paramètres par défaut pour dkbuild
|
||||||
|
* `056ae57` maj doc dkbuild -c
|
||||||
|
* `6f9ab14` support java 21
|
||||||
|
* `c9eaf7d` maj dkbuild.env par défaut
|
||||||
|
* `693f447` maj fichier dkbuild.env
|
||||||
|
* `6e23aae` maj config par défaut
|
||||||
|
|
||||||
|
## Version 11.3.1 du 31/12/2024-15:05
|
||||||
|
|
||||||
|
* `b9f264f` bug avec dkbuild -e
|
||||||
|
* `737179b` modifs.mineures sans commentaires
|
||||||
|
* `2687e72` support minimal runphp
|
||||||
|
|
||||||
|
## 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
|
## Version 9.10.0 du 12/11/2020-23:05
|
||||||
|
|
||||||
* `24d0519` dk: support merge .shared_env et .machine_env
|
* `24d0519` dk: support merge .shared_env et .machine_env
|
||||||
|
4
EnsureVM
4
EnsureVM
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS service
|
urequire service
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: s'assurer que les services sont lancés pour un type de virtualisation
|
uecho "$scriptname: s'assurer que les services sont lancés pour un type de virtualisation
|
||||||
|
4
SKvm
4
SKvm
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS virsh
|
urequire virsh
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: lancer une machine virtuelle kvm
|
uecho "$scriptname: lancer une machine virtuelle kvm
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: lancer une machine virtuelle VirtualBox
|
uecho "$scriptname: lancer une machine virtuelle VirtualBox
|
||||||
|
21
Sscreen
21
Sscreen
@ -1,6 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
# désactiver le verrouillage
|
||||||
|
export LOCKPRG=/bin/true
|
||||||
|
|
||||||
COULEUR_NORMALE=$'\e[0m'
|
COULEUR_NORMALE=$'\e[0m'
|
||||||
COULEUR_ROUGE=$'\e[31;1m'
|
COULEUR_ROUGE=$'\e[31;1m'
|
||||||
COULEUR_VERTE=$'\e[32;1m'
|
COULEUR_VERTE=$'\e[32;1m'
|
||||||
@ -15,15 +18,25 @@ function __ask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function __auto_screen() {
|
function __auto_screen() {
|
||||||
|
# Si on est déjà dans screen, ne rien faire
|
||||||
|
[ -z "$STY" ] || return
|
||||||
|
|
||||||
# Si screen pas installé, ne rien faire
|
# Si screen pas installé, ne rien faire
|
||||||
if [ -z "$(which screen 2>/dev/null)" ]; then
|
local dir screen="$(which screen 2>/dev/null)"
|
||||||
|
if [ -z "$screen" ]; then
|
||||||
|
for dir in /usr/local/bin /opt/bin /usr/bin /bin; do
|
||||||
|
if [ -x "$dir/screen" ]; then
|
||||||
|
screen="$dir/screen"
|
||||||
|
PATH="$PATH:$dir"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ -z "$screen" ]; then
|
||||||
echo "${COULEUR_JAUNE}WARNING${COULEUR_NORMALE} screen introuvable. une session bash classique sera lancée"
|
echo "${COULEUR_JAUNE}WARNING${COULEUR_NORMALE} screen introuvable. une session bash classique sera lancée"
|
||||||
exec /bin/bash -l
|
exec /bin/bash -l
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Si on est déjà dans screen, ne rien faire
|
|
||||||
[ -z "$STY" ] || return
|
|
||||||
|
|
||||||
# corriger TERM pour les vieilles versions de Linux
|
# corriger TERM pour les vieilles versions de Linux
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
xterm*) TERM=xterm;;
|
xterm*) TERM=xterm;;
|
||||||
|
22
TODO.md
22
TODO.md
@ -1,3 +1,25 @@
|
|||||||
# TODO
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
git push
|
||||||
|
* ajouter le support pour le mode DEBUG
|
||||||
|
~~~
|
||||||
|
export GIT_TRACE=1
|
||||||
|
export GIT_TRANSFER_TRACE=1
|
||||||
|
export GIT_CURL_VERBOSE=1
|
||||||
|
~~~
|
||||||
|
* ajouter le support http basique pour git lfs en cas de problème pour upload de certains fichiers
|
||||||
|
~~~
|
||||||
|
git config --add lfs.basictransfersonly true
|
||||||
|
~~~
|
||||||
|
ou le mettre dans un fichier .lfsconfig
|
||||||
|
cf https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-config.adoc
|
||||||
|
|
||||||
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary
|
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary
|
@ -1 +1 @@
|
|||||||
9.10.0
|
11.4.0
|
||||||
|
2
_root
2
_root
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/ulib" || exit 1
|
||||||
urequire base
|
urequire base
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS template apache.tools
|
urequire template apache.tools
|
||||||
apacheconfig_initvars
|
apacheconfig_initvars
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
|
18
authftp
18
authftp
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: Se connecter sur un site FTP authentifié
|
uecho "$scriptname: Se connecter sur un site FTP authentifié
|
||||||
@ -40,6 +39,14 @@ façon dont le proxy ftp est configuré, il n'est pas possible de se connecter
|
|||||||
avec un mot de passe qui contient le caractère @"
|
avec un mot de passe qui contient le caractère @"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
AUTHFTP_PROXY_DISABLED=1 # par défaut, ne pas utiliser le proxy
|
||||||
set_defaults proxy
|
set_defaults proxy
|
||||||
set_defaults authftp
|
set_defaults authftp
|
||||||
@ -76,19 +83,22 @@ read_value -i "Entrez le chemin" path "$4" N
|
|||||||
|
|
||||||
if [ -n "$lftp" ]; then
|
if [ -n "$lftp" ]; then
|
||||||
if [ -n "$noproxy" ]; then
|
if [ -n "$noproxy" ]; then
|
||||||
|
export LFTP_PASSWORD="$password"
|
||||||
if [ -n "$sftp" ]; then
|
if [ -n "$sftp" ]; then
|
||||||
url="sftp://$host/$path"
|
url="sftp://$host/$path"
|
||||||
|
hostkeyfailed_apropos "$login@$host"
|
||||||
else
|
else
|
||||||
url="ftp://$host/$path"
|
url="ftp://$host/$path"
|
||||||
fi
|
fi
|
||||||
exec lftp "${options[@]}" -e "\
|
exec lftp "${options[@]}" -e "\
|
||||||
set ssl:verify-certificate $verify_certificate
|
set ssl:verify-certificate $verify_certificate
|
||||||
open -u $login,$password $url"
|
open -u $login --env-password $url"
|
||||||
else
|
else
|
||||||
|
export LFTP_PASSWORD="${password}@${my_password}"
|
||||||
url="ftp://$AUTHFTP_PROXY_HOST/$path"
|
url="ftp://$AUTHFTP_PROXY_HOST/$path"
|
||||||
exec lftp "${options[@]}" -e "\
|
exec lftp "${options[@]}" -e "\
|
||||||
set ssl:verify-certificate $verify_certificate
|
set ssl:verify-certificate $verify_certificate
|
||||||
open -u ${login}@${my_login}@${host},${password}@${my_password} $url"
|
open -u ${login}@${my_login}@${host} --env-password $url"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -n "$noproxy" ]; then
|
if [ -n "$noproxy" ]; then
|
||||||
|
3
caturl
3
caturl
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: Afficher une url
|
uecho "$scriptname: Afficher une url
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python2
|
||||||
# -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
u"""Afficher un chronomètre"""
|
u"""Afficher un chronomètre"""
|
||||||
|
@ -411,7 +411,7 @@ javac* | jikes*)
|
|||||||
fi
|
fi
|
||||||
[[ ! -z "${execute:="${compilerDir}java -cp $cacheDir${classPath:+:$classPath} $mainClass"}" ]]
|
[[ ! -z "${execute:="${compilerDir}java -cp $cacheDir${classPath:+:$classPath} $mainClass"}" ]]
|
||||||
# Prepare to tell javac to compile for the latest language version it supports
|
# Prepare to tell javac to compile for the latest language version it supports
|
||||||
sourceVersion="-source $(${compilerDir}java -version 2>&1 | sed -n '1s,[^"]*"\([1-9][1-9]*\.[1-9][1-9]*\).*,\1,p')"
|
sourceVersion="-source $(${compilerDir}java -version 2>&1 | sed -n '1{s/.*"\(.*\)".*/\1/; s/^1\.//; s/\..*//; p}')"
|
||||||
;;
|
;;
|
||||||
jikes*)
|
jikes*)
|
||||||
if [[ -z "$classPath" && -z "$compilerArgs" && -z "$CLASSPATH" ]] ; then
|
if [[ -z "$classPath" && -z "$compilerArgs" && -z "$CLASSPATH" ]] ; then
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: créer un utilisateur sudoer et lui installer une clé publique ssh
|
uecho "$scriptname: créer un utilisateur sudoer et lui installer une clé publique ssh
|
||||||
|
8
cssh
8
cssh
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: Faire une connexion ssh en lançant automatiquement un screen sur l'hôte distant
|
uecho "$scriptname: Faire une connexion ssh en lançant automatiquement un screen sur l'hôte distant
|
||||||
@ -24,13 +23,14 @@ eval "$vars"
|
|||||||
[ "${#hosts[*]}" -gt 0 ] || die "Vous devez spécifier l'hôte sur lequel se connecter"
|
[ "${#hosts[*]}" -gt 0 ] || die "Vous devez spécifier l'hôte sur lequel se connecter"
|
||||||
|
|
||||||
[ ${#args[*]} -gt 0 ] && cmd="$(qvals "${args[@]}"); " || cmd=
|
[ ${#args[*]} -gt 0 ] && cmd="$(qvals "${args[@]}"); " || cmd=
|
||||||
cmd="$cmd$(<"$scriptdir/Sscreen")"
|
cmd="$cmd
|
||||||
|
export LOCKPRG=/bin/true; $(<"$scriptdir/Sscreen")"
|
||||||
cmd="'${cmd//\'/\'\\\'\'}'"
|
cmd="'${cmd//\'/\'\\\'\'}'"
|
||||||
|
|
||||||
for host in "${hosts[@]}"; do
|
for host in "${hosts[@]}"; do
|
||||||
"$ssh" \
|
"$ssh" \
|
||||||
"${options[@]}" -qt "$host" -- \
|
"${options[@]}" -qt "$host" -- \
|
||||||
"[ -x /usr/local/nutools/Sscreen ] && exec /usr/local/nutools/Sscreen $(qvals "${args[@]}") || exit 123"
|
"export LOCKPRG=/bin/true; [ -x /usr/local/nutools/Sscreen ] && exec /usr/local/nutools/Sscreen $(qvals "${args[@]}") || exit 123"
|
||||||
if [ $? -eq 123 ]; then
|
if [ $? -eq 123 ]; then
|
||||||
# pas de Sscreen en face, le faire à la main
|
# pas de Sscreen en face, le faire à la main
|
||||||
${exec:+exec} \
|
${exec:+exec} \
|
||||||
|
37
cx-conndev
37
cx-conndev
@ -1,18 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: se connecter à la base MySQL
|
uecho "$scriptname: se connecter à la base MySQL
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
$scriptname [DATABASE]
|
$scriptname [DATABASE]
|
||||||
$scriptname -c|-d [-uUSER [-pPASSWORD]] ...
|
$scriptname -d [-uUSER [-pPASSWORD]] DATABASES... >backup.sql
|
||||||
|
$scriptname -c [-uUSER [-pPASSWORD]] <backup.sql
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
--compose-v1
|
||||||
|
Forcer l'utilisation de docker-compose v1
|
||||||
-h, -s, --service SERVICE
|
-h, -s, --service SERVICE
|
||||||
Spécifier le nom du service. La valeur par défaut est db
|
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
|
-c, --mysql-cmd
|
||||||
Lancer 'mysql -hSERVICE_IP' avec les arguments supplémentaires fournis
|
Lancer 'mysql -hSERVICE_IP' avec les arguments supplémentaires fournis
|
||||||
sur la ligne de commande
|
sur la ligne de commande
|
||||||
@ -28,6 +36,7 @@ OPTIONS
|
|||||||
}
|
}
|
||||||
|
|
||||||
service=db
|
service=db
|
||||||
|
ipnum=
|
||||||
mysql_cmd=
|
mysql_cmd=
|
||||||
mysqldump_cmd=
|
mysqldump_cmd=
|
||||||
klean=
|
klean=
|
||||||
@ -35,7 +44,9 @@ user=
|
|||||||
password=
|
password=
|
||||||
args=(
|
args=(
|
||||||
--help '$exit_with display_help'
|
--help '$exit_with display_help'
|
||||||
|
--compose-v1 '$DOCKER_COMPOSE=(docker-compose)'
|
||||||
-h:,-s:,--service: service=
|
-h:,-s:,--service: service=
|
||||||
|
-i:,--ipnum: ipnum=
|
||||||
-c,--mysql-cmd mysql_cmd=1
|
-c,--mysql-cmd mysql_cmd=1
|
||||||
-d,--mysqldump-cmd mysqldump_cmd=1
|
-d,--mysqldump-cmd mysqldump_cmd=1
|
||||||
-k,--klean klean=1
|
-k,--klean klean=1
|
||||||
@ -66,12 +77,26 @@ fi
|
|||||||
###
|
###
|
||||||
|
|
||||||
function die_not_found() { die "$service: service introuvable. vérifiez que le projet est actuellement up"; }
|
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
|
[ -n "$cid" ] || die_not_found
|
||||||
edebug "$service id: $cid"
|
edebug "$service id: $cid"
|
||||||
|
|
||||||
function die_not_found() { die "$service: $cid: ip introuvable"; }
|
function die_not_found() { die "$service: $cid: ip introuvable"; }
|
||||||
setx ip=docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cid" || die_not_found
|
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%%,*}"
|
||||||
[ -n "$ip" ] || die_not_found
|
[ -n "$ip" ] || die_not_found
|
||||||
edebug "$service ip: $ip"
|
edebug "$service ip: $ip"
|
||||||
|
|
||||||
@ -87,7 +112,7 @@ elif [ -n "$klean" ]; then
|
|||||||
estep "wait 10sec..."
|
estep "wait 10sec..."
|
||||||
sleep 10
|
sleep 10
|
||||||
estep "start"
|
estep "start"
|
||||||
docker-compose start "$service"
|
"${DOCKER_COMPOSE[@]}" start "$service"
|
||||||
|
|
||||||
else
|
else
|
||||||
[ -f bin/conndev.php ] || die "Impossible de trouver le script compagnon conndev.php"
|
[ -f bin/conndev.php ] || die "Impossible de trouver le script compagnon conndev.php"
|
||||||
|
22
cx-shelldev
22
cx-shelldev
@ -1,29 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: ouvrir un shell dans le container
|
uecho "$scriptname: ouvrir un shell dans le container
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
$scriptname [SHELL]
|
$scriptname [CMD...]
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
--compose-v1
|
||||||
|
Forcer l'utilisation de docker-compose v1
|
||||||
-h, -s, --service SERVICE
|
-h, -s, --service SERVICE
|
||||||
Spécifier le nom du service sur lequel ouvrir le shell
|
Spécifier le nom du service sur lequel ouvrir le shell
|
||||||
-d
|
-d, --db
|
||||||
équivalent à -s db
|
équivalent à -s db
|
||||||
-w
|
-w, --web
|
||||||
équivalent à -s web (c'est la valeur par défaut)"
|
équivalent à -s web (c'est la valeur par défaut)"
|
||||||
}
|
}
|
||||||
|
|
||||||
service=web
|
service=web
|
||||||
args=(
|
args=(
|
||||||
--help '$exit_with display_help'
|
--help '$exit_with display_help'
|
||||||
|
--compose-v1 '$DOCKER_COMPOSE=(docker-compose)'
|
||||||
-h:,-s:,--service: service=
|
-h:,-s:,--service: service=
|
||||||
-d service=db
|
-d,--db service=db
|
||||||
-w service=web
|
-w,--web service=web
|
||||||
)
|
)
|
||||||
parse_args "$@"; set -- "${args[@]}"
|
parse_args "$@"; set -- "${args[@]}"
|
||||||
|
|
||||||
@ -48,9 +52,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=("$@")
|
||||||
[ ${#cmd[*]} -gt 0 ] || cmd=(bash)
|
[ ${#cmd[*]} -gt 0 ] || cmd=(bash)
|
||||||
|
|
||||||
docker-compose exec "$service" "${cmd[@]}"
|
"${DOCKER_COMPOSE[@]}" exec "$service" "${cmd[@]}"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: mettre à jour un module ur/* ou lib/* sans utiliser composer
|
uecho "$scriptname: mettre à jour un module ur/* ou lib/* sans utiliser composer
|
||||||
|
132
dmcerts
Executable file
132
dmcerts
Executable file
@ -0,0 +1,132 @@
|
|||||||
|
#!/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
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source /etc/ulibauto || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: import/exporter une docker-machine
|
uecho "$scriptname: import/exporter une docker-machine
|
||||||
@ -14,9 +14,9 @@ OPTIONS
|
|||||||
-d, --dump
|
-d, --dump
|
||||||
Exporter la machine
|
Exporter la machine
|
||||||
-l, --load
|
-l, --load
|
||||||
Import la machine
|
Importer la machine à partir de l'archive spécifiée
|
||||||
-a, --load-all
|
-a, --load-all
|
||||||
Importer toutes les machines"
|
Importer toutes les machines depuis le répertoire spécifié"
|
||||||
}
|
}
|
||||||
|
|
||||||
function dump_machine() {
|
function dump_machine() {
|
||||||
@ -129,8 +129,16 @@ if [ -z "$action" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
dump) dump_machine "$1";;
|
dump)
|
||||||
load) load_machine "$1";;
|
dump_machine "$1"
|
||||||
|
;;
|
||||||
|
load)
|
||||||
|
for archive in "$@"; do
|
||||||
|
etitle "$archive"
|
||||||
|
load_machine "$archive"
|
||||||
|
eend
|
||||||
|
done
|
||||||
|
;;
|
||||||
loadall)
|
loadall)
|
||||||
[ $# -gt 0 ] || set -- .
|
[ $# -gt 0 ] || set -- .
|
||||||
archives=()
|
archives=()
|
||||||
|
@ -1 +0,0 @@
|
|||||||
/b/t/
|
|
2
docker/.gitignore
vendored
2
docker/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
/b/
|
|
||||||
/build.env.local
|
|
@ -1,12 +0,0 @@
|
|||||||
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"]
|
|
72
docker/build
72
docker/build
@ -1,72 +0,0 @@
|
|||||||
#!/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
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
# -*- 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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/ulib" || exit 1
|
||||||
urequire base
|
urequire base
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: afficher les connexions TCP entrantes sur un port
|
uecho "$scriptname: afficher les connexions TCP entrantes sur un port
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS ipcalc
|
urequire ipcalc
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: s'assurer que l'hôte courant a l'adresse IP spécifiée
|
uecho "$scriptname: s'assurer que l'hôte courant a l'adresse IP spécifiée
|
||||||
|
3
fconv
3
fconv
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: convertir un fichier ou les fichiers d'un répertoire
|
uecho "$scriptname: convertir un fichier ou les fichiers d'un répertoire
|
||||||
|
3
fnconv
3
fnconv
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: renommer un fichier ou les fichiers d'un répertoire
|
uecho "$scriptname: renommer un fichier ou les fichiers d'un répertoire
|
||||||
|
3
fndate
3
fndate
@ -11,8 +11,7 @@ if [ "$#" -eq 1 -a "$1" == --nutools-makelinks ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: manipuler des noms de fichier pour les dater
|
uecho "$scriptname: manipuler des noms de fichier pour les dater
|
||||||
|
9
foreach
9
foreach
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: lancer une commande pour un ensemble d'arguments
|
uecho "$scriptname: lancer une commande pour un ensemble d'arguments
|
||||||
@ -83,7 +82,7 @@ OPTIONS
|
|||||||
répertoire parent (valide uniquement avec l'option -p)
|
répertoire parent (valide uniquement avec l'option -p)
|
||||||
-S, --git-status
|
-S, --git-status
|
||||||
Equivalent à spécifier la commande 'git status --p'
|
Equivalent à spécifier la commande 'git status --p'
|
||||||
Utiliser avec -G ou -C
|
Utiliser par exemple avec -g, -G ou -C
|
||||||
-G, --git-projects
|
-G, --git-projects
|
||||||
Equivalent à '--ptitle -p */.git --' e.g '$scriptname -G git pull' pour
|
Equivalent à '--ptitle -p */.git --' e.g '$scriptname -G git pull' pour
|
||||||
mettre à jour les dépôts situés dans un répertoire
|
mettre à jour les dépôts situés dans un répertoire
|
||||||
@ -124,7 +123,11 @@ parse_args "$@"; set -- "${args[@]}"
|
|||||||
|
|
||||||
case "$command" in
|
case "$command" in
|
||||||
git-status-p)
|
git-status-p)
|
||||||
|
if [ -n "$shortcut" ]; then
|
||||||
set -- git status --p "$@"
|
set -- git status --p "$@"
|
||||||
|
else
|
||||||
|
set -- "$@" -- git status --p
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
case "$shortcut" in
|
case "$shortcut" in
|
||||||
|
3
geturl
3
geturl
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
source "$(dirname "$0")/lib/ulib/ulib" || exit 1
|
source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
|
||||||
urequire DEFAULTS
|
|
||||||
|
|
||||||
function display_help() {
|
function display_help() {
|
||||||
uecho "$scriptname: Télécharger un fichier avec wget ou curl
|
uecho "$scriptname: Télécharger un fichier avec wget ou curl
|
||||||
|
4
ipaddr
4
ipaddr
@ -7,7 +7,9 @@ elif [ -x /bin/ip ]; then IP=/bin/ip
|
|||||||
else IP=ip
|
else IP=ip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tty -s <&1 && isatty=1 || isatty=
|
if [ -n "IPADDR_COLOR" ]; then isatty=1
|
||||||
|
else tty -s <&1 && isatty=1 || isatty=
|
||||||
|
fi
|
||||||
|
|
||||||
"$IP" addr "$@" | awk -v isatty="$isatty" '
|
"$IP" addr "$@" | awk -v isatty="$isatty" '
|
||||||
isatty && $0 ~ /^[0-9]/ {
|
isatty && $0 ~ /^[0-9]/ {
|
||||||
|
33
ldiff
Executable file
33
ldiff
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
||||||
|
|
||||||
|
function display_help() {
|
||||||
|
uecho "$scriptname: frontend de diff pour comparer deux fichiers encodés en latin1
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
$scriptname [options] Lfile Rfile
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
-u, -U, --unified N
|
||||||
|
-w, --ignore-all-space
|
||||||
|
-B, --ignore-blank-lines
|
||||||
|
options de diff qui sont reprises telles quelles"
|
||||||
|
}
|
||||||
|
|
||||||
|
diffopts=()
|
||||||
|
args=(
|
||||||
|
--help '$exit_with display_help'
|
||||||
|
-u '$diffopts+=(-u)'
|
||||||
|
-U:,--unified: '$diffopts+=(-U "$value_")'
|
||||||
|
-w,--ignore-all-space '$diffopts+=(-w)'
|
||||||
|
-B,--ignore-blank-lines '$diffopts+=(-B)'
|
||||||
|
)
|
||||||
|
parse_args "$@"; set -- "${args[@]}"
|
||||||
|
|
||||||
|
Lfile="$1"
|
||||||
|
Rfile="$2"
|
||||||
|
[ -n "$Lfile" -a -n "$Rfile" ] || die "vous devez spécifier les deux fichiers"
|
||||||
|
[ -d "$Lfile" -o -d "$Rfile" ] && die "il faut absolument comparer deux fichiers"
|
||||||
|
|
||||||
|
diff "${diffopts[@]}" <(iconv -f latin1 -t utf-8 "$Lfile") <(iconv -f latin1 -t utf-8 "$Rfile")
|
41
lgrep
Executable file
41
lgrep
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
source "$(dirname "$0")/lib/ulib/auto" || exit 1
|
||||||
|
|
||||||
|
function display_help() {
|
||||||
|
uecho "$scriptname: frontend de grep pour 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 python
|
#!/usr/bin/env python2
|
||||||
# -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- 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
|
u"""%(scriptname)s: afficher le hash SHA-1 d'un fichier exprimé en base 36
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
|
if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
|
||||||
function __bash_completion_enabled() { return 1; }
|
function __bash_completion_enabled() { return 1; }
|
||||||
function __bash_completion_module_enabled() { return 1; }
|
function __bash_completion_module_enabled() { return 1; }
|
||||||
if [ -f /etc/debian_version ]; then
|
_file=
|
||||||
|
if [ -n "$UTOOLS_BASH_COMPLETION_COMPAT" ]; then
|
||||||
|
_file="@@dest@@/lib/ulib/$UTOOLS_BASH_COMPLETION_COMPAT/bash_completion"
|
||||||
|
elif [ -f /etc/debian_version ]; then
|
||||||
case "$(</etc/debian_version)" in
|
case "$(</etc/debian_version)" in
|
||||||
6*|squeeze*)
|
6*|squeeze*)
|
||||||
# le code suivant n'est compatible qu'avec debian squeeze (plus
|
# le code suivant n'est compatible qu'avec debian squeeze (plus
|
||||||
@ -17,9 +20,9 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
|
|||||||
_file="@@dest@@/lib/ulib/bash41/bash_completion"
|
_file="@@dest@@/lib/ulib/bash41/bash_completion"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
[ -f "$_file" ] && source "$_file"
|
[ -f "$_file" ] && source "$_file"
|
||||||
unset _file
|
unset _file
|
||||||
fi
|
|
||||||
if __bash_completion_enabled; then
|
if __bash_completion_enabled; then
|
||||||
for i in "@@dest@@/lib/completion.d/"*; do
|
for i in "@@dest@@/lib/completion.d/"*; do
|
||||||
[ -f "$i" ] || continue
|
[ -f "$i" ] || continue
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
# Activer l'auto complétion de bash pour les outils de nutools
|
# Activer l'auto complétion de bash pour les outils de nutools
|
||||||
#export UTOOLS_BASH_COMPLETION=1
|
#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
|
# 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
|
# _root. Par défaut, ce n'est le cas que si sudo n'est pas installé. Si sudo est
|
||||||
|
@ -14,5 +14,11 @@
|
|||||||
# d'aliases
|
# d'aliases
|
||||||
#CLUSTERDIRS=(~/wop/containers/*.univ.run)
|
#CLUSTERDIRS=(~/wop/containers/*.univ.run)
|
||||||
|
|
||||||
# Image à utiliser pour lancer composer
|
# Répertoire de base par défaut des projets en mode devel
|
||||||
#COMPOSER_IMAGE=docker.univ-reunion.fr/image/apache-php-myiccas-utils:d10
|
#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
|
||||||
|
4
lib/default/dkbuild
Normal file
4
lib/default/dkbuild
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
# Profil par défaut
|
||||||
|
#DKBUILD_PROFILE=prod
|
31
lib/dkbuild/dot-dkbuild.env
Normal file
31
lib/dkbuild/dot-dkbuild.env
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
default_profile "${DKBUILD_PROFILE:-prod}"
|
||||||
|
|
||||||
|
# Source des paquets et proxy
|
||||||
|
#setenv APT_PROXY=http://aptcache.devel.self:3142
|
||||||
|
#setenv APT_MIRROR=default
|
||||||
|
#setenv SEC_MIRROR=default
|
||||||
|
|
||||||
|
# Timezone du serveur
|
||||||
|
#setenv TIMEZONE=Indian/Reunion
|
||||||
|
|
||||||
|
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/rununiv
|
||||||
|
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 dist; then
|
||||||
|
setenv REGISTRY=pubdocker.univ-reunion.fr/dist
|
||||||
|
setenv PRIVAREG=pridocker.univ-reunion.fr
|
||||||
|
elif profile devel; then
|
||||||
|
setenv REGISTRY=docker.devel.self/rununiv
|
||||||
|
setenv PRIVAREG=docker.devel.self
|
||||||
|
fi
|
1
lib/dkbuild/templates/default
Symbolic link
1
lib/dkbuild/templates/default
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
php
|
3
lib/dkbuild/templates/image/.gitattributes
vendored
Normal file
3
lib/dkbuild/templates/image/.gitattributes
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*.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
|
2
lib/dkbuild/templates/image/.gitignore
vendored
Normal file
2
lib/dkbuild/templates/image/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.~lock*#
|
||||||
|
.*.swp
|
3
lib/dkbuild/templates/image/common/Dockerfile.in
Normal file
3
lib/dkbuild/templates/image/common/Dockerfile.in
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# -*- 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
|
2
lib/dkbuild/templates/image/d11/.dockerignore
Normal file
2
lib/dkbuild/templates/image/d11/.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/b/t/
|
||||||
|
**/.git/
|
3
lib/dkbuild/templates/image/d11/.gitignore
vendored
Normal file
3
lib/dkbuild/templates/image/d11/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/b/
|
||||||
|
/Dockerfile
|
||||||
|
# autogénéré
|
11
lib/dkbuild/templates/image/d11/dkbuild
Normal file
11
lib/dkbuild/templates/image/d11/dkbuild
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# -*- 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
lib/dkbuild/templates/image/d11/dkbuild.env
Symbolic link
1
lib/dkbuild/templates/image/d11/dkbuild.env
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../dkbuild.env
|
9
lib/dkbuild/templates/image/dkbuild
Normal file
9
lib/dkbuild/templates/image/dkbuild
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- 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
|
3
lib/dkbuild/templates/image/dkbuild.env
Normal file
3
lib/dkbuild/templates/image/dkbuild.env
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# -*- 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
|
3
lib/dkbuild/templates/php/.gitignore
vendored
Normal file
3
lib/dkbuild/templates/php/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/Dockerfile
|
||||||
|
.~lock*#
|
||||||
|
.*.swp
|
25
lib/dkbuild/templates/php/dkbuild
Normal file
25
lib/dkbuild/templates/php/dkbuild
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# -*- 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
|
4
lib/dkbuild/templates/php/dkbuild.env
Normal file
4
lib/dkbuild/templates/php/dkbuild.env
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# -*- 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
|
6
lib/dkbuild/templates/php_db/.gitignore
vendored
Normal file
6
lib/dkbuild/templates/php_db/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/docker-compose.yml
|
||||||
|
/docker-compose.*.yml
|
||||||
|
/web/Dockerfile
|
||||||
|
/db/Dockerfile
|
||||||
|
.~lock*#
|
||||||
|
.*.swp
|
37
lib/dkbuild/templates/php_db/dkbuild
Normal file
37
lib/dkbuild/templates/php_db/dkbuild
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# -*- 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
|
4
lib/dkbuild/templates/php_db/dkbuild.env
Normal file
4
lib/dkbuild/templates/php_db/dkbuild.env
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# -*- 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
|
12
lib/dkbuild/templates/php_db/docker-composer.devel.yml
Normal file
12
lib/dkbuild/templates/php_db/docker-composer.devel.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# -*- 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
|
14
lib/dkbuild/templates/php_db/docker-composer.prod.yml
Normal file
14
lib/dkbuild/templates/php_db/docker-composer.prod.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- 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"
|
14
lib/dkbuild/templates/php_db/docker-composer.test.yml
Normal file
14
lib/dkbuild/templates/php_db/docker-composer.test.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- 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"
|
34
lib/dkbuild/templates/php_db/docker-composer.yml
Normal file
34
lib/dkbuild/templates/php_db/docker-composer.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# -*- 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:
|
8
lib/dkbuild/templates/templates.conf
Normal file
8
lib/dkbuild/templates/templates.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# -*- 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"
|
||||||
|
)
|
5
lib/dkbuild/tests/.gitignore
vendored
Normal file
5
lib/dkbuild/tests/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/Dockerfile
|
||||||
|
/src
|
||||||
|
/dest
|
||||||
|
/srcdir/
|
||||||
|
/destdir/
|
8
lib/dkbuild/tests/README.md
Normal file
8
lib/dkbuild/tests/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# tests
|
||||||
|
|
||||||
|
Lancer un test de cette façon
|
||||||
|
~~~sh
|
||||||
|
../../../dkbuild -j test-xxx
|
||||||
|
~~~
|
||||||
|
|
||||||
|
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary
|
2
lib/dkbuild/tests/registry.env
Normal file
2
lib/dkbuild/tests/registry.env
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
setenv REGISTRY=docker.jclain.fr
|
16
lib/dkbuild/tests/test-args
Normal file
16
lib/dkbuild/tests/test-args
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- 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=
|
13
lib/dkbuild/tests/test-config
Normal file
13
lib/dkbuild/tests/test-config
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# -*- 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=
|
15
lib/dkbuild/tests/test-dir2dir
Normal file
15
lib/dkbuild/tests/test-dir2dir
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# -*- 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=
|
13
lib/dkbuild/tests/test-dir2file
Normal file
13
lib/dkbuild/tests/test-dir2file
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# -*- 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=
|
20
lib/dkbuild/tests/test-distversions
Normal file
20
lib/dkbuild/tests/test-distversions
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- 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
|
||||||
|
"
|
8
lib/dkbuild/tests/test-dkbuild
Normal file
8
lib/dkbuild/tests/test-dkbuild
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
if runb; then
|
||||||
|
qvals dkbuild -c "${DKBUILD_CONFIGS[0]}" "${DKBUILD_CMD_ARGS[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pas de build automatique
|
||||||
|
AUTOBUILD=
|
14
lib/dkbuild/tests/test-file2dir
Normal file
14
lib/dkbuild/tests/test-file2dir
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- 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=
|
13
lib/dkbuild/tests/test-file2file
Normal file
13
lib/dkbuild/tests/test-file2file
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# -*- 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=
|
27
lib/dkbuild/tests/test-gitignore
Normal file
27
lib/dkbuild/tests/test-gitignore
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# -*- 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=
|
13
lib/dkbuild/tests/test-ls-distprofiles
Normal file
13
lib/dkbuild/tests/test-ls-distprofiles
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# -*- 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=
|
10
lib/dkbuild/tests/test-ls-distversions
Normal file
10
lib/dkbuild/tests/test-ls-distversions
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
setdists v1-d11 v2-d11 v1-d10
|
||||||
|
|
||||||
|
if dist LATEST; then
|
||||||
|
info "$DIST est la distribution la plus récente"
|
||||||
|
fi
|
||||||
|
info "version=$VERSION"
|
||||||
|
|
||||||
|
# pas de build automatique
|
||||||
|
AUTOBUILD=
|
10
lib/dkbuild/tests/test-ls-profileversions
Normal file
10
lib/dkbuild/tests/test-ls-profileversions
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
setprofiles v1-prod v2-prod test
|
||||||
|
|
||||||
|
if profile DEFAULT; then
|
||||||
|
info "$PROFILE est le profil par défaut"
|
||||||
|
fi
|
||||||
|
info "version=$VERSION"
|
||||||
|
|
||||||
|
# pas de build automatique
|
||||||
|
AUTOBUILD=
|
16
lib/dkbuild/tests/test-machine
Normal file
16
lib/dkbuild/tests/test-machine
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- 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=
|
16
lib/dkbuild/tests/test-messages
Normal file
16
lib/dkbuild/tests/test-messages
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- 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=
|
8
lib/dkbuild/tests/test-tags0
Normal file
8
lib/dkbuild/tests/test-tags0
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# -*- 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
|
9
lib/dkbuild/tests/test-tags1
Normal file
9
lib/dkbuild/tests/test-tags1
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# -*- 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
|
16
lib/dkbuild/tests/test-vars0
Normal file
16
lib/dkbuild/tests/test-vars0
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- 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 "$0" -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=
|
15
lib/dkbuild/tests/test-vars1
Normal file
15
lib/dkbuild/tests/test-vars1
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
setenv dne=1
|
||||||
|
setenv de=
|
||||||
|
|
||||||
|
info "dne=$dne de=$de"
|
||||||
|
if [ -n "$dne" -o -z "$de" ]; then
|
||||||
|
note "\
|
||||||
|
Relancer avec
|
||||||
|
$(qvals "$0" -j "$(relpath "$DKBUILD")" -e dne= -e de=1)
|
||||||
|
pour vérifier qu'on peut changer la valeur avec les options en ligne de commande"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pas de build automatique
|
||||||
|
AUTOBUILD=
|
106
lib/dmcerts_openssl_ca.cnf
Normal file
106
lib/dmcerts_openssl_ca.cnf
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
# -*- 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
|
99
lib/dmcerts_openssl_client.cnf
Normal file
99
lib/dmcerts_openssl_client.cnf
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
# -*- 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
|
101
lib/dmcerts_openssl_server.cnf
Normal file
101
lib/dmcerts_openssl_server.cnf
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# -*- 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
lib/nulib/.gitignore
vendored
0
lib/nulib/.gitignore
vendored
@ -1,17 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,5 +0,0 @@
|
|||||||
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
|
|
@ -1,2 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
line.separator=\n
|
|
@ -1,4 +0,0 @@
|
|||||||
global-include *
|
|
||||||
global-exclude *.pyc
|
|
||||||
exclude MANIFEST
|
|
||||||
prune dist
|
|
@ -1,180 +0,0 @@
|
|||||||
# 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
|
|
@ -1,4 +0,0 @@
|
|||||||
# -*- 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"
|
|
@ -1,157 +0,0 @@
|
|||||||
# -*- 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
|
|
||||||
}
|
|
@ -1,141 +0,0 @@
|
|||||||
# -*- 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
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
# -*- 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)
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user