diff options
author | Dan Williams <dcbw@redhat.com> | 2008-04-27 15:22:10 +0000 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2008-04-27 15:22:10 +0000 |
commit | 03194ce96df64b16528e80a9bf74c996cada33ea (patch) | |
tree | e431a88f9591f8169581fcaca1e0ec97c23a4754 | |
parent | 74e56e23e8d4fe93445b9d2caa7ba29bd1e6931b (diff) | |
download | NetworkManager-03194ce96df64b16528e80a9bf74c996cada33ea.tar.gz |
2008-04-27 Dan Williams <dcbw@redhat.com>
* Makefile.am
configure.in
dispatcher-daemon/Makefile.am
dispatcher-daemon/NetworkManagerDispatcher.c
initscript/Arch/Makefile.am
initscript/Arch/networkmanager-dispatcher.in
initscript/Gentoo/Makefile.am
initscript/Gentoo/NetworkManagerDispatcher.in
initscript/Mandriva/Makefile.am
initscript/Mandriva/networkmanagerdispatcher.in
initscript/RedHat/Makefile.am
initscript/RedHat/NetworkManagerDispatcher.in
initscript/SUSE/Makefile.am
initscript/SUSE/networkmanager-dispatcher.in
initscript/Slackware/Makefile.am
initscript/Slackware/rc.networkmanager-dispatcher.in
initscript/paldo/Makefile.am
initscript/paldo/NetworkManagerDispatcher.in
man/Makefile.am
man/NetworkManagerDispatcher.8.in
- Remove the dispatcher daemon
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3608 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | configure.in | 9 | ||||
-rw-r--r-- | dispatcher-daemon/.cvsignore | 3 | ||||
-rw-r--r-- | dispatcher-daemon/Makefile.am | 32 | ||||
-rw-r--r-- | dispatcher-daemon/NetworkManagerDispatcher.c | 326 | ||||
-rw-r--r-- | initscript/Arch/Makefile.am | 5 | ||||
-rw-r--r-- | initscript/Arch/networkmanager-dispatcher.in | 54 | ||||
-rw-r--r-- | initscript/Gentoo/Makefile.am | 5 | ||||
-rwxr-xr-x | initscript/Gentoo/NetworkManagerDispatcher.in | 27 | ||||
-rw-r--r-- | initscript/Mandriva/Makefile.am | 5 | ||||
-rw-r--r-- | initscript/Mandriva/networkmanagerdispatcher.in | 88 | ||||
-rw-r--r-- | initscript/RedHat/Makefile.am | 5 | ||||
-rwxr-xr-x | initscript/RedHat/NetworkManagerDispatcher.in | 89 | ||||
-rw-r--r-- | initscript/SUSE/Makefile.am | 6 | ||||
-rw-r--r-- | initscript/SUSE/networkmanager-dispatcher.in | 50 | ||||
-rw-r--r-- | initscript/Slackware/Makefile.am | 5 | ||||
-rw-r--r-- | initscript/Slackware/rc.networkmanager-dispatcher.in | 99 | ||||
-rw-r--r-- | initscript/paldo/Makefile.am | 5 | ||||
-rw-r--r-- | initscript/paldo/NetworkManagerDispatcher.in | 56 | ||||
-rw-r--r-- | man/Makefile.am | 2 | ||||
-rw-r--r-- | man/NetworkManagerDispatcher.8.in | 29 |
22 files changed, 45 insertions, 880 deletions
@@ -1,5 +1,29 @@ 2008-04-27 Dan Williams <dcbw@redhat.com> + * Makefile.am + configure.in + dispatcher-daemon/Makefile.am + dispatcher-daemon/NetworkManagerDispatcher.c + initscript/Arch/Makefile.am + initscript/Arch/networkmanager-dispatcher.in + initscript/Gentoo/Makefile.am + initscript/Gentoo/NetworkManagerDispatcher.in + initscript/Mandriva/Makefile.am + initscript/Mandriva/networkmanagerdispatcher.in + initscript/RedHat/Makefile.am + initscript/RedHat/NetworkManagerDispatcher.in + initscript/SUSE/Makefile.am + initscript/SUSE/networkmanager-dispatcher.in + initscript/Slackware/Makefile.am + initscript/Slackware/rc.networkmanager-dispatcher.in + initscript/paldo/Makefile.am + initscript/paldo/NetworkManagerDispatcher.in + man/Makefile.am + man/NetworkManagerDispatcher.8.in + - Remove the dispatcher daemon + +2008-04-27 Dan Williams <dcbw@redhat.com> + * callouts/Makefile.am callouts/nm-dispatcher-action.c callouts/nm-dispatcher-action.h diff --git a/Makefile.am b/Makefile.am index d889e310d1..cd4d3e4650 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,7 +26,6 @@ SUBDIRS = \ libnm-util \ libnm-glib \ src \ - dispatcher-daemon \ initscript \ test \ po \ diff --git a/configure.in b/configure.in index caab4a7b72..95e430a268 100644 --- a/configure.in +++ b/configure.in @@ -301,7 +301,6 @@ libnm-util/Makefile libnm-glib/libnm_glib.pc libnm-glib/Makefile callouts/Makefile -dispatcher-daemon/Makefile tools/Makefile system-settings/Makefile system-settings/src/Makefile @@ -314,30 +313,22 @@ test/test-common/Makefile initscript/Makefile initscript/RedHat/Makefile initscript/RedHat/NetworkManager -initscript/RedHat/NetworkManagerDispatcher initscript/Gentoo/Makefile initscript/Gentoo/NetworkManager -initscript/Gentoo/NetworkManagerDispatcher initscript/Debian/Makefile initscript/Slackware/Makefile initscript/Slackware/rc.networkmanager -initscript/Slackware/rc.networkmanager-dispatcher initscript/SUSE/Makefile initscript/SUSE/networkmanager -initscript/SUSE/networkmanager-dispatcher initscript/Arch/Makefile initscript/Arch/networkmanager -initscript/Arch/networkmanager-dispatcher initscript/paldo/Makefile initscript/paldo/NetworkManager -initscript/paldo/NetworkManagerDispatcher initscript/Mandriva/Makefile initscript/Mandriva/networkmanager -initscript/Mandriva/networkmanagerdispatcher introspection/Makefile man/Makefile man/NetworkManager.8 -man/NetworkManagerDispatcher.8 man/nm-tool.1 po/Makefile.in NetworkManager.pc diff --git a/dispatcher-daemon/.cvsignore b/dispatcher-daemon/.cvsignore deleted file mode 100644 index 08dd975ef3..0000000000 --- a/dispatcher-daemon/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in -NetworkManagerDispatcher diff --git a/dispatcher-daemon/Makefile.am b/dispatcher-daemon/Makefile.am deleted file mode 100644 index 3d7adbc341..0000000000 --- a/dispatcher-daemon/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -NULL= - -sbin_PROGRAMS = NetworkManagerDispatcher - -NetworkManagerDispatcher_SOURCES = \ - NetworkManagerDispatcher.c \ - $(NULL) - -NetworkManagerDispatcher_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -DDBUS_API_SUBJECT_TO_CHANGE \ - -DBINDIR=\"$(bindir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLOCALSTATEDIR=\"$(localstatedir)\" \ - $(NULL) - -NetworkManagerDispatcher_CFLAGS = \ - $(DBUS_CFLAGS) \ - $(GTHREAD_CFLAGS) \ - -Wall \ - $(NULL) - -NetworkManagerDispatcher_LDADD = \ - $(top_builddir)/libnm-util/libnm-util.la\ - $(top_builddir)/libnm-glib/libnm_glib.la\ - $(DBUS_LIBS) \ - $(GTHREAD_LIBS) \ - $(NULL) diff --git a/dispatcher-daemon/NetworkManagerDispatcher.c b/dispatcher-daemon/NetworkManagerDispatcher.c deleted file mode 100644 index ee8250b26f..0000000000 --- a/dispatcher-daemon/NetworkManagerDispatcher.c +++ /dev/null @@ -1,326 +0,0 @@ -/* NetworkManagerDispatcher -- Dispatches messages from NetworkManager - * - * Dan Williams <dcbw@redhat.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * (C) Copyright 2004 Red Hat, Inc. - */ - -#include <glib.h> -#include <glib-object.h> -#include <dbus/dbus.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <dbus/dbus-glib.h> -#include <getopt.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <syslog.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <dirent.h> -#include <string.h> - -#include "NetworkManager.h" -#include "nm-utils.h" -#include "nm-client.h" - - -#define NM_SCRIPT_DIR SYSCONFDIR"/NetworkManager/dispatcher.d" - -#define NMD_DEFAULT_PID_FILE LOCALSTATEDIR"/run/NetworkManagerDispatcher.pid" - -GHashTable *device_signals_hash; - -/* - * nmd_permission_check - * - * Verify that the given script has the permissions we want. Specifically, - * ensure that the file is - * - A regular file. - * - Owned by root. - * - Not writable by the group or by other. - * - Not setuid. - * - Executable by the owner. - * - */ -static inline gboolean -nmd_permission_check (struct stat *s) -{ - if (!S_ISREG (s->st_mode)) - return FALSE; - if (s->st_uid != 0) - return FALSE; - if (s->st_mode & (S_IWGRP|S_IWOTH|S_ISUID)) - return FALSE; - if (!(s->st_mode & S_IXUSR)) - return FALSE; - return TRUE; -} - - -/* - * nmd_is_valid_filename - * - * Verify that the given script is a valid file name. Specifically, - * ensure that the file: - * - is not a editor backup file - * - is not a package management file - * - does not start with '.' - */ -static inline gboolean -nmd_is_valid_filename (const char *file_name) -{ - char *bad_suffixes[] = { "~", ".rpmsave", ".rpmorig", ".rpmnew", NULL }; - char *tmp; - int i; - - if (file_name[0] == '.') - return FALSE; - for (i = 0; bad_suffixes[i]; i++) { - if (g_str_has_suffix(file_name, bad_suffixes[i])) - return FALSE; - } - tmp = g_strrstr(file_name, ".dpkg-"); - if (tmp && (tmp == strrchr(file_name,'.'))) - return FALSE; - return TRUE; -} - -static gint -sort_files (gconstpointer a, gconstpointer b) -{ - char *a_base = NULL, *b_base = NULL; - int ret = 0; - - if (a && !b) - return 1; - if (!a && !b) - return 0; - if (!a && b) - return -1; - - a_base = g_path_get_basename (a); - b_base = g_path_get_basename (b); - - ret = strcmp (a_base, b_base); - - g_free (a_base); - g_free (b_base); - return ret; -} - -/* - * nmd_execute_scripts - * - * Call scripts in /etc/NetworkManager.d when devices go down or up - * - */ -static void -nmd_execute_scripts (NMDeviceState state, const char *iface_name) -{ - GDir *dir; - const char *filename; - char *act = NULL; - GSList *scripts = NULL, *iter; - GError *error = NULL; - - if (state == NM_DEVICE_STATE_ACTIVATED) - act = "up"; - else if (state == NM_DEVICE_STATE_DISCONNECTED) - act = "down"; - else - return; - - nm_info ("Device %s is now %s.", iface_name, act); - - if (!(dir = g_dir_open (NM_SCRIPT_DIR, 0, &error))) { - nm_warning ("g_dir_open() could not open '" NM_SCRIPT_DIR "'. '%s'", - error->message); - g_error_free (error); - return; - } - - while ((filename = g_dir_read_name (dir))) { - char *file_path = g_build_filename (NM_SCRIPT_DIR, filename, NULL); - struct stat s; - - if (nmd_is_valid_filename(filename) && !stat (file_path, &s) && nmd_permission_check (&s)) - scripts = g_slist_insert_sorted (scripts, file_path, sort_files); - else - g_free (file_path); - } - g_dir_close (dir); - - for (iter = scripts; iter; iter = g_slist_next (iter)) { - char *cmd; - int ret; - - cmd = g_strdup_printf ("%s %s %s", (char *) iter->data, iface_name, act); - ret = system (cmd); - if (ret == -1) - nm_warning ("system() failed with errno = %d", errno); - g_free (cmd); - } - - g_slist_foreach (scripts, (GFunc) g_free, NULL); - g_slist_free (scripts); -} - -static void -device_state_changed (NMDevice *device, GParamSpec *pspec, gpointer user_data) -{ - NMDeviceState state; - - state = nm_device_get_state (device); - if (state == NM_DEVICE_STATE_ACTIVATED || state == NM_DEVICE_STATE_DISCONNECTED) - nmd_execute_scripts (state, nm_device_get_iface (device)); -} - -static void -device_add_listener (NMClient *client, NMDevice *device, gpointer user_data) -{ - guint id; - - if (!g_hash_table_lookup (device_signals_hash, device)) { - id = g_signal_connect (device, "notify::state", - G_CALLBACK (device_state_changed), - NULL); - - g_hash_table_insert (device_signals_hash, g_object_ref (device), GUINT_TO_POINTER (id)); - } -} - -static void -device_remove_listener (NMClient *client, NMDevice *device, gpointer user_data) -{ - guint id; - - id = GPOINTER_TO_UINT (g_hash_table_lookup (device_signals_hash, device)); - if (id) { - g_signal_handler_disconnect (device, id); - g_hash_table_remove (device_signals_hash, device); - } -} - -static void -add_existing_device_listeners (NMClient *client) -{ - const GPtrArray *devices; - int i; - - devices = nm_client_get_devices (client); - for (i = 0; devices && (i < devices->len); i++) - device_add_listener (client, g_ptr_array_index (devices, i), NULL); -} - -static void -write_pidfile (const char *pidfile) -{ - char pid[16]; - int fd; - - if ((fd = open (pidfile, O_CREAT|O_WRONLY|O_TRUNC, 00644)) < 0) - { - nm_warning ("Opening %s failed: %s", pidfile, strerror (errno)); - return; - } - snprintf (pid, sizeof (pid), "%d", getpid ()); - if (write (fd, pid, strlen (pid)) < 0) - nm_warning ("Writing to %s failed: %s", pidfile, strerror (errno)); - if (close (fd)) - nm_warning ("Closing %s failed: %s", pidfile, strerror (errno)); -} - - -/* - * main - * - */ -int -main (int argc, char *argv[]) -{ - GError *err = NULL; - GOptionContext *opt_ctx; - GMainLoop *loop; - int ret = EXIT_FAILURE; - NMClient *client; - gboolean no_daemon = FALSE; - char *pidfile = NMD_DEFAULT_PID_FILE; - - GOptionEntry entries[] = { - { "no-daemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, "Do not daemonize", NULL }, - { "pid-file", 0, 0, G_OPTION_ARG_FILENAME, &pidfile, "Specify the location of a PID file", "filename" }, - { NULL } - }; - - opt_ctx = g_option_context_new (NULL); - g_option_context_set_summary (opt_ctx, - "NetworkManagerDispatcher listens for device messages from NetworkManager\n" - "and runs scripts in " NM_SCRIPT_DIR); - g_option_context_add_main_entries (opt_ctx, entries, NULL); - - if (!g_option_context_parse (opt_ctx, &argc, &argv, &err)) { - g_print ("%s\n", err->message); - g_error_free (err); - goto out; - } - - openlog ("NetworkManagerDispatcher", - (no_daemon) ? LOG_CONS | LOG_PERROR : LOG_CONS, - (no_daemon) ? LOG_USER : LOG_DAEMON); - - if (!no_daemon) { - if (daemon (FALSE, FALSE) < 0) { - nm_warning ("NetworkManagerDispatcher could not daemonize: %s", strerror (errno)); - goto out; - } - - write_pidfile (pidfile); - } - - g_type_init (); - - client = nm_client_new (); - if (!client) - goto out; - - device_signals_hash = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL); - - g_signal_connect (client, "device-added", - G_CALLBACK (device_add_listener), NULL); - g_signal_connect (client, "device-removed", - G_CALLBACK (device_remove_listener), NULL); - - add_existing_device_listeners (client); - - loop = g_main_loop_new (NULL, FALSE); - g_main_loop_run (loop); - g_main_loop_unref (loop); - g_object_unref (client); - g_hash_table_destroy (device_signals_hash); - - ret = EXIT_SUCCESS; - - out: - g_option_context_free (opt_ctx); - closelog (); - unlink (pidfile); - - return ret; -} diff --git a/initscript/Arch/Makefile.am b/initscript/Arch/Makefile.am index b611ead672..2c1f8b54e8 100644 --- a/initscript/Arch/Makefile.am +++ b/initscript/Arch/Makefile.am @@ -1,4 +1,5 @@ -EXTRA_DIST = networkmanager networkmanager-dispatcher +EXTRA_DIST = networkmanager +DISTCLEANFILES = networkmanager initddir = $(sysconfdir)/rc.d -initd_SCRIPTS = networkmanager networkmanager-dispatcher +initd_SCRIPTS = networkmanager diff --git a/initscript/Arch/networkmanager-dispatcher.in b/initscript/Arch/networkmanager-dispatcher.in deleted file mode 100644 index cfb0fafcd9..0000000000 --- a/initscript/Arch/networkmanager-dispatcher.in +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -prefix=@prefix@ -exec_prefix=@prefix@ -sbindir=@sbindir@ -NETWORKMANAGER_BIN=${sbindir}/NetworkManagerDispatcher - -# general config -. /etc/rc.conf -. /etc/rc.d/functions - -# Sanity checks. -[ -x $NETWORKMANAGER_BIN ] || exit 0 - -# We need /usr/sbin/ip -[ -x /usr/sbin/ip ] || exit 0 - -PID=`pidof -o %PPID $NETWORKMANAGER_BIN` -case "$1" in - start) - stat_busy "Starting NetworkManagerDispatcher" - if [ -z "$PID" ]; then - $NETWORKMANAGER_BIN - fi - if [ ! -z "$PID" -o $? -gt 0 ]; then - stat_fail - else - add_daemon networkmanager-dispatcher - stat_done - fi - ;; - stop) - stat_busy "Stopping NetworkManagerDispatcher" - [ ! -z "$PID" ] && kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon networkmanager-dispatcher - stat_done - fi - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" - ;; -esac -exit 0 - - - diff --git a/initscript/Gentoo/Makefile.am b/initscript/Gentoo/Makefile.am index 93a0f3da31..af023b7539 100644 --- a/initscript/Gentoo/Makefile.am +++ b/initscript/Gentoo/Makefile.am @@ -1,4 +1,5 @@ -EXTRA_DIST = NetworkManager NetworkManagerDispatcher +EXTRA_DIST = NetworkManager +DISTCLEANFILES = NetworkManager initddir = $(sysconfdir)/init.d -initd_SCRIPTS = NetworkManager NetworkManagerDispatcher +initd_SCRIPTS = NetworkManager diff --git a/initscript/Gentoo/NetworkManagerDispatcher.in b/initscript/Gentoo/NetworkManagerDispatcher.in deleted file mode 100755 index 8165275d38..0000000000 --- a/initscript/Gentoo/NetworkManagerDispatcher.in +++ /dev/null @@ -1,27 +0,0 @@ -#!/sbin/runscript -# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org> -# Distributed under the terms of the GNU General Purpose License v2 -# $Header: $ - -depend() { - need NetworkManager -} - -start() { - ebegin "Starting NetworkManagerDispatcher" - start-stop-daemon --start --quiet --pidfile /var/run/NetworkManagerDispatcher.pid --exec /usr/sbin/NetworkManagerDispatcher - eend $? -} - -stop() { - local retval - - ebegin "Stopping NetworkManagerDispatcher" - start-stop-daemon --stop --quiet --pidfile /var/run/NetworkManagerDispatcher.pid - retval=$? - eend ${retval} - - [ -e /var/run/NetworkManagerDispatcher.pid ] && rm -f /var/run/NetworkManagerDispatcher.pid -} - -# vim: set ft=gentoo-init-d ts=3 sw=3 et: diff --git a/initscript/Mandriva/Makefile.am b/initscript/Mandriva/Makefile.am index 3c1533f483..0a0cc2bb3e 100644 --- a/initscript/Mandriva/Makefile.am +++ b/initscript/Mandriva/Makefile.am @@ -1,5 +1,6 @@ -EXTRA_DIST = networkmanager networkmanagerdispatcher +EXTRA_DIST = networkmanager +DISTCLEANFILES = networkmanager initddir = $(sysconfdir)/rc.d/init.d -initd_SCRIPTS = networkmanager networkmanagerdispatcher +initd_SCRIPTS = networkmanager diff --git a/initscript/Mandriva/networkmanagerdispatcher.in b/initscript/Mandriva/networkmanagerdispatcher.in deleted file mode 100644 index b4bc5f53da..0000000000 --- a/initscript/Mandriva/networkmanagerdispatcher.in +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -# -# NetworkManager: NetworkManagerDispatcher daemon -# -# chkconfig: - 98 02 -# description: This daemon automatically runs scripts when NetworkManager \ -# changes the network state. -# -# processname: NetworkManagerDispatcher -# pidfile: /var/run/NetworkManager/NetworkManagerDispatcher.pid -# -### BEGIN INIT INFO -# Provides: networkmanagerdispatcher -# Required-Start: networkmanager -# Required-Stop: networkmanager -# Default-Start: 3 4 5 -# Short-Description: Daemon for automatically running scripts at change of network state -# Description: This daemon automatically runs scripts when NetworkManager -# changes the network state. -### END INIT INFO - -prefix=@prefix@ -exec_prefix=@prefix@ -sbindir=@sbindir@ - -NETWORKMANAGERDISPATCHER_BIN=${sbindir}/NetworkManagerDispatcher - -# Sanity checks. -[ -x $NETWORKMANAGERDISPATCHER_BIN ] || exit 1 - -# Source function library. -. /etc/rc.d/init.d/functions - -# so we can rearrange this easily -processname=NetworkManagerDispatcher -servicename=NetworkManagerDispatcher -pidfile=/var/run/NetworkManager/NetworkManagerDispatcher.pid - -RETVAL=0 - -start() -{ - echo -n $"Starting NetworkManagerDispatcher daemon: " - daemon --check $servicename $processname --pid-file=$pidfile - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename -} - -stop() -{ - echo -n $"Stopping NetworkManagerDispatcher daemon: " - killproc $servicename -TERM - RETVAL=$? - echo - if [ $RETVAL -eq 0 ]; then - rm -f /var/lock/subsys/$servicename - rm -f $pidfile - fi -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status -p $pidfile $processname - RETVAL=$? - ;; - restart) - stop - start - ;; - condrestart) - if [ -f /var/lock/subsys/$servicename ]; then - stop - start - fi - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart}" - ;; -esac -exit $RETVAL diff --git a/initscript/RedHat/Makefile.am b/initscript/RedHat/Makefile.am index 8796239a30..3f7b876b7c 100644 --- a/initscript/RedHat/Makefile.am +++ b/initscript/RedHat/Makefile.am @@ -1,5 +1,6 @@ -EXTRA_DIST = NetworkManager NetworkManagerDispatcher +EXTRA_DIST = NetworkManager +DISTCLEANFILES = NetworkManager initddir = $(sysconfdir)/rc.d/init.d -initd_SCRIPTS = NetworkManager NetworkManagerDispatcher +initd_SCRIPTS = NetworkManager diff --git a/initscript/RedHat/NetworkManagerDispatcher.in b/initscript/RedHat/NetworkManagerDispatcher.in deleted file mode 100755 index 8f35c7792f..0000000000 --- a/initscript/RedHat/NetworkManagerDispatcher.in +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# -# NetworkManager: NetworkManagerDispatcher daemon -# -# chkconfig: - 28 72 -# description: This daemon automatically runs scripts when NetworkManager \ -# changes the network state. -# -# processname: NetworkManagerDispatcher -# pidfile: /var/run/NetworkManager/NetworkManagerDispatcher.pid -# -### BEGIN INIT INFO -# Provides: network_manager_dispatcher -# Required-Start: network_manager messagebus -# Required-Stop: network_manager messagebus -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: start and stop NetworkManagerDispatcher -# Description: NetworkManagerDispatcher is a tool for running scripts triggered \ -# by network events -### END INIT INFO - -prefix=@prefix@ -exec_prefix=@prefix@ -sbindir=@sbindir@ - -NETWORKMANAGERDISPATCHER_BIN=${sbindir}/NetworkManagerDispatcher - -# Sanity checks. -[ -x $NETWORKMANAGERDISPATCHER_BIN ] || exit 1 - -# Source function library. -. /etc/rc.d/init.d/functions - -# so we can rearrange this easily -processname=NetworkManagerDispatcher -servicename=NetworkManagerDispatcher -pidfile=/var/run/NetworkManager/NetworkManagerDispatcher.pid - -RETVAL=0 - -start() -{ - echo -n $"Starting NetworkManagerDispatcher daemon: " - daemon --check $servicename $processname --pid-file=$pidfile - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename -} - -stop() -{ - echo -n $"Stopping NetworkManagerDispatcher daemon: " - killproc $servicename -TERM - RETVAL=$? - echo - if [ $RETVAL -eq 0 ]; then - rm -f /var/lock/subsys/$servicename - rm -f $pidfile - fi -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status -p $pidfile $processname - RETVAL=$? - ;; - restart) - stop - start - ;; - condrestart) - if [ -f /var/lock/subsys/$servicename ]; then - stop - start - fi - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart}" - ;; -esac -exit $RETVAL diff --git a/initscript/SUSE/Makefile.am b/initscript/SUSE/Makefile.am index 59c1370d3e..75a7c2acd8 100644 --- a/initscript/SUSE/Makefile.am +++ b/initscript/SUSE/Makefile.am @@ -1,8 +1,8 @@ -EXTRA_DIST = networkmanager.in networkmanager-dispatcher.in -DISTCLEANFILES = networkmanager networkmanager-dispatcher +EXTRA_DIST = networkmanager.in +DISTCLEANFILES = networkmanager # Nowadays, NetworkManager support is built-in to the SUSE networking # subsystem, therefore a SUSE machine does not want these scripts. Uncomment # this if you actually want external initscripts, such as SUSE 10.0 or earlier. #initddir = $(sysconfdir)/init.d -#initd_SCRIPTS = networkmanager networkmanager-dispatcher +#initd_SCRIPTS = networkmanager diff --git a/initscript/SUSE/networkmanager-dispatcher.in b/initscript/SUSE/networkmanager-dispatcher.in deleted file mode 100644 index 5eda576e46..0000000000 --- a/initscript/SUSE/networkmanager-dispatcher.in +++ /dev/null @@ -1,50 +0,0 @@ -#! /bin/sh - -### BEGIN INIT INFO -# Provides: networkmanager-dispatcher -# Required-Start: dbus haldaemon networkmanager -# Default-Start: 3 5 -# Default-Stop: -# Description: NetworkManagerDispatcher responds to network events -### END INIT INFO - -sbindir=@sbindir@ - -NETWORKMANAGER_BIN=${sbindir}/NetworkManagerDispatcher -test -x $NETWORKMANAGER_BIN || exit 5 - -. /etc/rc.status -rc_reset - -case "$1" in - start) - checkproc $NETWORKMANAGER_BIN - if [ $? = 0 ]; then - echo -n "NetworkManagerDispatcher already running" - rc_status -v - rc_exit - fi - echo -n "Starting the NetworkManagerDispatcher" - startproc $NETWORKMANAGER_BIN - rc_status -v - ;; - stop) - echo -n "Shutting down the NetworkManagerDispatcher" - killproc -TERM $NETWORKMANAGER_BIN - rc_status -v - ;; - restart) - $0 stop - $0 start - rc_status - ;; - status) - echo -n "Checking for the NetworkManagerDispatcher: " - checkproc $NETWORKMANAGER_BIN - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|restart}" - exit 1 - ;; -esac diff --git a/initscript/Slackware/Makefile.am b/initscript/Slackware/Makefile.am index 70c508ff5b..ded3ee0997 100644 --- a/initscript/Slackware/Makefile.am +++ b/initscript/Slackware/Makefile.am @@ -1,5 +1,6 @@ -EXTRA_DIST = rc.networkmanager rc.networkmanager-dispatcher +EXTRA_DIST = rc.networkmanager +DISTCLEANFILES = rc.networkmanager initddir = $(sysconfdir)/rc.d -initd_SCRIPTS = rc.networkmanager rc.networkmanager-dispatcher +initd_SCRIPTS = rc.networkmanager diff --git a/initscript/Slackware/rc.networkmanager-dispatcher.in b/initscript/Slackware/rc.networkmanager-dispatcher.in deleted file mode 100644 index 72e5b4ab6e..0000000000 --- a/initscript/Slackware/rc.networkmanager-dispatcher.in +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -# -# NetworkManagerDispatcher: NetworkManagerDispatcher daemon -# -# description: This is a daemon for automatically switching network \ -# connections to the best available connection. \ -# -# processname: NetworkManagerDispatcher -# pidfile: /var/run/NetworkManagerDispatcher.pid -# - -prefix=@prefix@ -exec_prefix=@prefix@ -sbindir=@sbindir@ - -NETWORKMANAGER_BIN=${sbindir}/NetworkManagerDispatcher - -# Sanity checks. -[ -x $NETWORKMANAGER_BIN ] || exit 0 - -# We need /sbin/ip -[ -x /sbin/ip ] || exit 0 - -PIDFILE=/var/run/NetworkManagerDispatcher.pid - -nm_start() -{ - if [ "`pgrep dbus-daemon`" = "" ]; then - echo "D-BUS must be running to start NetworkManagerDispatcher" - return - fi - - if [ "`pgrep hald`" = "" ]; then - echo "HAL must be running to start NetworkManagerDispatcher" - return - fi - - # Just in case the pidfile is still there, we may need to nuke it. - if [ -e "$PIDFILE" ]; then - rm -f $PIDFILE - fi - - echo "Starting NetworkManagerDispatcher daemon: $NETWORKMANAGER_BIN" - $NETWORKMANAGER_BIN -} - -nm_status() -{ - local pidlist=`cat $PIDFILE 2>/dev/null` - if [ -z "$pidlist" ]; then - return 1 - fi - local command=`ps -p $pidlist -o comm=` - if [ "$command" != 'NetworkManagerDispatcher' ]; then - return 1 - fi -} - -nm_stop() -{ - echo -en "Stopping NetworkManagerDispatcher: " - local pidlist=`cat $PIDFILE 2>/dev/null` - if [ ! -z "$pidlist" ]; then - kill $pidlist &>/dev/null - rm -f $PIDFILE &>/dev/null - fi - echo "stopped"; -} - -nm_restart() -{ - nm_stop - nm_start -} - -case "$1" in -'start') - if ( ! nm_status ); then - nm_start - else - echo "NetworkManagerDispatcher is already running (will not start it twice)." - fi - ;; -'stop') - nm_stop - ;; -'restart') - nm_restart - ;; -'status') - if ( nm_status ); then - echo "NetworkManagerDispatcher is currently running" - else - echo "NetworkManagerDispatcher is not running." - fi - ;; -*) - echo "usage $0 start|stop|status|restart" -esac diff --git a/initscript/paldo/Makefile.am b/initscript/paldo/Makefile.am index 2f965bb367..3d67ff6e6a 100644 --- a/initscript/paldo/Makefile.am +++ b/initscript/paldo/Makefile.am @@ -1,5 +1,6 @@ -EXTRA_DIST = NetworkManager NetworkManagerDispatcher +EXTRA_DIST = NetworkManager +DISTCLEANFILES = NetworkManager initddir = $(sysconfdir)/init.d -initd_SCRIPTS = NetworkManager NetworkManagerDispatcher +initd_SCRIPTS = NetworkManager diff --git a/initscript/paldo/NetworkManagerDispatcher.in b/initscript/paldo/NetworkManagerDispatcher.in deleted file mode 100644 index 01fdb3eb03..0000000000 --- a/initscript/paldo/NetworkManagerDispatcher.in +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -### BEGIN INIT INFO -# Provides: NetworkManagerDispatcher -# Required-Start: $network dbus -# Required-Stop: $network dbus -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -### END INIT INFO -. /lib/lsb/init-functions - -[ -e /etc/default/NetworkManager ] && source /etc/default/NetworkManager -[ $(/usr/bin/tty -s; echo $?) -gt 0 -o "$(/usr/bin/tty)" == "/dev/console" ] && [ "$START_NETWORK_MANAGER" != "TRUE" ] && exit 0 - -prefix=@prefix@ -exec_prefix=@prefix@ -sbindir=@sbindir@ - -case "$1" in - start) - echo -n "Starting NetworkManagerDispatcher..." - if start_daemon $sbindir/NetworkManagerDispatcher - then - log_success_msg - else - log_failure_msg - fi - ;; - stop) - echo -n "Stopping NetworkManagerDispatcher..." - if killproc $sbindir/NetworkManagerDispatcher - then - log_success_msg "." - else - log_failure_msg - fi - ;; - restart|force-reload) - $0 stop - sleep 1 - $0 start - ;; - try-restart) - if pidofproc $sbindir/NetworkManagerDispatcher - then - $0 restart - fi - ;; - status) - pidofproc $sbindir/NetworkManagerDispatcher - exit $? - ;; - *) - echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}" - exit 1 - ;; -esac diff --git a/man/Makefile.am b/man/Makefile.am index fcf9e09e99..c3000d78aa 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,10 +1,8 @@ man_MANS = \ NetworkManager.8 \ - NetworkManagerDispatcher.8 \ nm-tool.1 EXTRA_DIST = \ $(man_MANS) \ NetworkManager.8.in \ - NetworkManagerDispatcher.8.in \ nm-tool.1.in diff --git a/man/NetworkManagerDispatcher.8.in b/man/NetworkManagerDispatcher.8.in deleted file mode 100644 index d2896b8bab..0000000000 --- a/man/NetworkManagerDispatcher.8.in +++ /dev/null @@ -1,29 +0,0 @@ -.\" NetworkManager(8) manual page -.\" -.\" Copyright (C) 2005 Robert Love -.\" -.TH NETWORKMANAGERDISPATCHER "8" -.SH NAME -NetworkManagerDispatcher \- daemon that runs commands in response to off/online -.SH SYNOPSIS -.B NetworkManagerDispatcher [\-\-no-daemon] -.SH DESCRIPTION -The \fINetworkManagerDispatcher\fP daemon runs commands in the -.I @sysconfdir@/NetworkManager/dispatcher.d -directory in response to interfaces coming up and down. The scripts are run -alphabetically. The first parameter is the network interface name. The second -parameter is -.I up -if the interface is now up and -.I down -if the interface is now down. -.SH OPTIONS -The following options are supported: -.TP -.I "--no-daemon" -Do not daemonize. This is useful for debugging. -.SH FILES -@sysconfdir@/NetworkManager/dispatcher.d -.SH SEE ALSO -.BR NetworkManager (8), -.BR nm-tool (1) |