mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-01 23:56:18 +00:00
Update local-shared-manager.sh
This commit is contained in:
@@ -15,12 +15,12 @@ BASE_DIR="/usr/local/share/proxmenux"
|
|||||||
UTILS_FILE="$BASE_DIR/utils.sh"
|
UTILS_FILE="$BASE_DIR/utils.sh"
|
||||||
|
|
||||||
|
|
||||||
# Load utilities and shared functions
|
|
||||||
if [[ -f "$UTILS_FILE" ]]; then
|
if [[ -f "$UTILS_FILE" ]]; then
|
||||||
source "$UTILS_FILE"
|
source "$UTILS_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load common share functions
|
|
||||||
SHARE_COMMON_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main/scripts/global/share-common.func"
|
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
|
if ! source <(curl -s "$SHARE_COMMON_URL" 2>/dev/null); then
|
||||||
SHARE_COMMON_LOADED=false
|
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")
|
SHARED_DIR=$(pmx_select_host_mount_point "$(translate "Select Shared Directory Location")" "/mnt/shared")
|
||||||
[[ -z "$SHARED_DIR" ]] && return
|
[[ -z "$SHARED_DIR" ]] && return
|
||||||
|
|
||||||
# Confirm overwrite if already exists
|
|
||||||
if [[ -d "$SHARED_DIR" ]]; then
|
if [[ -d "$SHARED_DIR" ]]; then
|
||||||
if ! whiptail --yesno "$(translate "Directory already exists. Continue with permission setup?")" 10 70 --title "$(translate "Directory Exists")"; then
|
if ! whiptail --yesno "$(translate "Directory already exists. Continue with permission setup?")" 10 70 --title "$(translate "Directory Exists")"; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure group exists
|
|
||||||
SHARE_GROUP=$(pmx_choose_or_create_group "sharedfiles") || return 1
|
SHARE_GROUP=$(pmx_choose_or_create_group "sharedfiles") || return 1
|
||||||
SHARE_GID=$(pmx_ensure_host_group "$SHARE_GROUP" 101000) || 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
|
if command -v setfacl >/dev/null 2>&1; then
|
||||||
setfacl -k /mnt 2>/dev/null || true # elimina ACL por defecto
|
setfacl -k /mnt 2>/dev/null || true
|
||||||
setfacl -b /mnt 2>/dev/null || true # elimina ACL actuales
|
setfacl -b /mnt 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
chmod 755 /mnt 2>/dev/null || true
|
chmod 755 /mnt 2>/dev/null || true
|
||||||
|
|
||||||
# --- Preparamos el directorio ---
|
|
||||||
pmx_prepare_host_shared_dir "$SHARED_DIR" "$SHARE_GROUP" || return 1
|
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
|
if command -v setfacl >/dev/null 2>&1; then
|
||||||
setfacl -b -R "$SHARED_DIR" 2>/dev/null || true
|
setfacl -b -R "$SHARED_DIR" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Reforzamos permisos POSIX estándar ---
|
|
||||||
chown root:"$SHARE_GROUP" "$SHARED_DIR"
|
chown root:"$SHARE_GROUP" "$SHARED_DIR"
|
||||||
chmod 2775 "$SHARED_DIR"
|
chmod 2775 "$SHARED_DIR"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user