Browse Source

new: [apache] re-introduced setting ownership for data dirs

This was removed for macosx compatibility reasons. Did not have the
chance to test this, but hopefully, ``chown`` an ``chmod`` might have
better chances of being compatible that previous ``setacl``.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
matomo
Valentin Lab 4 years ago
parent
commit
e314e9bfaf
  1. 25
      apache/lib/common

25
apache/lib/common

@ -452,7 +452,7 @@ $SERVICE_NAME:
}
apache_data_dirs() {
local cfg="$1" data_dirs dst data dirs
local cfg="$1" data_dirs dst data fdir to_create
data_dirs=$(e "$cfg" | cfg-get-value data-dirs 2>/dev/null | shyaml get-values 2>/dev/null) || true
if [ -z "$data_dirs" ]; then
return 0
@ -463,7 +463,7 @@ apache_data_dirs() {
data=()
while IFS="," read -ra addr; do
for dir in "${addr[@]}"; do
data+=($dir)
data+=("$dir")
done
done <<< "$data_dirs"
@ -473,21 +473,26 @@ apache_data_dirs() {
}
info "www-data gid from ${DARKYELLOW}$TARGET_SERVICE_NAME${NORMAL} is '$www_data_gid'"
dirs=()
to_create=()
volumes=""
for d in "${data[@]}"; do
dirs+=("$dst/$d")
fdir="$dst/$d"
volumes+=" - $HOST_DATASTORE${dst##$DATASTORE}/$d:$local_path/$d"$'\n'
if ! [ -d "$fdir" ]; then
to_create+=("$fdir")
fi
done
mkdir -p "${dirs[@]}" || return 1
if [ "${#to_create[@]}" -gt 0 ]; then
mkdir -p "${to_create[@]}" || return 1
chgrp -v "${www_data_gid}" "${to_create[@]}" || return 1
chmod g+rwx "${to_create[@]}" || return 1
fi
init-config-add "
$SERVICE_NAME:
volumes:
$(
for d in "${data[@]}"; do
echo " - $HOST_DATASTORE${dst##$DATASTORE}/$d:$local_path/$d"
done
)"
$volumes"
}

Loading…
Cancel
Save