Detect Network Interface
This commit is contained in:
parent
6c4477e11d
commit
0819e5f5a7
@ -29,9 +29,13 @@ INSTALL_PATH="/usr/local/bin/filebrowser"
|
|||||||
DB_PATH="/usr/local/community-scripts/filebrowser.db"
|
DB_PATH="/usr/local/community-scripts/filebrowser.db"
|
||||||
DEFAULT_PORT=8080
|
DEFAULT_PORT=8080
|
||||||
|
|
||||||
# Get first non-loopback IP
|
# Get first non-loopback IP & Detect primary network interface dynamically
|
||||||
IP=$(hostname -I | awk '{print $1}')
|
IFACE=$(ip -4 route | awk '/default/ {print $5; exit}')
|
||||||
[[ -z "$IP" ]] && IP="127.0.0.1" # Fallback auf localhost, falls keine IP gefunden wird
|
IP=$(ip -4 addr show "$IFACE" | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1)
|
||||||
|
|
||||||
|
[[ -z "$IP" ]] && IP=$(hostname -I | awk '{print $1}')
|
||||||
|
[[ -z "$IP" ]] && IP="127.0.0.1"
|
||||||
|
|
||||||
|
|
||||||
# Detect OS
|
# Detect OS
|
||||||
if [[ -f "/etc/alpine-release" ]]; then
|
if [[ -f "/etc/alpine-release" ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user