1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2025-12-20 02:18:37 +00:00

Make NTP dispatch script executable (#1798) (#1933)

* Make NTP dispatch script executable (#1798)

* Address shellcheck issues
This commit is contained in:
Stefan Agner
2022-05-19 21:47:27 +02:00
committed by GitHub
parent 4a85304427
commit 0c9cfde907

View File

@@ -11,7 +11,7 @@ timesyncd_dhcp_ntp_remove() {
} }
timesyncd_dhcp_ntp_add() { timesyncd_dhcp_ntp_add() {
mkdir -p $(dirname $TIMESYNCD_CONF) mkdir -p "$(dirname $TIMESYNCD_CONF)"
echo '[Time]' > ${TIMESYNCD_CONF} echo '[Time]' > ${TIMESYNCD_CONF}
echo "NTP=${DHCP4_NTP_SERVERS}" >> ${TIMESYNCD_CONF} echo "NTP=${DHCP4_NTP_SERVERS}" >> ${TIMESYNCD_CONF}
@@ -19,12 +19,13 @@ timesyncd_dhcp_ntp_add() {
systemctl restart systemd-timesyncd.service systemctl restart systemd-timesyncd.service
} }
# shellcheck disable=SC2034
INTERFACE=${1} INTERFACE=${1}
ACTION=${2} ACTION=${2}
case ${ACTION} in case ${ACTION} in
up|down|dhcp4-change) up|down|dhcp4-change)
if [ ! -z "${DHCP4_NTP_SERVERS}" ] if [ -n "${DHCP4_NTP_SERVERS}" ]
then then
timesyncd_dhcp_ntp_add timesyncd_dhcp_ntp_add
RETURN_CODE=$? RETURN_CODE=$?
@@ -34,7 +35,7 @@ case ${ACTION} in
fi fi
;; ;;
*) *)
$RETURN_CODE=0 RETURN_CODE=0
;; ;;
esac esac