mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 17:30:16 +01:00
We don't want that when the user installs the package, that the dispatcher script automatically executes the tool. Instead, the user should use `systemctl enable/disable` to control whether the service is active (of via the timer). Hence, let the dispatcher script check whether the service is enabled. That leads to a different problem, that we need to make it possible for "nm-cloud-setup.service" to be enabled in the first place. As such, add a [Install] section and let it be wanted by NetworkManager.service. The problem with this is that now the tool will run very early, just after NetworkManager started. At that point, it might not yet have setup networking. But that should be acceptable, after all, the tool either fails to fetch meta data that early, or it succeeds. Very likely, it will by aborted by dispatcher's restart command.
9 lines
206 B
Bash
Executable file
9 lines
206 B
Bash
Executable file
#!/bin/sh
|
|
|
|
case "$2" in
|
|
up|dhcp4-change)
|
|
if systemctl -q is-enabled nm-cloud-setup.service ; then
|
|
exec systemctl --no-block restart nm-cloud-setup.service
|
|
fi
|
|
;;
|
|
esac
|