Compare commits

..

1 Commits

Author SHA1 Message Date
eb8684275e maj deps php8.2 2025-02-13 11:57:43 +04:00
2 changed files with 19 additions and 73 deletions

View File

@ -2,11 +2,10 @@
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
MYDIR="$(cd "$(dirname -- "$0")"; pwd)"
RUNPHP="$MYDIR/runphp"
"$RUNPHP" --bs --ue --ci || exit 1
"$RUNPHP" --bs --ue || exit 1
RUNPHP_STANDALONE=
PROJDIR=; COMPOSERDIR=; COMPOSERPHAR=; VENDORDIR=; BUILDENV0=; BUILDENV=
BUILD_IMAGES=(php-apache mariadb10); export BUILD_FLAVOUR=; DIST=; IMAGENAME=
DISTFILES=()
source "$RUNPHP" || exit 1
source "$PROJDIR/$VENDORDIR/nulib/php/load.sh" || exit 1
require: template
@ -56,65 +55,26 @@ function dcrunning() {
function build_check_env() {
eval "$(template_locals)"
local updatedenv distfile distname
local -a updatedfiles distfiles
if template_copy_missing "$PROJDIR/$BUILDENV0"; then
updated=1
updatedenv=1
fi
for distfile in "${DISTFILES[@]}"; do
if [ -f "$PROJDIR/$distfile" ]; then
if template_copy_missing "$PROJDIR/$distfile"; then
updated=1
setx distname=basename -- "$distfile"
distname="${distname#.}"; distname="${distname%.dist}"
setx distfile=dirname -- "$distfile"
distfile="$distfile/$distname"
updatedfiles+=("$distfile")
fi
elif [ -d "$PROJDIR/$distfile" ]; then
local distdir="$PROJDIR/$distfile"
setx -a distfiles=find "$distdir" -type f -name ".*.dist"
for distfile in "${distfiles[@]}"; do
if template_copy_missing "$distfile"; then
updated=1
setx distname=basename -- "$distfile"
distname="${distname#.}"; distname="${distname%.dist}"
setx distfile=dirname -- "$distfile"
distfile="$distfile/$distname"
updatedfiles+=("${distfile#$PROJDIR/}")
fi
done
else
ewarn "$distfile: fichier introuvable"
fi
done
template_copy_missing "$PROJDIR/$BUILDENV0" && updated=1
template_process_userfiles
if [ -n "$updated" ]; then
enote "IMPORTANT: vous devez paramétrer certains fichiers avant de pouvoir construire les images"
if [ -n "$updatedenv" ]; then
if [ -a $(id -u) -ne 0 ]; then
setx userent=getent passwd "$(id -un)"
setx userent=qval "$userent"
setx groupent=getent group "$(id -gn)"
setx groupent=qval "$groupent"
sed -i "
if [ $(id -u) -ne 0 ]; then
setx userent=getent passwd "$(id -un)"
setx userent=qval "$userent"
setx groupent=getent group "$(id -gn)"
setx groupent=qval "$groupent"
sed -i "
/^#DEVUSER_.*=/s/^#//
/^DEVUSER_USERENT=/s/=.*/=${userent//\//\\\/}/
/^DEVUSER_GROUPENT=/s/=.*/=${groupent//\//\\\/}/
" "$PROJDIR/$BUILDENV"
fi
enote "\
Veuillez vérifier le fichier $BUILDENV
${EDITOR:-nano} $BUILDENV"
fi
[ ${#updatedfiles[*]} -gt 0 ] && enote "\
Le cas échéant, veuillez vérifier ce(s) fichier(s)
${EDITOR:-nano} $(qvals "${updatedfiles[@]}")"
enote "ENSUITE, vous pourrez relancer la commande"
else
enote "IMPORTANT: Veuillez faire le paramétrage en éditant le fichier $BUILDENV
${EDITOR:-nano} $BUILDENV
ENSUITE, vous pourrez relancer la commande"
return 1
fi
}

View File

@ -47,14 +47,6 @@ DIST=
# Nom de base de l'image (sans le registry), e.g prefix/
IMAGENAME=
## Fichiers .dist
## Lors du build, les fichiers de la forme .name.dist sont copiés vers un
## fichier name sauf s'il existe déjà
# Liste de fichiers (ou de répertoirs à considérer). Pour chaque répertoire, les
# fichiers .*.dist dans l'arborescence du répertoire sont recherchés
DISTFILES=()
#EOF:runphp.userconf:ne pas modifier cette ligne
################################################################################
@ -227,6 +219,7 @@ function host_check_projdir() {
install=1
fi
if [ -n "$install" ]; then
eecho "== bootstrapping runphp"
[ -n "$Composer" ] || Composer=ci
fi
}
@ -321,7 +314,6 @@ function host_init_env() {
Chdir=
Verbose="$RUNPHP_VERBOSE"
Exec=
}
function host_docker_build() {
@ -367,7 +359,7 @@ OPTIONS
paramètres pour la consruction de l'image
--ci
--cu
lancer composer install (resp. update) s'il y a eu bootstrap
lancer composer install (resp. update) après bootstrap
--no-use-rslave
paramètre montage des volumes"
exit 0
@ -412,7 +404,7 @@ OPTIONS
host_check_image && exists=1 || exists=
if [ -z "$UnlessExists" -o -z "$exists" ]; then
eecho "== bootstrapping $Image"
eecho "== Building $Image"
args=(
-f "$Dockerfile"
${Pull:+--pull}
@ -436,9 +428,6 @@ OPTIONS
eecho "== Pushing $Image"
docker push "$Image" || exit 1
fi
else
# s'il n'y a pas eu bootstrap, alors ne pas lancer la commande composer
Composer=
fi
}
@ -456,14 +445,9 @@ function host_docker_run() {
runphp: lancer une commande dans un environnement PHP déterminé
USAGE
$MYNAME --bs ...
$MYNAME ci|cu|composer
$MYNAME [options] command [args...]
COMMANDES SPECIALES
--bs
faire un bootstrap de l'image runphp
COMMANDES COMPOSER
ci
cu
@ -545,7 +529,7 @@ OPTIONS
exec "$0" ${Chdir:+-w "$Chdir"}
)
[ -n "$Verbose" ] && eecho "\$ docker ${args[*]} $*"
${Exec:+exec} docker "${args[@]}" "$@"
docker "${args[@]}" "$@"
}
function container_exec() {
@ -621,10 +605,12 @@ if [ "$RUNPHP_MODE" != docker ]; then
fi
if [ ${#Cmd[*]} -gt 0 ]; then
Exec=1 host_docker_run "${Cmd[@]}"
host_docker_run "${Cmd[@]}" || exit $?
fi
else
# Lancement depuis l'intérieur du container
container_exec "$@"
fi
exit 0