fix param generation
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
Paolo Asperti 2023-11-09 16:27:05 +01:00
parent e2006e0304
commit b6efb7a160
Signed by: paspo
GPG Key ID: 06D46905D19D5182
2 changed files with 24 additions and 13 deletions

View File

@ -2,7 +2,7 @@ FROM alpine:3.15
RUN \
apk upgrade --update --no-cache && \
apk add --update --no-cache nextcloud-client
apk add --update --no-cache nextcloud-client bash
ENV USER_NAME=nextcloudclient
ENV USER_UID=1000
@ -23,4 +23,4 @@ ENV NEXTCLOUD_SLEEP=30
COPY start.sh /start.sh
ENTRYPOINT ["/bin/sh", "/start.sh"]
ENTRYPOINT ["/bin/bash", "/start.sh"]

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
USER_NAME=${USER_NAME:-nextcloudclient}
USER_GROUP=${USER_GROUP:-nextcloudgroup}
@ -39,37 +39,48 @@ if [ "${NEXTCLOUD_DIR_CHOWN}" = "1" ] ; then
chown -R "${USER_UID}":"${USER_GID}" "${NEXTCLOUD_DIR}"
fi
PARAMS=
PARAMS=()
if [ "${NEXTCLOUD_FORCE_TRUST}" = "1" ] ; then
PARAMS="${PARAMS} --trust"
PARAMS+="--trust"
fi
if [ ! "${NEXTCLOUD_HTTPPROXY}" = "" ] ; then
PARAMS="${PARAMS} --httpproxy '${NEXTCLOUD_HTTPPROXY}'"
PARAMS+="--httpproxy"
PARAMS+="${NEXTCLOUD_HTTPPROXY}"
fi
if [ ! "${NEXTCLOUD_UPLIMIT}" = "" ] ; then
PARAMS="${PARAMS} --uplimit '${NEXTCLOUD_UPLIMIT}'"
PARAMS+="--uplimit"
PARAMS+="${NEXTCLOUD_UPLIMIT}"
fi
if [ ! "${NEXTCLOUD_DOWNLIMIT}" = "" ] ; then
PARAMS="${PARAMS} --downlimit '${NEXTCLOUD_DOWNLIMIT}'"
PARAMS+="--downlimit"
PARAMS+="${NEXTCLOUD_DOWNLIMIT}"
fi
if [ ! "${NEXTCLOUD_EXCLUDEFILE}" = "" ] ; then
if [ -r "${NEXTCLOUD_EXCLUDEFILE}" ] ; then
PARAMS="${PARAMS} --exclude '${NEXTCLOUD_EXCLUDEFILE}'"
PARAMS+="--exclude"
PARAMS+="${NEXTCLOUD_EXCLUDEFILE}"
fi
fi
if [ ! "${NEXTCLOUD_UNSYNCFILE}" = "" ] ; then
if [ -r "${NEXTCLOUD_UNSYNCFILE}" ] ; then
PARAMS="${PARAMS} --unsyncedfolders '${NEXTCLOUD_UNSYNCFILE}'"
PARAMS+="--unsyncedfolders"
PARAMS+="'${NEXTCLOUD_UNSYNCFILE}'"
fi
fi
if [ "${NEXTCLOUD_SILENT}" = "1" ] ; then
PARAMS="${PARAMS} --silent"
PARAMS+="--silent"
fi
PARAMS="${PARAMS} --non-interactive -u ${NEXTCLOUD_USERNAME} -p ${NEXTCLOUD_PASSWORD} ${NEXTCLOUD_DIR} ${NEXTCLOUD_URL}"
PARAMS+="--non-interactive"
PARAMS+="-u"
PARAMS+="${NEXTCLOUD_USERNAME}"
PARAMS+="-p"
PARAMS+="${NEXTCLOUD_PASSWORD}"
PARAMS+="${NEXTCLOUD_DIR}"
PARAMS+="${NEXTCLOUD_URL}"
# main loop
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}"
done