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
parent 9856c9523b
commit def80b9bbc
No known key found for this signature in database
GPG Key ID: AE01353D1E44747D

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