Update local-shared-manager.sh

This commit is contained in:
MacRimi
2025-09-01 19:10:46 +02:00
parent ec65e96148
commit b6d4029797

View File

@@ -15,12 +15,12 @@ BASE_DIR="/usr/local/share/proxmenux"
UTILS_FILE="$BASE_DIR/utils.sh"
# Load utilities and shared functions
if [[ -f "$UTILS_FILE" ]]; then
source "$UTILS_FILE"
fi
# Load common share functions
SHARE_COMMON_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main/scripts/global/share-common.func"
if ! source <(curl -s "$SHARE_COMMON_URL" 2>/dev/null); then
SHARE_COMMON_LOADED=false
@@ -40,33 +40,33 @@ create_shared_directory() {
SHARED_DIR=$(pmx_select_host_mount_point "$(translate "Select Shared Directory Location")" "/mnt/shared")
[[ -z "$SHARED_DIR" ]] && return
# Confirm overwrite if already exists
if [[ -d "$SHARED_DIR" ]]; then
if ! whiptail --yesno "$(translate "Directory already exists. Continue with permission setup?")" 10 70 --title "$(translate "Directory Exists")"; then
return
fi
fi
# Ensure group exists
SHARE_GROUP=$(pmx_choose_or_create_group "sharedfiles") || return 1
SHARE_GID=$(pmx_ensure_host_group "$SHARE_GROUP" 101000) || return 1
# --- Saneamos ACLs de /mnt para evitar herencias raras ---
if command -v setfacl >/dev/null 2>&1; then
setfacl -k /mnt 2>/dev/null || true # elimina ACL por defecto
setfacl -b /mnt 2>/dev/null || true # elimina ACL actuales
setfacl -k /mnt 2>/dev/null || true
setfacl -b /mnt 2>/dev/null || true
fi
chmod 755 /mnt 2>/dev/null || true
# --- Preparamos el directorio ---
pmx_prepare_host_shared_dir "$SHARED_DIR" "$SHARE_GROUP" || return 1
# --- Limpiamos ACLs del directorio por si heredó algo ---
if command -v setfacl >/dev/null 2>&1; then
setfacl -b -R "$SHARED_DIR" 2>/dev/null || true
fi
# --- Reforzamos permisos POSIX estándar ---
chown root:"$SHARE_GROUP" "$SHARED_DIR"
chmod 2775 "$SHARED_DIR"