File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -13,8 +13,42 @@ DARGS="$*"
1313# Save the current path
1414CWD=" $PWD "
1515
16+ function config_user()
17+ {
18+ # ================================================#
19+ # Config a User #
20+ # ------------- #
21+ # It is meant to run during container's init #
22+ # process. Such process is necessary to better #
23+ # exchange files/bus between host/container. #
24+ # Variables DUSER, DUID, DGID are read from the #
25+ # environment; if NOUSER is set, do nothing. #
26+ # ================================================#
27+
28+ DEFAULT_USER=" user"
29+ DEFAULT_UID=" 1000"
30+ DEFAULT_GID=" 100"
31+
32+ [[ ! -z " $NOUSER " ]] && \
33+ # nothing to be done here
34+ return 0
35+
36+ DUSER=" ${DUSER-$DEFAULT_USER } "
37+ DUID=" ${DUID-$DEFAULT_UID } "
38+ DGID=" ${DGID-$DEFAULT_GID } "
39+
40+ useradd -u " $DUID " \
41+ -g " $DGID " \
42+ -d " /home/$DUSER " -m \
43+ -s /bin/bash \
44+ " $DUSER "
45+
46+ echo $DUSER
47+ }
48+
49+
1650# Add a user here
17- USERNAME=$( ${CWD} / config_user.sh )
51+ USERNAME=$( config_user)
1852
1953# If no user created, define the current one (root)
2054[[ ` id $USERNAME ` ]] || USERNAME=" $USER "
3973
4074su -l $USERNAME -c " cd $WORKDIR && $INTERP $DARGS "
4175
76+ #! /bin/bash -e
77+
You can’t perform that action at this time.
0 commit comments