This commit is contained in:
parent
8e9a8a90ee
commit
ddb252d701
44
start.sh
44
start.sh
@ -14,7 +14,7 @@ NEXTCLOUD_SLEEP=${NEXTCLOUD_SLEEP:-30}
|
||||
# check if group already exists
|
||||
GRP_NAME=$(getent group "${USER_GID}" )
|
||||
if [ "${GRP_NAME}" ] ; then
|
||||
USER_GROUP=$( echo "${GRP_NAME}" | sed 's/\:.*//' )
|
||||
USER_GROUP="${GRP_NAME//:*/}"
|
||||
else
|
||||
# if not, we create the group
|
||||
addgroup -g "${USER_GID}" "${USER_GROUP}"
|
||||
@ -23,7 +23,7 @@ fi
|
||||
# check if user already exists
|
||||
USR_NAME=$(getent passwd "${USER_UID}" )
|
||||
if [ "${USR_NAME}" ] ; then
|
||||
USER_NAME=$( echo "${USR_NAME}" | sed 's/\:.*//' )
|
||||
USER_NAME="${USR_NAME//:*/}"
|
||||
else
|
||||
# if not, we create the user
|
||||
adduser -s /bin/false -D -H -G "${USER_GROUP}" -u "${USER_UID}" "${USER_NAME}"
|
||||
@ -41,46 +41,46 @@ fi
|
||||
|
||||
PARAMS=()
|
||||
if [ "${NEXTCLOUD_FORCE_TRUST}" = "1" ] ; then
|
||||
PARAMS+="--trust"
|
||||
PARAMS+=("--trust")
|
||||
fi
|
||||
if [ ! "${NEXTCLOUD_HTTPPROXY}" = "" ] ; then
|
||||
PARAMS+="--httpproxy"
|
||||
PARAMS+="${NEXTCLOUD_HTTPPROXY}"
|
||||
PARAMS+=("--httpproxy")
|
||||
PARAMS+=("${NEXTCLOUD_HTTPPROXY}")
|
||||
fi
|
||||
if [ ! "${NEXTCLOUD_UPLIMIT}" = "" ] ; then
|
||||
PARAMS+="--uplimit"
|
||||
PARAMS+="${NEXTCLOUD_UPLIMIT}"
|
||||
PARAMS+=("--uplimit")
|
||||
PARAMS+=("${NEXTCLOUD_UPLIMIT}")
|
||||
fi
|
||||
if [ ! "${NEXTCLOUD_DOWNLIMIT}" = "" ] ; then
|
||||
PARAMS+="--downlimit"
|
||||
PARAMS+="${NEXTCLOUD_DOWNLIMIT}"
|
||||
PARAMS+=("--downlimit")
|
||||
PARAMS+=("${NEXTCLOUD_DOWNLIMIT}")
|
||||
fi
|
||||
if [ ! "${NEXTCLOUD_EXCLUDEFILE}" = "" ] ; then
|
||||
if [ -r "${NEXTCLOUD_EXCLUDEFILE}" ] ; then
|
||||
PARAMS+="--exclude"
|
||||
PARAMS+="${NEXTCLOUD_EXCLUDEFILE}"
|
||||
PARAMS+=("--exclude")
|
||||
PARAMS+=("${NEXTCLOUD_EXCLUDEFILE}")
|
||||
fi
|
||||
fi
|
||||
if [ ! "${NEXTCLOUD_UNSYNCFILE}" = "" ] ; then
|
||||
if [ -r "${NEXTCLOUD_UNSYNCFILE}" ] ; then
|
||||
PARAMS+="--unsyncedfolders"
|
||||
PARAMS+="'${NEXTCLOUD_UNSYNCFILE}'"
|
||||
PARAMS+=("--unsyncedfolders")
|
||||
PARAMS+=("${NEXTCLOUD_UNSYNCFILE}")
|
||||
fi
|
||||
fi
|
||||
if [ "${NEXTCLOUD_SILENT}" = "1" ] ; then
|
||||
PARAMS+="--silent"
|
||||
PARAMS+=("--silent")
|
||||
fi
|
||||
|
||||
PARAMS+="--non-interactive"
|
||||
PARAMS+="-u"
|
||||
PARAMS+="${NEXTCLOUD_USERNAME}"
|
||||
PARAMS+="-p"
|
||||
PARAMS+="${NEXTCLOUD_PASSWORD}"
|
||||
PARAMS+="${NEXTCLOUD_DIR}"
|
||||
PARAMS+="${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
|
||||
|
Loading…
Reference in New Issue
Block a user