From 21229f3a9959f83637c01f91517f437b71be8344 Mon Sep 17 00:00:00 2001 From: Harald Date: Mon, 8 Apr 2024 16:51:48 +0200 Subject: [PATCH] handling busybox linux timezones the busybox base linux QTS has no timedatectl command. In case the timedatectl command isn't available, the default timezone is taken from /etc/TZ and translated via /etc/tzlist. If those files also don't exist, it simply default to GMT (Europe/London) --- install-paperless-ngx.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install-paperless-ngx.sh b/install-paperless-ngx.sh index 84e55d3ee..b070819c8 100755 --- a/install-paperless-ngx.sh +++ b/install-paperless-ngx.sh @@ -71,7 +71,16 @@ 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 or /etc/TZ is suceeding, 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 + default_time_zone="Europe/London" +fi set -e