shellcheck

This commit is contained in:
2025-06-11 22:21:03 +02:00
parent c3d766e3e3
commit d7c94d435d
2 changed files with 23 additions and 13 deletions

View File

@@ -5,10 +5,12 @@ USER_GROUP=${USER_GROUP:-nextcloudgroup}
USER_UID=${USER_UID:-1000}
USER_GID=${USER_GID:-1000}
NEXTCLOUD_SLEEP=${NEXTCLOUD_SLEEP:-30}
NEXTCLOUD_DIR_CHOWN=${NEXTCLOUD_DIR_CHOWN:-1}
NEXTCLOUD_DIR=${NEXTCLOUD_DIR:-/data}
# check if group already exists
GRP_NAME=$(getent group "${USER_GID}" )
if [ "${GRP_NAME}" ] ; then
if [[ -n "${GRP_NAME}" ]] ; then
USER_GROUP="${GRP_NAME//:*/}"
else
# if not, we create the group
@@ -17,7 +19,7 @@ fi
# check if user already exists
USR_NAME=$(getent passwd "${USER_UID}" )
if [ "${USR_NAME}" ] ; then
if [[ -n "${USR_NAME}" ]] ; then
USER_NAME="${USR_NAME//:*/}"
else
# if not, we create the user
@@ -25,12 +27,12 @@ else
fi
# create dir if not exists (it should exist if you mapped it outside the container)
if [ ! -d "${NEXTCLOUD_DIR}" ] ; then
if [[ ! -d "${NEXTCLOUD_DIR}" ]] ; then
mkdir -p "${NEXTCLOUD_DIR}"
fi
# replace data directory permissions
if [ "${NEXTCLOUD_DIR_CHOWN}" = "1" ] ; then
if [[ "${NEXTCLOUD_DIR_CHOWN}" = "1" ]] ; then
chown -R "${USER_UID}":"${USER_GID}" "${NEXTCLOUD_DIR}"
fi