Skip to content

Commit 51a4d4a

Browse files
fix: use correct timezone
1 parent 572944a commit 51a4d4a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/plugins/terminal/scripts/init-alpine.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
2-
31
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/share/bin:/usr/share/sbin:/usr/local/bin:/usr/local/sbin:/system/bin:/system/xbin:$PREFIX/local/bin
42
export PS1="\[\e[38;5;46m\]\u\[\033[39m\]@localhost \[\033[39m\]\w \[\033[0m\]\\$ "
53
export HOME=/home
64
export TERM=xterm-256color
75

86

9-
required_packages="bash command-not-found"
7+
required_packages="bash command-not-found tzdata wget"
108
missing_packages=""
119

1210
for pkg in $required_packages; do
@@ -33,6 +31,19 @@ fi
3331

3432

3533
if [ "$1" = "--installing" ]; then
34+
echo "Configuring timezone..."
35+
36+
# Fetch timezone using wget
37+
TZ=$(wget -qO- https://ipapi.co/timezone)
38+
39+
if [ -n "$TZ" ] && [ -f "/usr/share/zoneinfo/$TZ" ]; then
40+
ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
41+
echo "$TZ" > /etc/timezone
42+
echo "Timezone set to: $TZ"
43+
else
44+
echo "Failed to detect timezone"
45+
fi
46+
3647
mkdir -p "$PREFIX/.configured"
3748
echo "Installation completed."
3849
exit 0
@@ -118,6 +129,7 @@ fi
118129
chmod +x "$PREFIX/alpine/initrc"
119130

120131
#actual souce
132+
#everytime a terminal is started initrc will run
121133
"$PREFIX/axs" -c "bash --rcfile /initrc -i"
122134

123135
else

0 commit comments

Comments
 (0)