ake shellcheck happy

This commit is contained in:
Paolo Asperti 2023-11-09 16:17:01 +01:00
parent 93fd089c2f
commit e2006e0304
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -12,21 +12,21 @@ NEXTCLOUD_DIR_CHOWN=${NEXTCLOUD_DIR_CHOWN:-1}
NEXTCLOUD_SLEEP=${NEXTCLOUD_SLEEP:-30} NEXTCLOUD_SLEEP=${NEXTCLOUD_SLEEP:-30}
# check if group already exists # check if group already exists
GRP_NAME=$(getent group ${USER_GID} ) GRP_NAME=$(getent group "${USER_GID}" )
if [ "${GRP_NAME}" ] ; then if [ "${GRP_NAME}" ] ; then
USER_GROUP=$( echo ${GRP_NAME} | sed 's/\:.*//' ) USER_GROUP=$( echo "${GRP_NAME}" | sed 's/\:.*//' )
else else
# if not, we create the group # if not, we create the group
addgroup -g ${USER_GID} ${USER_GROUP} addgroup -g "${USER_GID}" "${USER_GROUP}"
fi fi
# check if user already exists # check if user already exists
USR_NAME=$(getent passwd ${USER_UID} ) USR_NAME=$(getent passwd "${USER_UID}" )
if [ "${USR_NAME}" ] ; then if [ "${USR_NAME}" ] ; then
USER_NAME=$( echo ${USR_NAME} | sed 's/\:.*//' ) USER_NAME=$( echo "${USR_NAME}" | sed 's/\:.*//' )
else else
# if not, we create the user # if not, we create the user
adduser -s /bin/false -D -H -G ${USER_GROUP} -u ${USER_UID} ${USER_NAME} adduser -s /bin/false -D -H -G "${USER_GROUP}" -u "${USER_UID}" "${USER_NAME}"
fi fi
# create dir if not exists (it should exist if you mapped it outside the container) # create dir if not exists (it should exist if you mapped it outside the container)
@ -36,7 +36,7 @@ fi
# replace data directory permissions # replace data directory permissions
if [ "${NEXTCLOUD_DIR_CHOWN}" = "1" ] ; then if [ "${NEXTCLOUD_DIR_CHOWN}" = "1" ] ; then
chown -R ${USER_UID}:${USER_GID} "${NEXTCLOUD_DIR}" chown -R "${USER_UID}":"${USER_GID}" "${NEXTCLOUD_DIR}"
fi fi
PARAMS= PARAMS=
@ -70,6 +70,6 @@ PARAMS="${PARAMS} --non-interactive -u ${NEXTCLOUD_USERNAME} -p ${NEXTCLOUD_PASS
# main loop # main loop
while true; do while true; do
/bin/su -s /bin/sh ${USER_NAME} -c "/usr/bin/nextcloudcmd ${PARAMS}" /bin/su -s /bin/sh "${USER_NAME}" -c "/usr/bin/nextcloudcmd ${PARAMS}"
sleep ${NEXTCLOUD_SLEEP} sleep "${NEXTCLOUD_SLEEP}"
done done