mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 09:26:44 -05:00
22 lines
412 B
Bash
22 lines
412 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
set -u
|
|
|
|
: "${UID:=0}"
|
|
: "${GID:=${UID}}"
|
|
|
|
if [ "$#" = 0 ]
|
|
then set -- "$(command -v bash 2>/dev/null || command -v sh)" -l
|
|
fi
|
|
|
|
if [ "$UID" != 0 ]
|
|
then
|
|
usermod -u "$UID" "$DOCKER_USER" 2>/dev/null && {
|
|
groupmod -g "$GID" "$DOCKER_USER" 2>/dev/null ||
|
|
usermod -a -G "$GID" "$DOCKER_USER"
|
|
}
|
|
set -- gosu "${UID}:${GID}" "${@}"
|
|
fi
|
|
|
|
exec "$@" |