#!/bin/sh -euf

. alterator-service-functions

SERVICES_LIST=/etc/etcnethook-services-restart/services.list

[ "$1" = restart -a -s "$SERVICES_LIST" ] || exit 0
sed 's/#.*$//' "$SERVICES_LIST" | while read SRV; do
	[ -n "$SRV" ] || continue
	# Don't rely on condrestart: service can be dead
	# after restarting network.
	service_exists "$SRV" &&
		service_control "$SRV" is-enabled &&
		service_control "$SRV" restart
done
