Skip to content

Commit 62559f1

Browse files
authored
set timezone in EXTRA_JAVA_OPTS, too, when user uses menu 33 (#2141)
Signed-off-by: Markus Storm <markus.storm@gmx.net>
1 parent 3bfc367 commit 62559f1

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

docs/openhabian.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ We try to setup everything for you so that you don't have to do any additional c
211211
- **Language**: By default we set the `locale` setting to `en_US.UTF8` as this tends to be the best for error messages, it can be changed using menu option 32.
212212
- **Passwords**: You should change the default password using menu option 34.
213213

214+
NOTE: You should have been configuring timezone and locale at installation time via `openhabian.conf` settings.
215+
216+
214217
##### Default Passwords
215218

216219
For reference, the default username and passwords are as follows:
@@ -255,6 +258,9 @@ The ESPHome configuration files are secured by the openHABbian backup function.
255258

256259
Many settings are configurable prior to the first boot of openHABian by changing the key value pairs in the `/boot/openhabian.conf` file on the SD card once you have flashed the initial image onto it.
257260

261+
Most notably you should be setting the timezone and locale this way if yours differ from the defaults.
262+
Also make sure to read the [Networking] section and eventually preconfigure your Wi-Fi setup before you boot for the first time.
263+
258264
Please note that - in case you use a Windows system for writing the SD card - the `/boot/` partition will be mounted to a drive named `bootfs`. So, e.g. if this drive has the letter `D:`, `/boot/openhabian.conf` will be found as `D:\openhabian.conf`.
259265

260266
The openHABian configuration file uses key value pairs, essentially a list of `option=value` settings in a plain text file.

functions/system.bash

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ timezone_setting() {
9595
if [[ -n $INTERACTIVE ]]; then
9696
echo -n "$(timestamp) [openHABian] Setting timezone based on user choice... "
9797
if dpkg-reconfigure tzdata; then echo "OK ($(cat /etc/timezone))"; else echo "FAILED"; return 1; fi
98+
echo -n "$(timestamp) [openHABian] Setting openHAB timezone... "
99+
100+
# tz sources order: 1) /etc/openhabian.conf 2) /etc/timezone 3) default UTC
101+
tz=$(cat /etc/timezone 2>/dev/null); timezone=${timezone:=$tz}
102+
if cond_redirect sed -ri "s|^(EXTRA_JAVA_OPTS.*?)(interning=true)?\"|\1\2 -Duser.timezone=${timezone:-UTC}\"|g" /etc/default/openhab; then echo "OK"; else echo "FAILED"; return 1; fi
103+
98104
elif [[ -n $timezone ]]; then
99105
echo -n "$(timestamp) [openHABian] Setting timezone based on openhabian.conf... "
100106
if ! running_in_docker && ! running_on_github; then

0 commit comments

Comments
 (0)