2022-08-22 10:08:49 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-08-22 21:57:54 +03:00
|
|
|
# 参考:https://programwiz.org/2022/03/22/how-to-write-shell-script-for-option-parsing/
|
2022-08-22 10:08:49 +03:00
|
|
|
|
2022-08-22 21:57:54 +03:00
|
|
|
set -eu
|
|
|
|
# 実行ユーザ作成
|
|
|
|
USER_ID=${LOCAL_UID:-9001}
|
|
|
|
GROUP_ID=${LOCAL_GID:-9001}
|
2022-08-22 10:08:49 +03:00
|
|
|
|
2022-10-02 18:16:46 +03:00
|
|
|
echo "exec with [UID : $USER_ID, GID: $GROUP_ID]"
|
2022-08-22 21:57:54 +03:00
|
|
|
useradd -u $USER_ID -o -m user
|
|
|
|
groupmod -g $GROUP_ID user
|
2022-08-22 10:08:49 +03:00
|
|
|
|
2022-08-22 21:57:54 +03:00
|
|
|
#su user
|
2022-10-02 18:16:46 +03:00
|
|
|
#echo "parameter: $@"
|
2022-08-23 03:45:05 +03:00
|
|
|
exec /usr/sbin/gosu user /bin/bash exec.sh "$@"
|
|
|
|
#/bin/bash
|
2022-08-23 00:37:18 +03:00
|
|
|
|