summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-04-25 14:56:25 +0200
committerSimon Rettberg2023-04-25 14:56:25 +0200
commit3b05403baf6ebba969baaf0b6147ca684a61fe49 (patch)
tree237a5e4d62a28d18c67f7efc2d9104a90366fd30
parentMake ask-password removal more sophisticated (diff)
downloadsystemd-init-3b05403baf6ebba969baaf0b6147ca684a61fe49.tar.gz
systemd-init-3b05403baf6ebba969baaf0b6147ca684a61fe49.tar.xz
systemd-init-3b05403baf6ebba969baaf0b6147ca684a61fe49.zip
[slx-clock] Write any output to journal
-rwxr-xr-xmodules.d/slx-clock/module-setup.sh12
-rwxr-xr-xmodules.d/slx-clock/scripts/ntp-sync.sh6
2 files changed, 14 insertions, 4 deletions
diff --git a/modules.d/slx-clock/module-setup.sh b/modules.d/slx-clock/module-setup.sh
index 12533363..d0f2c480 100755
--- a/modules.d/slx-clock/module-setup.sh
+++ b/modules.d/slx-clock/module-setup.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
check() {
- if ! hash ntpdate; then
+ if ! hash ntpd; then
derror "Missing 'ntpdate'. Please install it."
return 1
fi
@@ -12,10 +12,16 @@ depends() {
echo dnbd3-rootfs busybox
}
install() {
+ # see where systemd-cat is installed
+ local sdc_bin="$( command -v systemd-cat )"
+ if [ -z "$sdc_bin" ]; then
+ warn "Could not find systemd-cat in $PATH. Check if its installed."
+ return 1
+ fi
# wait til we have the openslx config for ntp servers
# which happens in pre-mount/10
- inst_multiple /etc/services /usr/share/zoneinfo/Europe/Berlin
- inst /usr/share/zoneinfo/Europe/Berlin /etc/localtime
+ inst_multiple "/etc/services" "/usr/share/zoneinfo/Europe/Berlin" "$sdc_bin"
+ inst "/usr/share/zoneinfo/Europe/Berlin" "/etc/localtime"
inst_hook pre-mount 15 "$moddir/scripts/ntp-sync.sh"
inst_hook pre-pivot 15 "$moddir/scripts/configure-timesyncd.sh"
}
diff --git a/modules.d/slx-clock/scripts/ntp-sync.sh b/modules.d/slx-clock/scripts/ntp-sync.sh
index 81b4b5a3..a533353c 100755
--- a/modules.d/slx-clock/scripts/ntp-sync.sh
+++ b/modules.d/slx-clock/scripts/ntp-sync.sh
@@ -50,7 +50,11 @@ ntp_sync() {
echo "Timesync finished"
}
-ntp_sync
+if command -v systemd-cat > /dev/null; then
+ ntp_sync 2>&1 | systemd-cat
+else
+ ntp_sync
+fi
true