LibrePortal/variables.sh
librelad 15fc42c858 refactor(layout): consolidate out-of-/docker files + fix sysctl dir
Organise the system footprint outside /docker:
- All LibrePortal executables now live together in /usr/local/lib/libreportal/
  (root:root): the 7 root helpers AND the CLI wrapper. /usr/local/bin/libreportal
  becomes a symlink onto $PATH. run_privileged._runRootHelper, init.sh
  (initRootHelpers + scoped-sudoers Cmnd_Alias + command setup) all point there.
  The wrapper is now root-owned too (manager can't tamper with its entrypoint).
- Fix a real bug: rootless sysctl settings were written to /etc/sysctl/99-custom.conf,
  a dir  does NOT read, so net.ipv4.ip_unprivileged_port_start /
  kernel.unprivileged_userns_clone never persisted across reboot. Moved to
  /etc/sysctl.d/99-libreportal-rootless.conf (the existing
  reload now actually applies them). Consistent libreportal* naming.
- Drop dead fqdn_file=/root/libreportal-fqdn.txt global (never used).
- Add FOOTPRINT.md: a manifest of every file LibrePortal places outside /docker
  (doubles as an uninstall checklist).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-24 19:40:35 +01:00

60 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
trap exitScript SIGINT
# Directories are contained in init.sh
# Define text colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
BLUE='\033[1;34m'
PINK='\033[0;35m'
CYAN='\033[0;36m'
BOLD='\033[1m'
DIM='\033[2m'
NC='\033[0m' # No Color
# Date/Time
backupDate=$(date +'%F')
backupFolder="backup_$(date +"%Y%m%d%H%M%S")"
current_date=$(date +%Y-%m-%d)
current_time=$(date +%H:%M:%S)
# Domain/Network
# Try to get public IP, fallback to local IP if all fail
if command -v dig >/dev/null 2>&1; then
public_ip_v4=$(dig +short myip.opendns.com @resolver1.opendns.com 2>/dev/null)
fi
# Fallback to local IP if dig failed or returned empty
if [[ -z "$public_ip_v4" ]]; then
public_ip_v4=$(hostname -I | awk '{print $1}' 2>/dev/null)
fi
# Final fallback to localhost
if [[ -z "$public_ip_v4" ]]; then
public_ip_v4="localhost"
fi
server_nic="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)"
default_subnet="10.100.0"
# Files
docker_rooted_socket="/var/run/docker.sock"
swap_file=/swapfile
# Rootless sysctl settings + the "rootless configured" marker. MUST live under
# /etc/sysctl.d/ — `sysctl --system` only reads there (+ /etc/sysctl.conf), NOT
# the old non-standard /etc/sysctl/ path, so settings written elsewhere never
# persist across reboot.
sysctl="/etc/sysctl.d/99-libreportal-rootless.conf"
docker_log_file=libreportal.log
backup_log_file=backup.log
db_file=database.db
migrate_file=migrate.txt
run_file=run.txt
# Configs
update_done=false
config_file_wireguard=config_wireguard
core_categories=("general" "features" "network")
# Menu
menu_number=0