Fix direct function calls in lib scripts to prevent execution on source
This commit is contained in:
@@ -55,12 +55,21 @@ install_jellyfin() {
|
|||||||
log_info "Jellyfin installation completed."
|
log_info "Jellyfin installation completed."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect the distribution and call the appropriate function
|
# Logging-Funktionen bereitstellen, falls nicht vorhanden
|
||||||
if [ -f /etc/os-release ]; then
|
if ! command -v log_info &>/dev/null; then
|
||||||
. /etc/os-release
|
log_info() { echo "[INFO] $1"; }
|
||||||
DISTRO=$ID
|
log_error() { echo "[ERROR] $1" >&2; }
|
||||||
install_jellyfin
|
fi
|
||||||
else
|
|
||||||
log_error "Cannot detect the operating system."
|
# Nur ausführen, wenn diese Datei direkt ausgeführt wird (nicht beim `source` in setup.sh).
|
||||||
exit 1
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
# Detect the distribution and call the appropriate function
|
||||||
|
if [ -f /etc/os-release ]; then
|
||||||
|
. /etc/os-release
|
||||||
|
DISTRO=$ID
|
||||||
|
install_jellyfin
|
||||||
|
else
|
||||||
|
log_error "Cannot detect the operating system."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -43,5 +43,9 @@ if ! command -v log_info &>/dev/null; then
|
|||||||
log_error() { echo "[ERROR] $1" >&2; }
|
log_error() { echo "[ERROR] $1" >&2; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Hauptlogik
|
# Nur ausführen, wenn diese Datei direkt ausgeführt wird (nicht beim `source` in setup.sh).
|
||||||
install_portainer
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
|
# Hauptlogik
|
||||||
|
install_portainer
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user