support _rundk
This commit is contained in:
parent
1bc0534780
commit
2adaaf5d1e
12
runphp/build
12
runphp/build
|
@ -59,6 +59,18 @@ function build_check_env() {
|
||||||
template_process_userfiles
|
template_process_userfiles
|
||||||
|
|
||||||
if [ -n "$updated" ]; then
|
if [ -n "$updated" ]; then
|
||||||
|
setx user=id -un
|
||||||
|
setx userent=getent passwd "$user"
|
||||||
|
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//\//\\\/}/
|
||||||
|
" "$PROJDIR/$BUILDENV"
|
||||||
|
|
||||||
enote "IMPORTANT: Veuillez faire le paramétrage en éditant le fichier $BUILDENV
|
enote "IMPORTANT: Veuillez faire le paramétrage en éditant le fichier $BUILDENV
|
||||||
${EDITOR:-nano} $BUILDENV
|
${EDITOR:-nano} $BUILDENV
|
||||||
ENSUITE, vous pourrez relancer la commande"
|
ENSUITE, vous pourrez relancer la commande"
|
||||||
|
|
|
@ -17,3 +17,6 @@ PRIVAREG=
|
||||||
REGISTRY=pubdocker.univ-reunion.fr
|
REGISTRY=pubdocker.univ-reunion.fr
|
||||||
DIST=d12
|
DIST=d12
|
||||||
IMAGENAME=runphp
|
IMAGENAME=runphp
|
||||||
|
#_RUNDK_USER=user
|
||||||
|
#_RUNDK_USERENT=user:x:1000:1000:User,,,:/home/user:/bin/bash
|
||||||
|
#_RUNDK_GROUPENT=user:x:1000:
|
||||||
|
|
|
@ -175,9 +175,9 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then
|
||||||
|
|
||||||
## Construire l'image
|
## Construire l'image
|
||||||
|
|
||||||
if [ -n "$RUNDK_NO_USE_RSLAVE" ]; then
|
if [ -n "$RUNPHP_NO_USE_RSLAVE" ]; then
|
||||||
UseRslave=
|
UseRslave=
|
||||||
elif [ -n "$RUNDK_USE_RSLAVE" ]; then
|
elif [ -n "$RUNPHP_USE_RSLAVE" ]; then
|
||||||
UseRslave=1
|
UseRslave=1
|
||||||
elif [ -e /proc/sys/fs/binfmt_misc/WSLInterop ]; then
|
elif [ -e /proc/sys/fs/binfmt_misc/WSLInterop ]; then
|
||||||
# pas de mount propagation sous WSL
|
# pas de mount propagation sous WSL
|
||||||
|
@ -188,8 +188,8 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then
|
||||||
|
|
||||||
IMAGE=
|
IMAGE=
|
||||||
if [ -z "$bootstrap" ]; then
|
if [ -z "$bootstrap" ]; then
|
||||||
if [ -n "$RUNDK_FORCE_BUILDENVS" ]; then
|
if [ -n "$RUNPHP_FORCE_BUILDENVS" ]; then
|
||||||
eval "Configs=($RUNDK_FORCE_BUILDENVS)"
|
eval "Configs=($RUNPHP_FORCE_BUILDENVS)"
|
||||||
for config in "${Configs[@]}"; do
|
for config in "${Configs[@]}"; do
|
||||||
source "$config" || exit 1
|
source "$config" || exit 1
|
||||||
done
|
done
|
||||||
|
@ -225,8 +225,8 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then
|
||||||
args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args"
|
args="$(getopt -n "$MYNAME" -o "$SOPTS" -l "$LOPTS" -- "$@")" || exit 1; eval "set -- $args"
|
||||||
|
|
||||||
Dist=
|
Dist=
|
||||||
if [ -n "$RUNDK_FORCE_BUILDENVS" ]; then
|
if [ -n "$RUNPHP_FORCE_BUILDENVS" ]; then
|
||||||
eval "Configs=($RUNDK_FORCE_BUILDENVS)"
|
eval "Configs=($RUNPHP_FORCE_BUILDENVS)"
|
||||||
elif [ -n "$BUILDENV" -a -f "$PROJDIR/$BUILDENV" ]; then
|
elif [ -n "$BUILDENV" -a -f "$PROJDIR/$BUILDENV" ]; then
|
||||||
Configs=("$PROJDIR/$BUILDENV")
|
Configs=("$PROJDIR/$BUILDENV")
|
||||||
elif [ -n "$BUILDENV0" -a -f "$PROJDIR/$BUILDENV0" ]; then
|
elif [ -n "$BUILDENV0" -a -f "$PROJDIR/$BUILDENV0" ]; then
|
||||||
|
@ -356,7 +356,7 @@ OPTIONS
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
--help)
|
--help)
|
||||||
eecho "\
|
eecho "\
|
||||||
runphp: construire l'image docker
|
runphp: lancer une commande dans docker
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
$MYNAME ci|cu|composer
|
$MYNAME ci|cu|composer
|
||||||
|
@ -388,20 +388,17 @@ OPTIONS
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$ComposerInstall" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then
|
if [ -n "$ComposerInstall" -a ! -f "$PROJDIR/$VENDORDIR/nulib/php/load.sh" ]; then
|
||||||
|
# Forcer l'installation des dépendances si nécessaire
|
||||||
ForcedBootstrap=1
|
ForcedBootstrap=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Lancer la commande
|
## Lancer la commande
|
||||||
|
|
||||||
uid="$(id -u)"
|
|
||||||
gid="$(id -g)"
|
|
||||||
args=(
|
args=(
|
||||||
run -it --rm
|
run -it --rm
|
||||||
--name "runphp-$(basename -- "$1")-$$"
|
--name "runphp-$(basename -- "$1")-$$"
|
||||||
-e _RUNDK_IN_DOCKER=1
|
-e _RUNDK_IN_DOCKER=1
|
||||||
-e _RUNDK_UID="$uid"
|
|
||||||
-e _RUNDK_GID="$gid"
|
|
||||||
)
|
)
|
||||||
for arg in "${!PROXY_VARS[@]}"; do
|
for arg in "${!PROXY_VARS[@]}"; do
|
||||||
args+=(--e "$arg=${PROXY_VARS[$arg]}")
|
args+=(--e "$arg=${PROXY_VARS[$arg]}")
|
||||||
|
@ -427,7 +424,7 @@ OPTIONS
|
||||||
args+=(-w "$(pwd)")
|
args+=(-w "$(pwd)")
|
||||||
|
|
||||||
# lancer avec l'utilisateur courant
|
# lancer avec l'utilisateur courant
|
||||||
if [ $uid -ne 0 ]; then
|
if [ $(id -u) -ne 0 ]; then
|
||||||
# si c'est un utilisateur lambda, il faut monter les informations
|
# si c'est un utilisateur lambda, il faut monter les informations
|
||||||
# nécessaires. composer est déjà monté via $HOME
|
# nécessaires. composer est déjà monté via $HOME
|
||||||
user="$(id -un)"
|
user="$(id -un)"
|
||||||
|
@ -453,13 +450,6 @@ else
|
||||||
############################################################################
|
############################################################################
|
||||||
# Lancement depuis l'intérieur du container
|
# 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
|
if [ -n "$_RUNDK_USER" ]; then
|
||||||
user="$_RUNDK_USER"
|
user="$_RUNDK_USER"
|
||||||
export _RUNDK_USER=
|
export _RUNDK_USER=
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
RUNPHP=sbin/runphp
|
RUNPHP=sbin/runphp
|
||||||
|
|
||||||
MYDIR="$(dirname -- "$0")"; MYNAME="$(basename -- "$0")"
|
MYDIR="$(dirname -- "$0")"; MYNAME="$(basename -- "$0")"
|
||||||
if [ -z "$_RUNPHP_IN_DOCKER" ]; then
|
if [ -z "$_RUNDK_IN_DOCKER" ]; then
|
||||||
"$MYDIR/$RUNPHP" --bs --ue --ci || exit 1
|
"$MYDIR/$RUNPHP" --bs --ue --ci || exit 1
|
||||||
exec "$MYDIR/$RUNPHP" "$0" "$@"
|
exec "$MYDIR/$RUNPHP" "$0" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue