Contents of /trunk/networkmanager/NetworkManagerMagellan.c
Parent Directory | Revision Log
Revision 1502 -
(show annotations)
(download)
Fri Aug 26 18:57:01 2011 UTC (13 years, 1 month ago) by niro
File MIME type: text/plain
File size: 2567 byte(s)
Fri Aug 26 18:57:01 2011 UTC (13 years, 1 month ago) by niro
File MIME type: text/plain
File size: 2567 byte(s)
-added systemd/sysvinit auto-detection support
1 | /* NetworkManager -- Network link manager |
2 | * |
3 | * Backend implementation for the Magellan Linux distribution http://www.magellan-linux.de |
4 | * |
5 | * Niels Rogalla <niro@magellan-linux.de> |
6 | * |
7 | * Heavily based on NetworkManagerGentoo.c by Robert Paskowitz |
8 | * |
9 | * Dan Williams <dcbw@redhat.com> |
10 | * Dan Willemsen <dan@willemsen.us> |
11 | * Robert Paskowitz |
12 | * |
13 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2 of the License, or |
16 | * (at your option) any later version. |
17 | * |
18 | * This program is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU General Public License for more details. |
22 | * |
23 | * You should have received a copy of the GNU General Public License along |
24 | * with this program; if not, write to the Free Software Foundation, Inc., |
25 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
26 | * |
27 | * (C) Copyright 2004 Red Hat, Inc. |
28 | * (C) Copyright 2004 Dan Willemsen |
29 | * (C) Copyright 2004 Robert Paskowitz |
30 | */ |
31 | |
32 | #ifdef HAVE_CONFIG_H |
33 | #include <config.h> |
34 | #endif |
35 | |
36 | #include <stdio.h> |
37 | #include <string.h> |
38 | #include <stdlib.h> |
39 | #include <gio/gio.h> |
40 | |
41 | #include "NetworkManagerGeneric.h" |
42 | #include "nm-system.h" |
43 | #include "NetworkManagerUtils.h" |
44 | #include "nm-logging.h" |
45 | |
46 | #define BUFFER_SIZE 512 |
47 | |
48 | static void sysvinit_start_lo_if_necessary() |
49 | { |
50 | /* No need to run net.lo if it is already running */ |
51 | if (nm_spawn_process ("/etc/rc.d/init.d/localnet status") != 0) |
52 | nm_spawn_process ("/etc/rc.d/init.d/localnet start"); |
53 | } |
54 | |
55 | /* |
56 | * nm_system_enable_loopback |
57 | * |
58 | * Bring up the loopback interface |
59 | * |
60 | */ |
61 | void nm_system_enable_loopback (void) |
62 | { |
63 | gchar *comm = NULL; |
64 | |
65 | if (g_strstr_len (comm, -1, "systemd")) { |
66 | /* We use the generic loopback enabler if using systemd. */ |
67 | nm_log_info (LOGD_CORE, "NetworkManager is running with systemd..."); |
68 | nm_generic_enable_loopback (); |
69 | } else { |
70 | /* SySVInit otherwise. */ |
71 | nm_log_info (LOGD_CORE, "NetworkManager is running with SySVInit..."); |
72 | sysvinit_start_lo_if_necessary(); |
73 | } |
74 | } |
75 | |
76 | /* |
77 | * nm_system_update_dns |
78 | * |
79 | * Make glibc/nscd aware of any changes to the resolv.conf file by |
80 | * restarting nscd. Only restart if already running. |
81 | * |
82 | */ |
83 | void nm_system_update_dns (void) |
84 | { |
85 | if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { |
86 | nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); |
87 | nm_spawn_process ("/usr/sbin/nscd -i hosts"); |
88 | } |
89 | } |
90 |