feat: Check if shared folder is writeable (#1531)

This commit is contained in:
Kroese 2025-10-22 12:19:39 +02:00 committed by GitHub
parent 122d1ff98e
commit 544501107a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,16 +46,23 @@ addShare() {
local cfg="$5" local cfg="$5"
local owner="" local owner=""
if ! mkdir -p "$dir"; then if [ ! -d "$dir" ]; then
error "Failed to create directory $dir." && return 1 if ! mkdir -p "$dir"; then
error "Failed to create shared folder ($dir)." && return 1
fi
fi fi
if ! ls -A "$dir" >/dev/null 2>&1; then if ! ls -A "$dir" >/dev/null 2>&1; then
msg="Failed to access directory $dir." msg="No permission to access shared folder ($dir)."
msg+=" If SELinux is active, you need to add the \":Z\" flag to the bind mount." msg+=" If SELinux is active, you need to add the \":Z\" flag to the bind mount."
error "$msg" && return 1 error "$msg" && return 1
fi fi
if [ ! -w "$dir" ]; then
msg="shared folder ($dir) is not writeable!"
warn "$msg"
fi
if [ -z "$(ls -A "$dir")" ]; then if [ -z "$(ls -A "$dir")" ]; then
if ! chmod 2777 "$dir"; then if ! chmod 2777 "$dir"; then
error "Failed to set permissions for directory $dir" && return 1 error "Failed to set permissions for directory $dir" && return 1