mirror of
https://github.com/misterunknown/ifm.git
synced 2025-01-16 20:28:26 +01:00
fix bash warnings
This commit is contained in:
parent
6ab7e569ef
commit
fd38618ca3
@ -3,30 +3,30 @@ set -e
|
|||||||
|
|
||||||
if [ ! -z $IFM_DOCKER_UID ]; then
|
if [ ! -z $IFM_DOCKER_UID ]; then
|
||||||
# check if UID/GID are numeric
|
# check if UID/GID are numeric
|
||||||
if ! echo "$IFM_DOCKER_UID$IFM_DOCKER_GID" | egrep "^[0-9]+$" >/dev/null 2>&1; then
|
if ! echo "$IFM_DOCKER_UID$IFM_DOCKER_GID" | grep -E "^[0-9]+$" >/dev/null 2>&1; then
|
||||||
echo "FATAL: IFM_DOCKER_UID or IFM_DOCKER_GID are not numeric (UID: $IFM_DOCKER_UID, GID: $IFM_DOCKER_GID)"
|
echo "FATAL: IFM_DOCKER_UID or IFM_DOCKER_GID are not numeric (UID: $IFM_DOCKER_UID, GID: $IFM_DOCKER_GID)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get GID if not set
|
# get GID if not set
|
||||||
if [ -z $IFM_DOCKER_GID ]; then
|
if [ -z "$IFM_DOCKER_GID" ]; then
|
||||||
export IFM_DOCKER_GID=$IFM_DOCKER_UID
|
export IFM_DOCKER_GID="$IFM_DOCKER_UID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# delete user if already exists
|
# delete user if already exists
|
||||||
if getent passwd $IFM_DOCKER_UID >/dev/null 2>&1; then
|
if getent passwd "$IFM_DOCKER_UID" >/dev/null 2>&1; then
|
||||||
deluser $(getent passwd $IFM_DOCKER_UID | sed "s/:.*//")
|
deluser $(getent passwd "$IFM_DOCKER_UID" | sed "s/:.*//")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if group already exists
|
# check if group already exists
|
||||||
if ! getent group $IFM_DOCKER_GID >/dev/null 2>&1; then
|
if ! getent group "$IFM_DOCKER_GID" >/dev/null 2>&1; then
|
||||||
addgroup -g $IFM_DOCKER_GID -S www-data
|
addgroup -g "$IFM_DOCKER_GID" -S www-data
|
||||||
REAL_GROUP=www-data
|
REAL_GROUP=www-data
|
||||||
else
|
else
|
||||||
REAL_GROUP=$(getent group $IFM_DOCKER_GID | sed "s/:.*//")
|
REAL_GROUP=$(getent group "$IFM_DOCKER_GID" | sed "s/:.*//")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
adduser -u $IFM_DOCKER_UID -SHDG $REAL_GROUP www-data
|
adduser -u "$IFM_DOCKER_UID" -SHDG "$REAL_GROUP" www-data
|
||||||
else
|
else
|
||||||
addgroup -g 33 -S www-data
|
addgroup -g 33 -S www-data
|
||||||
adduser -SHD -u 33 -G www-data www-data
|
adduser -SHD -u 33 -G www-data www-data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user