summaryrefslogtreecommitdiffstats
path: root/net/travelmate/files/25-travelmate.hotplug
blob: ff3517577d7f9db48745258a0cc1f50df7eec3f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# ntp hotplug script for travelmate
# Copyright (c) 2020-2026 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.

# set (s)hellcheck exceptions
# shellcheck disable=all

trm_init="/etc/init.d/travelmate"
trm_funlib="/usr/lib/travelmate-functions.sh"
trm_ntplock="/var/run/travelmate/travelmate.ntp.lock"

# ensure runtime directory exists
#
[ ! -d "${trm_ntplock%/*}" ] && mkdir -p "${trm_ntplock%/*}"

# check for ntp hotplug event and travelmate service autostart condition
#
if mkdir "${trm_ntplock}" 2>/dev/null; then
	if [ "${ACTION}" = "stratum" ] && "${trm_init}" enabled; then
		. "${trm_funlib}"
		f_log "info" "get ntp time sync"
	fi
fi