fix environment file to not fill with duplicate values with restart container
Build and Push Docker Container / build-and-push (push) Successful in 58s
Build and Push Docker Container / build-and-push (push) Successful in 58s
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
if [ ! -z $(cat /etc/environment | grep "USE_TMUX_SHELL") ] && [[ -t 0 ]] && [ -z "$TMUX" ]; then
|
if grep -q "USE_TMUX_SHELL" /etc/environment && [[ -t 0 ]] && [ -z "$TMUX" ]; then
|
||||||
tmux attach || tmux new-session
|
tmux attach || tmux new-session
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ USER_GROUP="$USER"
|
|||||||
function set_environment_variables_if_not_empty {
|
function set_environment_variables_if_not_empty {
|
||||||
# Set Tmux Shell for .bashrc to load tmux and attach session if exists else create new session
|
# Set Tmux Shell for .bashrc to load tmux and attach session if exists else create new session
|
||||||
if [ -n "${USE_TMUX_SHELL:-}" ]; then
|
if [ -n "${USE_TMUX_SHELL:-}" ]; then
|
||||||
echo "USE_TMUX_SHELL=$USE_TMUX_SHELL" >> /etc/environment
|
grep -q "^USE_TMUX_SHELL=" /etc/environment || echo "USE_TMUX_SHELL=$USE_TMUX_SHELL" >> /etc/environment
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set Server Timezone
|
# Set Server Timezone
|
||||||
if [ -n "${TZ:-}" ]; then
|
if [ -n "${TZ:-}" ]; then
|
||||||
echo "TZ=$TZ" >> /etc/environment
|
grep -q "^TZ=" /etc/environment || echo "TZ=$TZ" >> /etc/environment
|
||||||
ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
|
ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user