#!/bin/sh

NEXTCLOUD_DIR='/usr/share/webapps/nextcloud'
: ${NEXTCLOUD_USER:="nextcloud"}

if [ "$(id -un)" != "$NEXTCLOUD_USER" ]; then
	exec su -s /bin/sh "$NEXTCLOUD_USER" -c '$0 "$@"' -- $NEXTCLOUD_DIR/occ "$@"
else
	exec $NEXTCLOUD_DIR/occ "$@"
fi