diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-04-23 08:33:21 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-04-23 11:34:02 +0200 |
commit | 5690826e2c22938264eae0db676826d243e71945 (patch) | |
tree | 6946830c5d5ad8e89e116c32cdca548bc64aa1d8 /setup-timezone.in | |
parent | 4b2f418d122b7747ad7beaaf5f333c5fca16b89c (diff) | |
download | alpine-conf-5690826e2c22938264eae0db676826d243e71945.zip |
setup-timezone: use /usr/zoneinfo/localtime instead of /etc/TZ
musl uses /etc/zoneinfo/localtime
ref #927
fixes #2867
Diffstat (limited to 'setup-timezone.in')
-rwxr-xr-x | setup-timezone.in | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/setup-timezone.in b/setup-timezone.in index f1a85c0..1d76c80 100755 --- a/setup-timezone.in +++ b/setup-timezone.in @@ -37,9 +37,9 @@ show_tz_list() { ( cd $path && ls --color=never -Cd $z ) } -valid_tz() { - find $zroot -type f -a -not -name '*.tab' -a -not -name 'Factory' \ - | xargs posixtz | sort | uniq | grep -q -w "$1" +setup_tz() { + mkdir -p "${ROOT}"etc/zoneinfo + cp "$1" "${ROOT}"etc/zoneinfo/localtime } while getopts "hz:" opt; do @@ -53,15 +53,11 @@ if ! apk info --quiet --installed tzdata; then apk add --quiet tzdata && apkdel="tzdata" || exit 1 fi -zonepath=$(cat /etc/TZ 2>/dev/null) -[ -z "$zonepath" ] && zonepath="UTC" +zonepath=UTC while true; do if [ -n "$ZONEINFODIR" ]; then - TZ=$(posixtz "$ZONEINFODIR") || echo "Failed to convert '$ZONEINFODIR' to POSIX TZ" - if [ -n "$TZ" ]; then - echo $TZ > /etc/TZ || rm -f /etc/TZ - fi + setup_tz "$ZONEINFODIR" break fi @@ -82,16 +78,8 @@ while true; do zonepath="$zonepath/$zone" done - TZ= - if valid_tz "$zonepath"; then - 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 + if [ -f "$zroot/$zonepath" ]; then + setup_tz "$zroot/$zonepath" break fi echo "'$zonepath' is not a valid timezone on this system" |