From dffcebe34cc20d86daf7fc459737f3f726965e8d Mon Sep 17 00:00:00 2001 From: MIchael Steputat Date: Sat, 17 Oct 2020 16:51:38 +0200 Subject: [PATCH] Workaround for nextcloud 20 if UID/GID is not present in the docker image --- rootfs/usr/local/bin/run.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rootfs/usr/local/bin/run.sh b/rootfs/usr/local/bin/run.sh index 673c121..b4314e6 100644 --- a/rootfs/usr/local/bin/run.sh +++ b/rootfs/usr/local/bin/run.sh @@ -29,6 +29,17 @@ for dir in /nextcloud /data /config /apps2 /var/log /php /nginx /tmp /etc/s6.d; done echo "Done updating permissions." +echo "Check for UserId ${UID}" +grep ":${UID}:" /etc/passwd 1>/dev/null 2>&1 +ERRORCODE=$? + +if [ $ERRORCODE -ne 0 ]; then + echo "Creating user nextcloud with UID=${UID} and GID=${GID}" + /usr/sbin/adduser -g ${GID} -u ${UID} --disabled-password --gecos "" nextcloud +else + echo "An existing user with UID=${UID} was found, nothing to do" +fi + if [ ! -f /config/config.php ]; then # New installation, run the setup /usr/local/bin/setup.sh