renommer rundk en devuser

This commit is contained in:
Jephté Clain 2024-09-19 23:33:29 +04:00
parent 2adaaf5d1e
commit 5000baa6a1
4 changed files with 17 additions and 26 deletions

View File

@ -59,16 +59,14 @@ function build_check_env() {
template_process_userfiles
if [ -n "$updated" ]; then
setx user=id -un
setx userent=getent passwd "$user"
setx userent=getent passwd "$(id -un)"
setx userent=qval "$userent"
setx groupent=getent group "$(id -gn)"
setx groupent=qval "$groupent"
sed -i "
s/^#_RUNDK_/_RUNDK_/
s/^_RUNDK_USER=.*/_RUNDK_USER=${user//\//\\\/}/
s/^_RUNDK_USERENT=.*/_RUNDK_USERENT=${userent//\//\\\/}/
s/^_RUNDK_GROUPENT=.*/_RUNDK_GROUPENT=${groupent//\//\\\/}/
/^#DEVUSER_.*=/s/^#//
/^DEVUSER_USERENT=/s/=.*/=${userent//\//\\\/}/
/^DEVUSER_GROUPENT=/s/=.*/=${groupent//\//\\\/}/
" "$PROJDIR/$BUILDENV"
enote "IMPORTANT: Veuillez faire le paramétrage en éditant le fichier $BUILDENV
@ -126,7 +124,7 @@ function build_images() {
for image in "$@"; do
case "$image" in
runphp)
[ ${#Configs[*]} -gt 0 ] && export RUNDK_FORCE_BUILDENVS="${Configs[*]}"
[ ${#Configs[*]} -gt 0 ] && export RUNPHP_FORCE_BUILDENVS="${Configs[*]}"
local -a args=(--bootstrap)
[ "$ForceBuild" != all ] && args+=(--unless-exists)
[ -n "$Pull" ] && args+=(--pull)

View File

@ -17,6 +17,5 @@ PRIVAREG=
REGISTRY=pubdocker.univ-reunion.fr
DIST=d12
IMAGENAME=runphp
#_RUNDK_USER=user
#_RUNDK_USERENT=user:x:1000:1000:User,,,:/home/user:/bin/bash
#_RUNDK_GROUPENT=user:x:1000:
#DEVUSER_USERENT=user:x:1000:1000:User,,,:/home/user:/bin/bash
#DEVUSER_GROUPENT=user:x:1000:

View File

@ -104,13 +104,13 @@ if [ -z "$bootstrap" ]; then
fi
if [ -n "$ForcedBootstrap" ]; then
[ -z "$_RUNDK_IN_DOCKER" ] && eecho "== runphp is needed: bootstrapping"
[ -z "$_RUNPHP_IN_DOCKER" ] && eecho "== runphp is needed: bootstrapping"
bootstrap=1
BootstrapOnly=
fi
fi
if [ -z "$_RUNDK_IN_DOCKER" ]; then
if [ -z "$_RUNPHP_IN_DOCKER" ]; then
############################################################################
# Lancement depuis l'extérieur du container
@ -398,7 +398,7 @@ OPTIONS
args=(
run -it --rm
--name "runphp-$(basename -- "$1")-$$"
-e _RUNDK_IN_DOCKER=1
-e _RUNPHP_IN_DOCKER=1
)
for arg in "${!PROXY_VARS[@]}"; do
args+=(--e "$arg=${PROXY_VARS[$arg]}")
@ -427,14 +427,9 @@ OPTIONS
if [ $(id -u) -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"
-e DEVUSER_USERENT="$(getent passwd "$(id -un)")"
-e DEVUSER_GROUPENT="$(getent group "$(id -gn)")"
)
fi
@ -450,11 +445,10 @@ else
############################################################################
# Lancement depuis l'intérieur du container
if [ -n "$_RUNDK_USER" ]; then
user="$_RUNDK_USER"
export _RUNDK_USER=
export _RUNDK_USERENT=
export _RUNDK_GROUPENT=
if [ -n "$DEVUSER_USERENT" ]; then
user="${DEVUSER_USERENT%%:*}"
export DEVUSER_USERENT=
export DEVUSER_GROUPENT=
if in_path su-exec; then
exec su-exec "$user" "$0" "$@"
else

View File

@ -5,7 +5,7 @@
RUNPHP=sbin/runphp
MYDIR="$(dirname -- "$0")"; MYNAME="$(basename -- "$0")"
if [ -z "$_RUNDK_IN_DOCKER" ]; then
if [ -z "$_RUNPHP_IN_DOCKER" ]; then
"$MYDIR/$RUNPHP" --bs --ue --ci || exit 1
exec "$MYDIR/$RUNPHP" "$0" "$@"
fi