projects/aports·blob master · refs

47 lines · 2.1 KiB

1diff --git a/profile/flatpak.fish b/profile/flatpak.fish
2index 5940f51c..bbbefed8 100644
3--- a/profile/flatpak.fish
4+++ b/profile/flatpak.fish
5@@ -3,6 +3,19 @@ if type -q flatpak
6 # user installation's exports/share is already present in $XDG_DATA_DIRS.
7 set -x --path XDG_DATA_DIRS $XDG_DATA_DIRS
8
9+ # set TZDIR to our setup-timezone directory
10+ # see https://gitlab.alpinelinux.org/alpine/aports/-/issues/14844
11+ if test -d /etc/zoneinfo
12+ # this directory only exists if setup-timezone was run to add one timezone and not add tzdata.
13+ # unconditionally setting it would break things when it does not exist, so make sure it does.
14+ # if it does not exist, then /etc/localtime is going to be pointing to /usr/share/zoneinfo.
15+ set -l contents (command ls -A /etc/zoneinfo)
16+ # it can also be empty. don't export it then
17+ if test -n "$contents"
18+ set -x TZDIR /etc/zoneinfo
19+ end
20+ end
21+
22 set -l __flatpak_xdg_data_home $HOME/.local/share
23 set -q XDG_DATA_HOME; and set __flatpak_xdg_data_home $XDG_DATA_HOME
24
25diff --git a/profile/flatpak.sh b/profile/flatpak.sh
26index 4b88baf3..8cc251e0 100644
27--- a/profile/flatpak.sh
28+++ b/profile/flatpak.sh
29@@ -26,4 +26,18 @@ if command -v flatpak > /dev/null; then
30 XDG_DATA_DIRS="${new_dirs:+${new_dirs}:}${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
31
32 unset new_dirs
33+
34+ # set TZDIR to our setup-timezone directory
35+ # see https://gitlab.alpinelinux.org/alpine/aports/-/issues/14844
36+ if [ -d /etc/zoneinfo ]; then
37+ # this directory only exists if setup-timezone was run to add one timezone and not add tzdata.
38+ # unconditionally setting it would break things when it does not exist, so make sure it does.
39+ # if it does not exist, then /etc/localtime is going to be pointing to /usr/share/zoneinfo.
40+ contents="$(command ls -A /etc/zoneinfo)"
41+ # it can also be empty. don't export it then
42+ if [ -n "$contents" ]; then
43+ export TZDIR=/etc/zoneinfo
44+ fi
45+ unset contents
46+ fi
47 fi