Commit 5690826e authored by Natanael Copa's avatar Natanael Copa

setup-timezone: use /usr/zoneinfo/localtime instead of /etc/TZ

musl uses /etc/zoneinfo/localtime

ref #927
fixes #2867
parent 4b2f418d
...@@ -37,9 +37,9 @@ show_tz_list() { ...@@ -37,9 +37,9 @@ show_tz_list() {
( cd $path && ls --color=never -Cd $z ) ( cd $path && ls --color=never -Cd $z )
} }
valid_tz() { setup_tz() {
find $zroot -type f -a -not -name '*.tab' -a -not -name 'Factory' \ mkdir -p "${ROOT}"etc/zoneinfo
| xargs posixtz | sort | uniq | grep -q -w "$1" cp "$1" "${ROOT}"etc/zoneinfo/localtime
} }
while getopts "hz:" opt; do while getopts "hz:" opt; do
...@@ -53,15 +53,11 @@ if ! apk info --quiet --installed tzdata; then ...@@ -53,15 +53,11 @@ if ! apk info --quiet --installed tzdata; then
apk add --quiet tzdata && apkdel="tzdata" || exit 1 apk add --quiet tzdata && apkdel="tzdata" || exit 1
fi fi
zonepath=$(cat /etc/TZ 2>/dev/null) zonepath=UTC
[ -z "$zonepath" ] && zonepath="UTC"
while true; do while true; do
if [ -n "$ZONEINFODIR" ]; then if [ -n "$ZONEINFODIR" ]; then
TZ=$(posixtz "$ZONEINFODIR") || echo "Failed to convert '$ZONEINFODIR' to POSIX TZ" setup_tz "$ZONEINFODIR"
if [ -n "$TZ" ]; then
echo $TZ > /etc/TZ || rm -f /etc/TZ
fi
break break
fi fi
...@@ -82,16 +78,8 @@ while true; do ...@@ -82,16 +78,8 @@ while true; do
zonepath="$zonepath/$zone" zonepath="$zonepath/$zone"
done done
TZ= if [ -f "$zroot/$zonepath" ]; then
if valid_tz "$zonepath"; then setup_tz "$zroot/$zonepath"
TZ="$zonepath"
elif [ -f "$zroot/$zonepath" ]; then
TZ=$(posixtz "$zroot/$zonepath") \
|| echo "Failed to convert '$zroot/$zonepath' to POSIX TZ"
fi
if [ -n "$TZ" ]; then
echo $TZ > /etc/TZ || rm -f /etc/TZ
break break
fi fi
echo "'$zonepath' is not a valid timezone on this system" echo "'$zonepath' is not a valid timezone on this system"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment