]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: add timezone fallback to install script (#6336)
authorHarald <harald.berghoff@gmx.net>
Tue, 9 Apr 2024 00:45:43 +0000 (02:45 +0200)
committerGitHub <noreply@github.com>
Tue, 9 Apr 2024 00:45:43 +0000 (17:45 -0700)
install-paperless-ngx.sh

index 84e55d3ee0af161c51e6ff47fb96c20f5f4fd30b..a6327e3e8797dc698d03395ea95cb0739387ac1e 100755 (executable)
@@ -71,7 +71,17 @@ if ! docker stats --no-stream &> /dev/null ; then
        sleep 3
 fi
 
-default_time_zone=$(timedatectl show -p Timezone --value)
+# Added handling for timezone for busybox based linux, not having timedatectl available (i.e. QNAP QTS)
+# if neither timedatectl nor /etc/TZ is succeeding, defaulting to GMT.
+if  command -v timedatectl &> /dev/null ; then
+       default_time_zone=$(timedatectl show -p Timezone --value)
+elif [ -f /etc/TZ ] && [ -f /etc/tzlist ] ; then
+       TZ=$(cat /etc/TZ)
+       default_time_zone=$(grep -B 1 -m 1 "$TZ" /etc/tzlist | head -1 | cut -f 2 -d =)
+else
+       echo "WARN: unable to detect timezone, defaulting to Etc/UTC"
+       default_time_zone="Etc/UTC"
+fi
 
 set -e