summaryrefslogtreecommitdiff
path: root/callouts
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2008-10-08 22:40:42 +0000
committerDan Williams <dcbw@redhat.com>2008-10-08 22:40:42 +0000
commit1182e8579b3a60a993681a50929ebf944c10d9ac (patch)
tree6e1d95322ff3a685223f6e2c4b577a1388de667d /callouts
parent5a5d03290128c6089ba7bc4d2c33e265338e9028 (diff)
2008-10-08 Dan Williams <dcbw@redhat.com>
Add a 'hostname' dispatcher action triggered on hostname changes (bgo #552983) * src/NetworkManagerUtils.c - (nm_utils_call_dispatcher): add a 'hostname' action * src/NetworkManagerPolicy.c - (set_system_hostname): dispatch hostname changes * callouts/nm-dispatcher-action.c - (nm_dispatcher_action): handle 'hostname' actions git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4158 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Diffstat (limited to 'callouts')
-rw-r--r--callouts/nm-dispatcher-action.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c
index 1c47ca2099..ef082dc242 100644
--- a/callouts/nm-dispatcher-action.c
+++ b/callouts/nm-dispatcher-action.c
@@ -361,7 +361,7 @@ construct_envp (NMIP4Config *ip4_config, NMDHCP4Config *dhcp4_config)
if (debug) {
char **p;
- g_message ("-----------------------------------------");
+ g_message ("------------ Script Environment ------------");
for (p = envp; *p; p++)
g_message (" %s", *p);
g_message ("\n");
@@ -427,10 +427,13 @@ dispatch_scripts (const char *action,
gint status = -1;
argv[0] = (char *) iter->data;
- argv[1] = (char *) iface;
+ argv[1] = iface ? (char *) iface : "none";
argv[2] = (char *) action;
argv[3] = NULL;
+ if (debug)
+ g_message ("Script: %s %s %s", (char *) iter->data, iface ? (char *) iface : "(none)", (char *) action);
+
error = NULL;
if (g_spawn_sync ("/", argv, envp, 0, child_setup, NULL, NULL, NULL, &status, &error)) {
if (WIFEXITED (status)) {
@@ -488,6 +491,10 @@ nm_dispatcher_action (Handler *h,
*error = NULL;
}
+ /* Hostname changes don't require a device */
+ if (!strcmp (action, "hostname"))
+ goto dispatch;
+
/* interface name */
value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_INTERFACE);
if (!value || !G_VALUE_HOLDS_STRING (value)) {
@@ -537,6 +544,7 @@ nm_dispatcher_action (Handler *h,
ip4_config = nm_device_get_ip4_config (device);
}
+dispatch:
dispatch_scripts (action, iface, parent_iface, type, ip4_config, dhcp4_config);
if (device)