Remove remaining OS-specific hardcodes from core scripts
OS version reads now go through platform_get_os_version() and platform_os_version_probe_cmd() instead of grepping /etc/unraid-version directly. STATE_DIR fallbacks to /boot/config removed — STATE_DIR is always set by load_config.sh and the fallback encoded a platform-specific path. Setup DB path references use platform_setup_db_path() instead of the VARAVERK_SETUP_FILE/-/boot/config compound fallback. DOCKER_APPDATA_BASE default removed from arr_sync.sh — the adapter sets it.
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
# platform_scripts_dir_probe_cmd — shell command to run on a remote to discover its SCRIPTS_DIR
|
||||
# platform_get_templates_dir — path to Unraid CA docker templates-user directory
|
||||
# platform_setup_db_path — path to the persistent Varaverk setup/wizard state database
|
||||
# platform_get_os_version — local OS version string (e.g. "7.2.3")
|
||||
# platform_os_version_probe_cmd — shell command to run on a remote to retrieve its OS version
|
||||
# platform_rebuild_container — rebuild a container from its stored XML template
|
||||
# platform_push_conf — push master.conf to all listed hosts via WebGUI PHP
|
||||
# platform_push_setup_state — push wizard setup state to WebGUI PHP
|
||||
@@ -275,6 +277,27 @@ platform_setup_db_path() {
|
||||
echo "/boot/config/varaverk_setup.db"
|
||||
}
|
||||
|
||||
# ──────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# platform_get_os_version
|
||||
# Writes the platform OS version string to stdout (e.g. "7.2.3").
|
||||
# Returns 1 if the version file is absent or unparseable.
|
||||
# ──────────────────────────────────────────────────────────────────────────────────────────────
|
||||
platform_get_os_version() {
|
||||
local ver
|
||||
ver=$(grep -oP '(?<=version=")[^"]+' /etc/unraid-version 2>/dev/null)
|
||||
[[ -n "$ver" ]] || return 1
|
||||
echo "$ver"
|
||||
}
|
||||
|
||||
# ──────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# platform_os_version_probe_cmd
|
||||
# Writes a shell command suitable for running on a remote via SSH to retrieve
|
||||
# that remote's OS version string. Output format matches platform_get_os_version.
|
||||
# ──────────────────────────────────────────────────────────────────────────────────────────────
|
||||
platform_os_version_probe_cmd() {
|
||||
echo "grep -oP '(?<=version=\")[^\"]+' /etc/unraid-version 2>/dev/null"
|
||||
}
|
||||
|
||||
# ──────────────────────────────────────────────────────────────────────────────────────────────
|
||||
# platform_rebuild_container <container_name>
|
||||
# Rebuilds a container from its stored Unraid CA XML template (stops old, recreates on new
|
||||
|
||||
Reference in New Issue
Block a user