use function to set all environment variables at once

This commit is contained in:
2024-12-06 12:19:36 +01:00
parent 1523b333e6
commit 92483d0a4b
+16 -4
View File
@@ -3,6 +3,19 @@ source "/variables.sh"
##################################################################################################### #####################################################################################################
# Funktionen # Funktionen
##################################################################################################### #####################################################################################################
function set_environment_variables_if_not_empty {
# Set Tmux Shell for .bashrc to load tmux and attach session if exists else create new session
if [ "$USE_TMUX_SHELL" != "" ]; then
echo "USE_TMUX_SHELL=$USE_TMUX_SHELL" >> /etc/environment
fi
# Set Server Timezone
if [ "$TZ" != "" ]; then
echo "TZ=$TZ" >> /etc/environment
ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
fi
}
function print_container_info { function print_container_info {
sepurator sepurator
echo "* BorgServer powered by $BORG_VERSION" echo "* BorgServer powered by $BORG_VERSION"
@@ -112,11 +125,9 @@ function maintenance_enable {
fi fi
} }
function set_timezone { function show_timezone_output {
if [ "$TZ" != "" ]; then if [ "$TZ" != "" ]; then
echo "* Setting Timezone to $TZ" echo "* Setting Timezone to $TZ"
echo "TZ=$TZ" > /etc/environment
ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
else else
echo "* Timezone not set - Use UTC Time" echo "* Timezone not set - Use UTC Time"
fi fi
@@ -178,6 +189,7 @@ function run_prometheus_exporter() {
##################################################################################################### #####################################################################################################
# Main Code # Main Code
##################################################################################################### #####################################################################################################
set_environment_variables_if_not_empty
add_borg_user add_borg_user
print_container_info print_container_info
@@ -189,7 +201,7 @@ generate_host_sshkey
sepurator sepurator
maintenance_enable maintenance_enable
set_timezone show_timezone_output
run_teleport_server run_teleport_server
run_prometheus_exporter run_prometheus_exporter
run_install_script run_install_script