fix: Improve TrueNAS detection for immutable filesystem installs
Added fallback detection for TrueNAS systems that may not have /etc/truenas-version or other standard markers: 1. Check if hostname contains "truenas" (common default hostname) 2. Test if /usr/local/bin is actually writable - if not and /data exists, use TrueNAS installation paths This fixes installations on TrueNAS systems where the standard detection files are missing but the filesystem is still immutable. Related to #801
This commit is contained in:
parent
d195c8357e
commit
bc501df4e8
1 changed files with 20 additions and 0 deletions
|
|
@ -236,6 +236,20 @@ is_truenas_scale() {
|
||||||
if [[ -d /data/ix-applications ]] || [[ -d /etc/ix-apps.d ]]; then
|
if [[ -d /data/ix-applications ]] || [[ -d /etc/ix-apps.d ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
# Fallback: check if hostname contains "truenas" (common default hostname)
|
||||||
|
if hostname 2>/dev/null | grep -qi "truenas"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if we can write to /usr/local/bin (catches immutable filesystems like TrueNAS)
|
||||||
|
is_install_dir_writable() {
|
||||||
|
local test_file="${INSTALL_DIR}/.pulse-write-test-$$"
|
||||||
|
if touch "$test_file" 2>/dev/null; then
|
||||||
|
rm -f "$test_file" 2>/dev/null
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,6 +258,12 @@ if [[ "$(uname -s)" == "Linux" ]] && is_truenas_scale; then
|
||||||
INSTALL_DIR="$TRUENAS_STATE_DIR"
|
INSTALL_DIR="$TRUENAS_STATE_DIR"
|
||||||
LOG_FILE="$TRUENAS_LOG_DIR/${AGENT_NAME}.log"
|
LOG_FILE="$TRUENAS_LOG_DIR/${AGENT_NAME}.log"
|
||||||
log_info "TrueNAS SCALE detected (immutable root). Using $TRUENAS_STATE_DIR for installation."
|
log_info "TrueNAS SCALE detected (immutable root). Using $TRUENAS_STATE_DIR for installation."
|
||||||
|
elif [[ "$(uname -s)" == "Linux" ]] && [[ -d /data ]] && ! is_install_dir_writable; then
|
||||||
|
# /usr/local/bin is read-only but /data exists - likely TrueNAS or similar immutable system
|
||||||
|
TRUENAS=true
|
||||||
|
INSTALL_DIR="$TRUENAS_STATE_DIR"
|
||||||
|
LOG_FILE="$TRUENAS_LOG_DIR/${AGENT_NAME}.log"
|
||||||
|
log_info "Immutable filesystem detected (read-only /usr/local/bin). Using $TRUENAS_STATE_DIR for installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Download ---
|
# --- Download ---
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue