Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/vm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hansson <github@hanssonit.se>2020-11-14 04:50:39 +0300
committerGitHub <noreply@github.com>2020-11-14 04:50:39 +0300
commit27e6badcf122ae400acd1c9c44dd573b0ff908d4 (patch)
tree17358cc2c79aee11680fddb046e47304bef23b1d /static/setup_secure_permissions_nextcloud.sh
parent0752b9c0c8d33b08bad9d6dbc5da7d39de28597d (diff)
possible fix for permissons during installation
Diffstat (limited to 'static/setup_secure_permissions_nextcloud.sh')
-rw-r--r--static/setup_secure_permissions_nextcloud.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/static/setup_secure_permissions_nextcloud.sh b/static/setup_secure_permissions_nextcloud.sh
index da59ae18..444d6334 100644
--- a/static/setup_secure_permissions_nextcloud.sh
+++ b/static/setup_secure_permissions_nextcloud.sh
@@ -23,7 +23,12 @@ rootuser='root'
# Only check for existing datadir if Nextcloud is installed
if [ -f "$NCPATH"/config/config.php ]
then
- NCDATA="$(grep 'datadir' "$NCPATH"/config/config.php | awk '{print $3}' | cut -d "'" -f2)"
+ NCDATA="$(grep 'datadir' "${NCPATH}"/config/config.php | awk '{print $3}' | cut -d "'" -f2)"
+ # Check if ncdata is set, else fetch value from lib again (should happen during installation)
+ if [ -z "${NCDATA}" ]
+ then
+ source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
+ fi
fi
print_text_in_color "$IGreen" "Setting secure permissions..."
@@ -31,8 +36,8 @@ print_text_in_color "$ICyan" "Creating possible missing Directories"
mkdir -p "$NCPATH"/data
mkdir -p "$NCPATH"/updater
install -d -m 777 "$VMLOGS"
-install -o www-data -g www-data -m 660 /dev/null /var/log
-mkdir -p "$NCDATA"
+install -o "${htuser}" -g "${htgroup}" -m 660 /dev/null /var/log
+mkdir -p "${NCDATA}"
if ! [ -f "$VMLOGS/nextcloud.log" ]
then
@@ -69,7 +74,10 @@ fi
# Nextcloud datafolder
if [ -d "$NCDATA" ]
then
- if stat -c "%U:%G" "$NCDATA"/* | grep -cv "${htuser}:${htgroup}"
+ # Always chown root dir
+ chown "${htuser}":"${htgroup}" "${NCDATA}"/
+ # Check subdirs as well
+ if find "${NCDATA}" -mindepth 1 -type d -exec stat --printf='%U:%G\n' {} \; | grep -v "${htuser}:${htgroup}"
then
chown -R "${htuser}":"${htgroup}" "${NCDATA}"/
fi