summaryrefslogtreecommitdiff
path: root/setup-timezone.in
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2022-11-04 21:49:19 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-08 14:59:33 +0000
commitdabbed1f4761a34e4b9913414e42a0f178732c2d (patch)
treecc3819bc198dc25b308dc11226eda96de36ff7cc /setup-timezone.in
parent37239dbb30268061c5d0e5c30d4814fd9663d10b (diff)
downloadalpine-conf-dabbed1f4761a34e4b9913414e42a0f178732c2d.zip
setup-timezone: use trap to uninstall tzdata
Diffstat (limited to 'setup-timezone.in')
-rw-r--r--setup-timezone.in8
1 files changed, 4 insertions, 4 deletions
diff --git a/setup-timezone.in b/setup-timezone.in
index 5c5b139..8b48272 100644
--- a/setup-timezone.in
+++ b/setup-timezone.in
@@ -91,6 +91,10 @@ fi
$MOCK apk add --quiet $pkg
+if [ -n "$apkdel" ]; then
+ trap "$MOCK apk del --quiet $apkdel" EXIT HUP INT TERM
+fi
+
if [ -L "${ROOT}"etc/zoneinfo/localtime ]; then
default_timezone=$(readlink "${ROOT}"etc/zoneinfo/localtime)
default_timezone=${timezone#*/zoneinfo/}
@@ -128,7 +132,3 @@ while true; do
fi
echo "'$timezone' is not a valid timezone on this system"
done
-
-if [ -n "$apkdel" ]; then
- $MOCK apk del --quiet $apkdel
-fi