From 3bbcdd1f8bfb284bdb77df5fe7327e0a5d2c6a4c Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 17 Sep 2024 15:03:13 +0400 Subject: [PATCH] supprimer rundk --- support/Dockerfile.adminer | 31 -- support/Dockerfile.adminer+ic | 40 --- support/Dockerfile.mariadb10 | 19 -- support/Dockerfile.php-apache | 31 -- support/Dockerfile.php-apache+ic | 44 --- support/Dockerfile.php-cli | 30 -- support/Dockerfile.php-cli+ic | 43 --- support/Dockerfile.postgres15 | 16 - support/Dockerfile.rundk | 30 -- support/Dockerfile.rundk+ic | 43 --- support/build | 179 ----------- support/dot-build.env.dist | 19 -- support/dot-dkbuild.env.dist | 28 -- support/rundk.1preamble | 18 -- support/rundk.2postamble | 502 ------------------------------- support/rundk.userconf | 29 -- support/template.sh | 22 -- support/update-rundk.sh | 87 ------ 18 files changed, 1211 deletions(-) delete mode 100644 support/Dockerfile.adminer delete mode 100644 support/Dockerfile.adminer+ic delete mode 100644 support/Dockerfile.mariadb10 delete mode 100644 support/Dockerfile.php-apache delete mode 100644 support/Dockerfile.php-apache+ic delete mode 100644 support/Dockerfile.php-cli delete mode 100644 support/Dockerfile.php-cli+ic delete mode 100644 support/Dockerfile.postgres15 delete mode 100644 support/Dockerfile.rundk delete mode 100644 support/Dockerfile.rundk+ic delete mode 100755 support/build delete mode 100644 support/dot-build.env.dist delete mode 100644 support/dot-dkbuild.env.dist delete mode 100644 support/rundk.1preamble delete mode 100644 support/rundk.2postamble delete mode 100644 support/rundk.userconf delete mode 100755 support/template.sh delete mode 100755 support/update-rundk.sh diff --git a/support/Dockerfile.adminer b/support/Dockerfile.adminer deleted file mode 100644 index 96df10b..0000000 --- a/support/Dockerfile.adminer +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=php /g/ /g/ -RUN /g/build -a @adminer - -EXPOSE 80 -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.adminer+ic b/support/Dockerfile.adminer+ic deleted file mode 100644 index 609ee69..0000000 --- a/support/Dockerfile.adminer+ic +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/instantclient AS instantclient -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -COPY --from=instantclient /g/ /g/ -COPY --from=instantclient /src/ /src/ -RUN /g/build _instantclient_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=php /g/ /g/ -RUN /g/build -a @adminer - -COPY --from=instantclient /g/ /g/ -COPY --from=builder /opt/oracle/ /opt/oracle/ -RUN /g/build instantclient - -EXPOSE 80 -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.mariadb10 b/support/Dockerfile.mariadb10 deleted file mode 100644 index f26efd5..0000000 --- a/support/Dockerfile.mariadb10 +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG REGISTRY=pubdocker.univ-reunion.fr -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/mariadb AS mariadb -FROM $REGISTRY/src/legacytools AS legacytools - -FROM mariadb:10 -ARG APT_PROXY TIMEZONE -ENV APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=mariadb /g/ /g/ -RUN /g/build -a @base @mariadb - -COPY --from=legacytools /g/ /g/ -RUN /g/build nutools servertools - -EXPOSE 3306 -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.php-apache b/support/Dockerfile.php-apache deleted file mode 100644 index 3d5adf4..0000000 --- a/support/Dockerfile.php-apache +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=php /g/ /g/ -RUN /g/build -a @apache-php-cas php-utils - -EXPOSE 80 443 -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.php-apache+ic b/support/Dockerfile.php-apache+ic deleted file mode 100644 index 9c3cd80..0000000 --- a/support/Dockerfile.php-apache+ic +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/legacytools AS legacytools -FROM $REGISTRY/src/instantclient AS instantclient -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -COPY --from=instantclient /g/ /g/ -COPY --from=instantclient /src/ /src/ -RUN /g/build _instantclient_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=legacytools /g/ /g/ -RUN /g/build nutools - -COPY --from=php /g/ /g/ -RUN /g/build -a @apache-php-cas php-utils - -COPY --from=instantclient /g/ /g/ -COPY --from=builder /opt/oracle/ /opt/oracle/ -RUN /g/build instantclient - -EXPOSE 80 443 -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.php-cli b/support/Dockerfile.php-cli deleted file mode 100644 index ef17f83..0000000 --- a/support/Dockerfile.php-cli +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=php /g/ /g/ -RUN /g/build @php-cli php-utils - -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.php-cli+ic b/support/Dockerfile.php-cli+ic deleted file mode 100644 index b380090..0000000 --- a/support/Dockerfile.php-cli+ic +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/legacytools AS legacytools -FROM $REGISTRY/src/instantclient AS instantclient -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -COPY --from=instantclient /g/ /g/ -COPY --from=instantclient /src/ /src/ -RUN /g/build _instantclient_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=legacytools /g/ /g/ -RUN /g/build nutools - -COPY --from=php /g/ /g/ -RUN /g/build @php-cli php-utils - -COPY --from=instantclient /g/ /g/ -COPY --from=builder /opt/oracle/ /opt/oracle/ -RUN /g/build instantclient - -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.postgres15 b/support/Dockerfile.postgres15 deleted file mode 100644 index f9b4db9..0000000 --- a/support/Dockerfile.postgres15 +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG REGISTRY=pubdocker.univ-reunion.fr -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/postgres AS postgres - -FROM postgres:15-bookworm -ARG APT_PROXY TIMEZONE -ENV APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=postgres /g/ /g/ -RUN /g/build -a @base @postgres -RUN /g/pkg i @ssl @git - -EXPOSE 5432 -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.rundk b/support/Dockerfile.rundk deleted file mode 100644 index ef17f83..0000000 --- a/support/Dockerfile.rundk +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=php /g/ /g/ -RUN /g/build @php-cli php-utils - -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/Dockerfile.rundk+ic b/support/Dockerfile.rundk+ic deleted file mode 100644 index b380090..0000000 --- a/support/Dockerfile.rundk+ic +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 mode: dockerfile -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -ARG NDIST=12 -ARG REGISTRY=pubdocker.univ-reunion.fr - -FROM $REGISTRY/src/base AS base -FROM $REGISTRY/src/legacytools AS legacytools -FROM $REGISTRY/src/instantclient AS instantclient -FROM $REGISTRY/src/php AS php - -################################################################################ -FROM debian:${NDIST}-slim AS builder -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=base /src/ /src/ -RUN /g/build core lite _builder -RUN /g/build _su-exec_builder - -COPY --from=instantclient /g/ /g/ -COPY --from=instantclient /src/ /src/ -RUN /g/build _instantclient_builder - -################################################################################ -FROM debian:${NDIST}-slim -ARG APT_MIRROR SEC_MIRROR APT_PROXY TIMEZONE -ENV APT_MIRROR=$APT_MIRROR SEC_MIRROR=$SEC_MIRROR APT_PROXY=$APT_PROXY TIMEZONE=$TIMEZONE - -COPY --from=base /g/ /g/ -COPY --from=builder /src/su-exec/su-exec /g/ -RUN /g/build - -COPY --from=legacytools /g/ /g/ -RUN /g/build nutools - -COPY --from=php /g/ /g/ -RUN /g/build @php-cli php-utils - -COPY --from=instantclient /g/ /g/ -COPY --from=builder /opt/oracle/ /opt/oracle/ -RUN /g/build instantclient - -ENTRYPOINT ["/g/entrypoint"] diff --git a/support/build b/support/build deleted file mode 100755 index 8a5c89f..0000000 --- a/support/build +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash -# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -MYDIR="$(cd "$(dirname -- "$0")"; pwd)" -"$MYDIR/rundk" --bs --ue --ci || exit 1 -PROJDIR=; COMPOSERDIR=; COMPOSERPHAR=; VENDORDIR=; BUILDENV0=; BUILDENV= -BUILD_IMAGES=(php-apache mariadb10); export BUILD_FLAVOUR=; DIST=; IMAGENAME= -source "$MYDIR/rundk" || exit 1 -source "$PROJDIR/$VENDORDIR/nulib/php/load.sh" || exit 1 -require: template - -BUILD_ARGS=( - DIST NDIST - REGISTRY - APT_PROXY - APT_MIRROR - SEC_MIRROR - TIMEZONE -) - -function dklsnet() { - docker network ls --no-trunc --format '{{.Name}}' -f name="$1" 2>/dev/null -} - -function dklsimg() { - local image="$1" version="$2" - docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$image${version:+:$version}" 2>/dev/null -} - -function dklsct() { - # afficher le container dont l'image correspondante est $1 - docker ps --no-trunc --format '{{.Image}} {{.Names}}' | awk -v image="$1" '$1 == image { print $2 }' -} - -function dkrunning() { - # vérifier si le container d'image $1 tourne - [ -n "$(dklsct "$@")" ] -} - -function dclsct() { - # afficher les containers correspondant à $1(=docker-compose.yml) - docker compose ${1:+-f "$1"} ps -q -} - -function dcrunning() { - # vérifier si les containers correspondant à $1(=docker-compose.yml) tournent - # si $2 est spécifié, c'est le nombre de service qui doit tourner - if [ -n "$2" ]; then - [ "$(dclsct "${@:1:1}" | wc -l)" -eq "$2" ] - else - [ -n "$(dclsct "${@:1:1}")" ] - fi -} - -function build_check_env() { - eval "$(template_locals)" - - template_copy_missing "$PROJDIR/$BUILDENV0" && updated=1 - template_process_userfiles - - if [ -n "$updated" ]; then - enote "IMPORTANT: Veuillez faire le paramétrage en éditant le fichier $BUILDENV - ${EDITOR:-nano} $BUILDENV -ENSUITE, vous pourrez relancer la commande" - return 1 - fi -} - -function _build() { - local dockerfile image="${PRIVAREG:+$PRIVAREG/}${IMAGENAME%/*}/$1" - if [ -n "$ForceBuild" -o -z "$(dklsimg "$image")" ]; then - estep "Construction de $image" - dockerfiles=( - "$MYDIR/Dockerfile.$1.local" - "$MYDIR/Dockerfile.$1$BUILD_FLAVOUR" - "$PROJDIR/$VENDORDIR/nulib/php/support/Dockerfile.$1$BUILD_FLAVOUR" - "$MYDIR/Dockerfile.$1" - "$PROJDIR/$VENDORDIR/nulib/php/support/Dockerfile.$1" - ) - for dockerfile in "${dockerfiles[@]}"; do - [ -f "$dockerfile" ] && break - done - args=( - -f "$dockerfile" - ${Pull:+--pull} - ${NoCache:+--no-cache} - ${PlainOutput:+--progress plain} - -t "$image" - ) - for arg in "${BUILD_ARGS[@]}"; do - args+=(--build-arg "$arg=${!arg}") - done - for arg in "${!PROXY_VARS[@]}"; do - args+=(--build-arg "$arg=${PROXY_VARS[$arg]}") - done - for host in "${HOST_MAPPINGS[@]}"; do - args+=(--add-host "$host") - done - docker build "${args[@]}" "$PROJDIR" || die - if [ -n "$Push" ]; then - if [ -n "$PRIVAREG" ]; then - estep "Poussement de $image" - docker push "$image" || die - else - ewarn "PRIVAREG non défini: impossible de pousser l'image" - fi - fi - fi -} -function build_images() { - local image sourced - - [ $# -gt 0 ] || set -- rundk "${BUILD_IMAGES[@]}" - for image in "$@"; do - case "$image" in - rundk) - [ ${#Configs[*]} -gt 0 ] && export RUNDK_FORCE_BUILDENVS="${Configs[*]}" - local -a args=(--bootstrap) - [ "$ForceBuild" != all ] && args+=(--unless-exists) - [ -n "$Pull" ] && args+=(--pull) - [ -n "$NoCache" ] && args+=(--no-cache) - "$MYDIR/rundk" "${args[@]}" || die - ;; - *) - if [ -z "$sourced" ]; then - [ ${#Configs[*]} -gt 0 ] || Configs=("$PROJDIR/$BUILDENV") - for config in "${Configs[@]}"; do - source "$config" - done - after_source_buildenv - read -a HOST_MAPPINGS <<<"${HOST_MAPPINGS// -/ }" - sourced=1 - fi - _build "$image" - ;; - esac - done -} - -action=build -Configs=() -ForceBuild= -Pull= -NoCache= -PlainOutput= -Push= -args=( - "Construire les images pour le projet" - #"usage" - --check-only action=none "++Ne faire que la vérification de l'environnement" - -c:,--config:BUILDENV Configs "Spécifier un fichier d'environnement pour le build" - -r,--rebuild ForceBuild=1 "Forcer la (re)construction des images" - -R,--rebuild-all ForceBuild=all "++Comme --rebuild, mais reconstruire aussi rundk" - -U,--pull Pull=1 "++Forcer le re-téléchargement des images dépendantes" - -j,--no-cache NoCache=1 "++Construire l'image en invalidant le cache" - -D,--plain-output PlainOutput=1 "++Afficher le détail du build" - -p,--push Push=1 "Pousser les images vers le registry après construction" -) -parse_args "$@"; set -- "${args[@]}" - -if [ ${#Configs[*]} -gt 0 ]; then - aconfigs=() - for config in "${Configs[@]}"; do - setx config=abspath "$config" - aconfigs+=("$config") - done - Configs=("${aconfigs[@]}") - # pas de vérification d'environnement si on spécifie Configs - # ne pas oublier d'implémenter un traitement spécifique si build_check_env() - # contient d'autres vérifications -else - build_check_env || die -fi -[ "$action" == none ] && exit 0 - -case "$action" in -build) build_images "$@";; -*) die "$action: action non implémentée";; -esac diff --git a/support/dot-build.env.dist b/support/dot-build.env.dist deleted file mode 100644 index f429b52..0000000 --- a/support/dot-build.env.dist +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 - -# Source des paquets et proxy -APT_PROXY= -APT_MIRROR=default -SEC_MIRROR=default - -# Timezone du serveur -TIMEZONE=Europe/Paris - -# registre docker privé d'après lequel sont nommées les images -PRIVAREG= - -################################################################################ -# Ne pas toucher à partir d'ici - -REGISTRY=pubdocker.univ-reunion.fr -DIST=d12 -IMAGENAME=nulib/rundk diff --git a/support/dot-dkbuild.env.dist b/support/dot-dkbuild.env.dist deleted file mode 100644 index 06a0348..0000000 --- a/support/dot-dkbuild.env.dist +++ /dev/null @@ -1,28 +0,0 @@ -# -*- 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= -setenv APT_MIRROR=default -setenv SEC_MIRROR=default - -# Timezone du serveur -setenv TIMEZONE=Europe/Paris - -if profile prod test; then - setenv REGISTRY=pubdocker.univ-reunion.fr - setenv PRIVAREG=pridocker.univ-reunion.fr - host_mappings=( - pridocker.univ-reunion.fr:10.85.1.56 - pubdocker.univ-reunion.fr:10.85.1.57 - repos.univ-reunion.fr:10.85.1.57 - git.univ-reunion.fr:10.85.1.55 - ) - default docker host-mappings="${host_mappings[*]}" -elif profile devel; then - setenv REGISTRY=docker.devel.self - setenv PRIVAREG=docker.devel.self -else - setenv REGISTRY=pubdocker.univ-reunion.fr - setenv PRIVAREG= -fi diff --git a/support/rundk.1preamble b/support/rundk.1preamble deleted file mode 100644 index 1fb61be..0000000 --- a/support/rundk.1preamble +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -# Script permettant de lancer une commande dans docker et/ou de bootstrapper -# l'utilisation de nulib dans un projet -# Les fichiers suivants doivent être copiés à un endroit quelconque du projet: -# - rundk (ce script, à générer avec update-rundk.sh) -# - Dockerfile.rundk -# Les fichiers suivants peuvent être intégrés dans le projet comme exemples: -# - dot-build.env.dist (à renommer en .build.env.dist) -# - dot-dkbuild.env.dist (indiquer qu'il faut le copier en ~/.dkbuild.env) -# Par défaut, ce script assume que rundk est copié dans le répertoire sbin/ -# du projet, et que le fichier composer.json et le répertoire vendor/ sont à la -# racine du projet. Le cas échéant, modifier les valeurs ci-dessous -(return 0 2>/dev/null) && _sourced=1 || _sourced= - -############################################################################### -# Modifier les valeurs suivantes si nécessaire -#SOF:rundk.userconf:ne pas modifier cette ligne diff --git a/support/rundk.2postamble b/support/rundk.2postamble deleted file mode 100644 index eb972a1..0000000 --- a/support/rundk.2postamble +++ /dev/null @@ -1,502 +0,0 @@ -#EOF:rundk.userconf:ne pas modifier cette ligne -################################################################################ - -# Ne pas modifier à partir d'ici - -if [ -n "$_sourced" ]; then - if [ "${0#-}" != "$0" ]; then - # sourcé depuis la ligne de commande - MYSELF="${BASH_SOURCE[1]}" - else - # sourcé depuis un script - MYSELF="${BASH_SOURCE[0]}" - fi - MYDIR="$(cd "$(dirname -- "$MYSELF")"; pwd)" - MYNAME="$(basename -- "$MYSELF")" -else - MYDIR="$(cd "$(dirname -- "$0")"; pwd)" - MYNAME="$(basename -- "$0")" -fi -if [ -f "$MYDIR/rundk.userconf.local" ]; then - source "$MYDIR/rundk.userconf.local" -fi - -[ -n "$PROJDIR" ] || PROJDIR="$(dirname -- "$MYDIR")" -[ "${PROJDIR#/}" != "$PROJDIR" ] || PROJDIR="$(cd "$MYDIR/$PROJDIR"; pwd)" - -[ -n "$COMPOSERDIR" ] || COMPOSERDIR=. -[ -n "$COMPOSERPHAR" ] || COMPOSERPHAR=sbin/composer.phar -[ -n "$VENDORDIR" ] || VENDORDIR=vendor -[ -n "$BUILDENV0" ] || BUILDENV0=.build.env.dist -[ -n "$BUILDENV" ] || BUILDENV=build.env -[ -n "$DIST" ] || DIST=d12 -[ -n "$IMAGENAME" ] || IMAGENAME=nulib/rundk - -[ "$COMPOSERPHAR" == none ] && COMPOSERPHAR= -[ "$BUILDENV0" == none ] && BUILDENV0= -[ "$BUILDENV" == none ] && BUILDENV= - -function after_source_buildenv() { - NDIST="${DIST#d}" -} -after_source_buildenv - -[ -n "$_sourced" ] && return 0 - -function eecho() { echo "$*" 1>&2; } -function eerror() { eecho "ERROR: $*"; } -function die() { [ $# -gt 0 ] && eerror "$*"; exit 1; } -function is_defined() { [ -n "$(declare -p "$1" 2>/dev/null)" ]; } -function in_path() { [ -n "$1" -a -x "$(which "$1" 2>/dev/null)" ]; } -function composer() { - cd "$PROJDIR/$COMPOSERDIR" || exit 1 - if [ -x "$PROJDIR/$COMPOSERPHAR" ]; then - "$PROJDIR/$COMPOSERPHAR" "$@" - elif in_path composer; then - command composer "$@" - elif [ -x /usr/bin/composer ]; then - /usr/bin/composer "$@" - elif [ -x /usr/local/bin/composer ]; then - /usr/local/bin/composer "$@" - else - die "impossible de trouver composer" - fi - if [ -f composer.lock ]; then - cp composer.lock "$PROJDIR/.composer.lock.rundk" - fi -} - -bootstrap= -BootstrapOnly=1 -ComposerInstall= -ForcedBootstrap= -parse_opts=1 -args=() -for arg in "$@"; do - if [ -z "$parse_opts" ]; then - args+=("$arg") - elif [ "$arg" == --bootstrap -o "$arg" == --bs ]; then - bootstrap=1 - elif [ "$arg" == --exec ]; then - BootstrapOnly= - elif [ "$arg" == --composer-install -o "$arg" == --ci ]; then - ComposerInstall=1 - elif [[ "$arg" == -* ]]; then - args+=("$arg") - else - args+=("$arg") - parse_opts= - fi -done -set -- "${args[@]}" - -if [ -z "$bootstrap" ]; then - # si vendor/ n'existe pas, alors on doit faire bootstrap - if [ ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then - ForcedBootstrap=1 - elif [ ! -f "$PROJDIR/.composer.lock.rundk" ]; then - ForcedBootstrap=1 - elif ! diff -q "$PROJDIR/$COMPOSERDIR/composer.lock" "$PROJDIR/.composer.lock.rundk" >&/dev/null; then - ForcedBootstrap=1 - elif [ -n "$bootstrap" -a -n "$BootstrapOnly" ]; then - # bootstrap inutile - exit 0 - fi - - if [ -n "$ForcedBootstrap" ]; then - [ -z "$_RUNDK_IN_DOCKER" ] && eecho "== rundk is needed: bootstrapping" - bootstrap=1 - BootstrapOnly= - fi -fi - -if [ -z "$_RUNDK_IN_DOCKER" ]; then - ############################################################################ - # Lancement depuis l'extérieur du container - - # recenser les valeur de proxy - declare -A PROXY_VARS - for var in {HTTPS,ALL,NO}_PROXY {http,https,all,no}_proxy; do - is_defined "$var" && PROXY_VARS[${var,,}]="${!var}" - done - - ## Charger ~/.dkbuild.env - - APT_PROXY= - APT_MIRROR= - SEC_MIRROR= - TIMEZONE= - PRIVAREG= - REGISTRY= - PROFILE= - HOST_MAPPINGS=() - function default_profile() { - PROFILE="$1" - } - function profile() { - local profile - for profile in "$@"; do - [ "$profile" == "$PROFILE" ] && return 0 - done - return 1 - } - function setenv() { - eval "export $1" - } - function default() { - local command="$1"; shift - local nv n v - case "$command" in - docker) - for nv in "$@"; do - [[ "$nv" == *=* ]] || continue - n="${nv%%=*}" - v="${nv#*=}" - case "$n" in - host-mappings) - read -a ns <<<"$v" - for v in "${ns[@]}"; do - HOST_MAPPINGS+=("$v") - done - ;; - esac - done - ;; - esac - } - [ -f ~/.dkbuild.env ] && source ~/.dkbuild.env - - [ -n "$APT_PROXY" ] || APT_PROXY= - [ -n "$APT_MIRROR" ] || APT_MIRROR=default - [ -n "$SEC_MIRROR" ] || SEC_MIRROR=default - [ -n "$TIMEZONE" ] || TIMEZONE=Europe/Paris - [ -n "$PRIVAREG" ] || PRIVAREG= - [ -n "$REGISTRY" ] || REGISTRY=pubdocker.univ-reunion.fr - - ## Construire l'image - - if [ -n "$RUNDK_NO_USE_RSLAVE" ]; then - UseRslave= - elif [ -n "$RUNDK_USE_RSLAVE" ]; then - UseRslave=1 - elif [ -e /proc/sys/fs/binfmt_misc/WSLInterop ]; then - # pas de mount propagation sous WSL - UseRslave= - else - UseRslave=1 - fi - - IMAGE= - if [ -z "$bootstrap" ]; then - if [ -n "$RUNDK_FORCE_BUILDENVS" ]; then - eval "Configs=($RUNDK_FORCE_BUILDENVS)" - for config in "${Configs[@]}"; do - source "$config" || exit 1 - done - after_source_buildenv - elif [ -n "$BUILDENV" -a -f "$PROJDIR/$BUILDENV" ]; then - source "$PROJDIR/$BUILDENV" || exit 1 - after_source_buildenv - elif [ -n "$BUILDENV0" -a -f "$PROJDIR/$BUILDENV0" ]; then - source "$PROJDIR/$BUILDENV0" || exit 1 - after_source_buildenv - fi - if [ -z "$IMAGE" ]; then - [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME:$DIST" || IMAGE="$REGISTRY/$IMAGENAME:$DIST" - fi - if [ -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then - bootstrap=1 - fi - fi - - if [ -n "$bootstrap" ]; then - BUILD_ARGS=( - DIST NDIST - REGISTRY - APT_PROXY - APT_MIRROR - SEC_MIRROR - TIMEZONE - ) - - SOPTS=+d:9876543210:c:UjDx:z:r:pw:v - LOPTS=help,dist:,d19,d18,d17,d16,d15,d14,d13,d12,d11,d10,config:,ue,unless-exists,pull,nc,no-cache,po,plain-output,apt-proxy:,timezone:,privareg:,push,chdir:,verbose,no-use-rslave - args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args" - - Dist= - if [ -n "$RUNDK_FORCE_BUILDENVS" ]; then - eval "Configs=($RUNDK_FORCE_BUILDENVS)" - elif [ -n "$BUILDENV" -a -f "$PROJDIR/$BUILDENV" ]; then - Configs=("$PROJDIR/$BUILDENV") - elif [ -n "$BUILDENV0" -a -f "$PROJDIR/$BUILDENV0" ]; then - Configs=("$PROJDIR/$BUILDENV0") - else - Configs=() - fi - UnlessExists= - Pull= - NoCache= - PlainOutput= - Chdir= - Verbose= - while [ $# -gt 0 ]; do - case "$1" in - --) shift; break;; - --help) - eecho "\ -rundk: construire l'image docker - -USAGE - $MYNAME --bootstrap [options...] [--exec command [args...]] - -OPTIONS - -c, --config build.env - --unless-exists - -U, --pull - -j, --no-cache - -D, --plain-output - -x, --apt-proxy APT_PROXY - -z, --timezone TIMEZONE - -r, --privareg PRIVAREG - -p, --push - paramètres pour la consruction de l'image - -w, --chdir CHDIR - aller dans le répertoire spécifié avant de lancer la commande - -v, --verbose - afficher plus d'informations" - exit 0 - ;; - -d|--dist) shift; Dist="$1";; - -[0-9]) Dist="d1${1#-}";; - --d*) Dist="${1#--}";; - -c|--config) shift; Configs+="$1";; - --ue|--unless-exists) UnlessExists=1;; - -U|--pull) Pull=1;; - -j|--nc|--no-cache) NoCache=1;; - -D|--po|--plain-output) PlainOutput=1;; - -x|--apt-proxy) shift; APT_PROXY="$1";; - -z|--timezone) shift; TIMEZONE="$1";; - -r|--privareg) shift; PRIVAREG="$1";; - -p|--push) Push=1;; - -w|--chdir) shift; Chdir="$1";; - -v|--verbose) Verbose=1;; - --no-use-rslave) UseRslave=;; - *) die "$1: option non configurée";; - esac - shift - done - - for config in "${Configs[@]}"; do - if [ "$config" == none ]; then - Configs=() - break - fi - done - if [ ${#Configs[*]} -gt 0 ]; then - for config in "${Configs[@]}"; do - source "$config" || exit 1 - done - after_source_buildenv - fi - [ -n "$Dist" ] && DIST="$Dist" - if [ -z "$IMAGE" ]; then - [ -n "$PRIVAREG" ] && IMAGE="$PRIVAREG/$IMAGENAME:$DIST" || IMAGE="$REGISTRY/$IMAGENAME:$DIST" - fi - if [ -z "$UnlessExists" -o -z "$(docker image ls --no-trunc --format '{{.Repository}}:{{.Tag}}' "$IMAGE" 2>/dev/null)" ]; then - eecho "== Building $IMAGE" - dockerfiles=( - "$MYDIR/Dockerfile.rundk.local" - "$MYDIR/Dockerfile.rundk$BUILD_FLAVOUR" - "$MYDIR/Dockerfile.rundk" - ) - for dockerfile in "${dockerfiles[@]}"; do - [ -f "$dockerfile" ] && break - done - args=( - -f "$dockerfile" - ${Pull:+--pull} - ${NoCache:+--no-cache} - ${BuildPlain:+--progress plain} - -t "$IMAGE" - ) - for arg in "${BUILD_ARGS[@]}"; do - args+=(--build-arg "$arg=${!arg}") - done - for arg in "${!PROXY_VARS[@]}"; do - args+=(--build-arg "$arg=${PROXY_VARS[$arg]}") - done - for host in "${HOST_MAPPINGS[@]}"; do - args+=(--add-host "$host") - done - mkdir -p /tmp/rundk-build - docker build "${args[@]}" /tmp/rundk-build || exit 1 - - if [ -n "$Push" -a -n "$PRIVAREG" ]; then - eecho "== Pushing $IMAGE" - docker push "$IMAGE" || exit 1 - fi - fi - if [ -n "$ComposerInstall" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then - BootstrapOnly= - ForcedBootstrap=1 - fi - [ -n "$BootstrapOnly" ] && exit 0 - - else - SOPTS=+w:v - LOPTS=help,chdir:,verbose,no-use-rslave - args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args" - - Chdir= - Verbose= - while [ $# -gt 0 ]; do - case "$1" in - --) shift; break;; - --help) - eecho "\ -rundk: construire l'image docker - -USAGE - $MYNAME ci|cu|composer - $MYNAME --exec [options...] command [args...] - -COMMANDES COMPOSER - ci - cu - installer/mettre à jour les dépendances du projet avec composer - composer (args...] - lancer composer avec les arguments spécifiés. - -pour les commandes ci-dessus, l'option --chdir est ignorée: le répertoire -courant est forcé au répertoire du projet composer - -OPTIONS - -w, --chdir CHDIR - aller dans le répertoire spécifié avant de lancer la commande - -v, --verbose - afficher plus d'informations" - exit 0 - ;; - -w|--chdir) shift; Chdir="$1";; - -v|--verbose) Verbose=1;; - --no-use-rslave) UseRslave=;; - *) die "$1: option non configurée";; - esac - shift - done - - if [ -n "$ComposerInstall" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then - ForcedBootstrap=1 - fi - fi - - ## Lancer la commande - - uid="$(id -u)" - gid="$(id -g)" - args=( - run -it --rm - --name "rundk-$(basename -- "$1")-$$" - -e _RUNDK_IN_DOCKER=1 - -e _RUNDK_UID="$uid" - -e _RUNDK_GID="$gid" - ) - for arg in "${!PROXY_VARS[@]}"; do - args+=(--e "$arg=${PROXY_VARS[$arg]}") - done - for host in "${HOST_MAPPINGS[@]}"; do - args+=(--add-host "$host") - done - - # monter le répertoire qui contient $PROJDIR - mount_composer= - if [ "${PROJDIR#$HOME/}" != "$PROJDIR" -o "$PROJDIR" == "$HOME" ]; then - # bind mount $HOME - args+=(-v "$HOME:$HOME${UseRslave:+:rslave}") - else - # bind mount uniquement le répertoire du projet - args+=(-v "$PROJDIR:$PROJDIR${UseRslave:+:rslave}") - mount_composer=1 - fi - if [ -n "$mount_composer" -a -d "$HOME/.composer" ]; then - # monter la configuration de composer - args+=(-v "$HOME/.composer:$HOME/.composer") - fi - args+=(-w "$(pwd)") - - # lancer avec l'utilisateur courant - if [ $uid -ne 0 ]; then - # si c'est un utilisateur lambda, il faut monter les informations - # nécessaires. composer est déjà monté via $HOME - user="$(id -un)" - userent="$(getent passwd "$user")" - group="$(id -gn)" - groupent="$(getent group "$group")" - args+=( - -e _RUNDK_USER="$user" - -e _RUNDK_USERENT="$userent" - -e _RUNDK_GROUPENT="$groupent" - ) - fi - - args+=( - "$IMAGE" - exec "$0" ${Chdir:+-w "$Chdir"} - ) - [ -n "$ForcedBootstrap" ] && set -- ci - [ -n "$Verbose" ] && eecho "\$ docker ${args[*]} $*" - exec docker "${args[@]}" "$@" - -else - ############################################################################ - # Lancement depuis l'intérieur du container - - # Ajouter les informations utilisateur le cas échéant - if [ -n "$_RUNDK_USERENT" ]; then - grep -q "^$_RUNDK_USER:" /etc/passwd || echo "$_RUNDK_USERENT" >>/etc/passwd - fi - if [ -n "$_RUNDK_GROUPENT" ]; then - grep -q "^$_RUNDK_GROUP:" /etc/group || echo "$_RUNDK_GROUPENT" >>/etc/group - fi - if [ -n "$_RUNDK_USER" ]; then - user="$_RUNDK_USER" - export _RUNDK_USER= - export _RUNDK_USERENT= - export _RUNDK_GROUPENT= - if in_path su-exec; then - exec su-exec "$user" "$0" "$@" - else - exec runuser -u "$user" -- "$0" "$@" - fi - fi - - SOPTS=+w: - LOPTS=chdir: - args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args" - - chdir= - action= - while [ $# -gt 0 ]; do - case "$1" in - --) shift; break;; - -w|--chdir) shift; chdir="$1";; - *) die "$1: option non configurée";; - esac - shift - done - - if [ "$1" == ci ]; then - eecho "== installing composer dependencies" - composer i - elif [ "$1" == cu ]; then - eecho "== upgrading composer dependencies" - composer u - elif [ "$1" == composer ]; then - "$@" - else - if [ -n "$chdir" ]; then - cd "$chdir" || exit 1 - fi - exec "${@:-bash}" - fi -fi diff --git a/support/rundk.userconf b/support/rundk.userconf deleted file mode 100644 index 0185be9..0000000 --- a/support/rundk.userconf +++ /dev/null @@ -1,29 +0,0 @@ -# répertoire du projet. ce chemin doit être absolu. s'il est relatif, il est -# exprimé par rapport au répertoire de ce script -PROJDIR= - -# composer: répertoire du projet composer (celui qui contient le fichier -# composer.json), chemin de composer.phar et répertoire vendor. ces chemions -# doivent être relatifs à $PROJDIR -COMPOSERDIR= -COMPOSERPHAR= -VENDORDIR= - -# fichier de configuration pour le build -BUILDENV0= -BUILDENV= - -# Listes des images que le script build construit automatiquement -BUILD_IMAGES=(php-apache mariadb10) -BUILD_FLAVOUR= - -## En ce qui concerne DIST et IMAGENAME, les valeurs dans BUILDENV prennent le -## dessus. si BUILDENV *n'est pas* utilisé, ces valeur peuvent être spécifiées -## ici - -# version de debian à utiliser pour l'image -# d12=php8.2, d11=php7.4, d10=php7.3 -DIST= - -# Nom de base de l'image (sans le registry), e.g prefix/rundk -IMAGENAME= diff --git a/support/template.sh b/support/template.sh deleted file mode 100755 index c36b7b3..0000000 --- a/support/template.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -# Modèle de script utilisant rundk pour lancer un traitement dans un container -# RUNDK est le chemin relatif vers rundk à partir du chemin du script -RUNDK=sbin/rundk - -MYDIR="$(dirname -- "$0")"; MYNAME="$(basename -- "$0")" -if [ -z "$_RUNDK_IN_DOCKER" ]; then - "$MYDIR/$RUNDK" --bs --ue --ci || exit 1 - exec "$MYDIR/$RUNDK" "$0" "$@" -fi -source "$MYDIR/$RUNDK" || exit 1 -source "$PROJDIR/$VENDORDIR/nulib/php/load.sh" || exit 1 - -args=( - "description" - #"usage" -) -parse_args "$@"; set -- "${args[@]}" - -echo "je tourne dans un container..." -sleep 1000 diff --git a/support/update-rundk.sh b/support/update-rundk.sh deleted file mode 100755 index 544e4cf..0000000 --- a/support/update-rundk.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -source "$(dirname "$0")/../load.sh" || exit 1 - -projdir= -args=( - "Mettre à jour le script rundk" - "[path/to/rundk]" - -d:,--projdir:PROJDIR . "Copier les fichiers pour un projet de l'université de la Réunion" -) -parse_args "$@"; set -- "${args[@]}" - -if [ -n "$projdir" ]; then - setx projdir=abspath "$projdir" - set -- "$projdir/sbin/rundk" -fi - -rundk="${1:-.}" -[ -d "$rundk" ] && rundk="$rundk/rundk" - -setx rundir=dirname -- "$rundk" -[ -d "$rundir" ] || mkdir -p "$rundir" - -if [ -f "$rundk" ]; then - ac_set_tmpfile userconf - <"$rundk" awk ' -# extraire la configuration depuis le fichier -BEGIN { p = 0 } -/SOF:rundk.userconf:/ { p = 1; next } -/EOF:rundk.userconf:/ { p = 0; next } -p == 1 { print } -' | awk ' -# mettre en forme le fichier: pas de lignes vides avant et après -BEGIN { p = 0; have_pending = 0; pending = "" } -$0 != "" { p = 1 } -p == 1 { - if ($0 != "") { - if (have_pending) print pending - print - have_pending = 0 - pending = "" - } else { - if (!have_pending) have_pending = 1 - else pending = pending "\n" - } -} -' >"$userconf" - initial_config= -elif [ -n "$projdir" ]; then - # forcer BUILDENV0=..env.dist et BUILDENV=.env pour les projets de - # l'université de la Réunion - initial_config=1 - ac_set_tmpfile userconf - sed <"$MYDIR/rundk.userconf" >"$userconf" ' -/^BUILDENV0=/s/=.*/=..env.dist/ -/^BUILDENV=/s/=.*/=.env/ -' -else - initial_config=1 - userconf="$MYDIR/rundk.userconf" -fi - -( - cat "$MYDIR/rundk.1preamble" - echo - cat "$userconf" - echo - cat "$MYDIR/rundk.2postamble" -) >"$rundk" -[ -x "$rundk" ] || chmod +x "$rundk" - -rsync -lpt "$MYDIR/Dockerfile.rundk" "$rundir/" - -if [ -n "$projdir" ]; then - if testdiff "$rundir/build" "$MYDIR/build"; then - cp "$MYDIR/build" "$rundir/build" - chmod +x "$rundir/build" - fi - if [ ! -f "$projdir/..env.dist" ]; then - sed <"$MYDIR/dot-build.env.dist" >"$projdir/..env.dist" ' -/^IMAGENAME=/s/=.*\//='"$(basename -- "$projdir")"'\// -' - initial_config=1 - fi -fi - -[ -n "$initial_config" ]