mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 18:20:29 +01:00
build: unify NetworkManager path handling (some paths are changed)
Use autoconf/automake variables for NetworkManager paths. Use NetworkManager subdirectory where appropriate. Files in /var/run (or /run on some distros) are moved into a separate directory as is usual with other daemons. It makes the filesystem more readable and file prefixing unnecessary. /var/run/NetworkManager.pid -> /var/run/NetworkManager/NetworkManager.pid /var/run/nm-dns-dnsmasq.pid -> /var/run/NetworkManager/dnsmasq.pid /var/run/nm-dns-dnsmasq.conf -> /var/run/NetworkManager/dnsmasq.conf The /var/run/NetworkManager directory is created at runtime, if it doesn't exist. Note: Path-based security policies like SELinux and AppArmor may need to be adapted.
This commit is contained in:
parent
811c87f8ae
commit
d82669d3fd
20 changed files with 52 additions and 46 deletions
|
|
@ -24,7 +24,7 @@ nm_dhcp_client_action_SOURCES = \
|
|||
|
||||
nm_dhcp_client_action_CPPFLAGS = \
|
||||
$(DBUS_CFLAGS) \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
-DNMCONFDIR=\"$(nmconfdir)\" \
|
||||
-DLIBEXECDIR=\"$(libexecdir)\"
|
||||
|
||||
nm_dhcp_client_action_LDADD = $(DBUS_LIBS)
|
||||
|
|
@ -58,7 +58,7 @@ nm_dispatcher_action_CPPFLAGS = \
|
|||
-I${top_builddir}/libnm-util \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
-DNMCONFDIR=\"$(nmconfdir)\" \
|
||||
-DLIBEXECDIR=\"$(libexecdir)\"
|
||||
|
||||
nm_dispatcher_action_LDADD = \
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#include "nm-dispatcher-action.h"
|
||||
#include "nm-dispatcher-utils.h"
|
||||
|
||||
#define NMD_SCRIPT_DIR SYSCONFDIR "/NetworkManager/dispatcher.d"
|
||||
#define NMD_SCRIPT_DIR NMCONFDIR "/dispatcher.d"
|
||||
|
||||
static GMainLoop *loop = NULL;
|
||||
static gboolean debug = FALSE;
|
||||
|
|
|
|||
|
|
@ -99,6 +99,13 @@ dnl Make sha1.c happy on big endian systems
|
|||
dnl
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
# NetworkManager paths
|
||||
AC_SUBST(nmbinary, "$sbindir/$PACKAGE", [NetworkManager binary executable])
|
||||
AC_SUBST(nmconfdir, "$sysconfdir/$PACKAGE", [NetworkManager configuration directory])
|
||||
AC_SUBST(nmdatadir, "$pkgdatadir", [NetworkManager shared data directory])
|
||||
AC_SUBST(nmstatedir, "$localstatedir/lib/$PACKAGE", [NetworkManager persistent state directory])
|
||||
AC_SUBST(nmrundir, "$localstatedir/run/$PACKAGE", [NetworkManager runtime state directory])
|
||||
|
||||
# Alternative configuration plugins
|
||||
AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL)]))
|
||||
AC_ARG_ENABLE(ifcfg-suse, AS_HELP_STRING([--enable-ifcfg-suse], [enable ifcfg-suse configuration plugin (SUSE)]))
|
||||
|
|
@ -291,6 +298,7 @@ case $with_session_tracking in
|
|||
esac
|
||||
AC_SUBST(SYSTEMD_CFLAGS)
|
||||
AC_SUBST(SYSTEMD_LIBS)
|
||||
AC_SUBST(CKDB_PATH, /var/run/ConsoleKit/database)
|
||||
AM_CONDITIONAL(SESSION_TRACKING_CK, test "x$with_session_tracking" = "xck")
|
||||
AM_CONDITIONAL(SESSION_TRACKING_SYSTEMD, test "x$with_session_tracking" = "xsystemd")
|
||||
|
||||
|
|
|
|||
|
|
@ -299,15 +299,21 @@ NetworkManager_CPPFLAGS = \
|
|||
-DDATADIR=\"$(datadir)\" \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
-DLOCALSTATEDIR=\"$(localstatedir)\" \
|
||||
-DNM_RUN_DIR=\"$(rundir)\" \
|
||||
-DNMLOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DNMPLUGINDIR=\"$(pkglibdir)\"
|
||||
-DNMPLUGINDIR=\"$(pkglibdir)\" \
|
||||
-DNMCONFDIR=\"$(nmconfdir)\" \
|
||||
-DNMRUNDIR=\"$(nmrundir)\" \
|
||||
-DNMSTATEDIR=\"$(nmstatedir)\" \
|
||||
-DARP_DEBUG
|
||||
|
||||
if WITH_CONCHECK
|
||||
NetworkManager_CPPFLAGS += $(LIBSOUP_CFLAGS)
|
||||
endif
|
||||
|
||||
if SESSION_TRACKING_CK
|
||||
NetworkManager_CPPFLAGS += -DCKDB_PATH=\"${CKDB_PATH}\"
|
||||
endif
|
||||
|
||||
NetworkManager_LDADD = \
|
||||
./generated/libnm-generated.la \
|
||||
./logging/libnm-logging.la \
|
||||
|
|
@ -345,10 +351,10 @@ nm_crash_logger_SOURCES = nm-crash-logger.c
|
|||
nm_crash_logger_CPPFLAGS = \
|
||||
$(GLIB_CFLAGS) \
|
||||
-DBINDIR=\"$(bindir)\" \
|
||||
-DSBINDIR=\"$(sbindir)\" \
|
||||
-DDATADIR=\"$(datadir)\" \
|
||||
-DNMBINARY=\"$(nmbinary)\" \
|
||||
-DNMDATADIR=\"$(nmdatadir)\" \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
-DLOCALSTATEDIR=\"$(localstatedir)\"
|
||||
-DNMSTATEDIR=\"$(nmstatedir)\"
|
||||
nm_crash_logger_LDADD = $(GLIB_LIBS)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ libdhcp_manager_la_CPPFLAGS = \
|
|||
-DLIBEXECDIR=\"$(libexecdir)\" \
|
||||
-DLOCALSTATEDIR=\"$(localstatedir)\" \
|
||||
-DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \
|
||||
-DDHCPCD_PATH=\"$(DHCPCD_PATH)\"
|
||||
-DDHCPCD_PATH=\"$(DHCPCD_PATH)\" \
|
||||
-DNMSTATEDIR=\"$(nmstatedir)\"
|
||||
|
||||
libdhcp_manager_la_LIBADD = \
|
||||
$(top_builddir)/src/logging/libnm-logging.la \
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ ip4_start (NMDHCPClient *client,
|
|||
iface = nm_dhcp_client_get_iface (client);
|
||||
uuid = nm_dhcp_client_get_uuid (client);
|
||||
|
||||
priv->pid_file = g_strdup_printf (LOCALSTATEDIR "/run/dhcpcd-%s.pid", iface);
|
||||
priv->pid_file = g_strdup_printf (NMSTATEDIR "/dhcpcd-%s.pid", iface);
|
||||
if (!priv->pid_file) {
|
||||
nm_log_warn (LOGD_DHCP4, "(%s): not enough memory for dhcpcd options.", iface);
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ libdns_manager_la_CPPFLAGS = \
|
|||
$(DBUS_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
-DLOCALSTATEDIR=\"$(localstatedir)\" \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
-DNMCONFDIR=\"$(nmconfdir)\" \
|
||||
-DNMRUNDIR=\"$(nmrundir)\"
|
||||
|
||||
libdns_manager_la_LIBADD = \
|
||||
$(top_builddir)/src/logging/libnm-logging.la \
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ G_DEFINE_TYPE (NMDnsDnsmasq, nm_dns_dnsmasq, NM_TYPE_DNS_PLUGIN)
|
|||
|
||||
#define NM_DNS_DNSMASQ_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DNS_DNSMASQ, NMDnsDnsmasqPrivate))
|
||||
|
||||
#define PIDFILE LOCALSTATEDIR "/run/nm-dns-dnsmasq.pid"
|
||||
#define CONFFILE LOCALSTATEDIR "/run/nm-dns-dnsmasq.conf"
|
||||
#define CONFDIR SYSCONFDIR "/NetworkManager/dnsmasq.d"
|
||||
#define PIDFILE NMRUNDIR "/dnsmasq.pid"
|
||||
#define CONFFILE NMRUNDIR "/dnsmasq.conf"
|
||||
#define CONFDIR NMCONFDIR "/dnsmasq.d"
|
||||
|
||||
typedef struct {
|
||||
guint32 foo;
|
||||
|
|
|
|||
25
src/main.c
25
src/main.c
|
|
@ -60,8 +60,8 @@
|
|||
# define NM_DIST_VERSION VERSION
|
||||
#endif
|
||||
|
||||
#define NM_DEFAULT_PID_FILE LOCALSTATEDIR"/run/NetworkManager.pid"
|
||||
#define NM_DEFAULT_SYSTEM_STATE_FILE LOCALSTATEDIR"/lib/NetworkManager/NetworkManager.state"
|
||||
#define NM_DEFAULT_PID_FILE NMRUNDIR "/NetworkManager.pid"
|
||||
#define NM_DEFAULT_SYSTEM_STATE_FILE NMSTATEDIR "/NetworkManager.state"
|
||||
|
||||
/*
|
||||
* Globals
|
||||
|
|
@ -278,24 +278,11 @@ parse_state_file (const char *filename,
|
|||
* users upgrading NM get this working too.
|
||||
*/
|
||||
if (g_error_matches (tmp_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
|
||||
char *data, *dirname;
|
||||
char *data;
|
||||
gsize len = 0;
|
||||
|
||||
g_clear_error (&tmp_error);
|
||||
|
||||
/* try to create the directory if it doesn't exist */
|
||||
dirname = g_path_get_dirname (filename);
|
||||
errno = 0;
|
||||
if (g_mkdir_with_parents (dirname, 0755) != 0) {
|
||||
if (errno != EEXIST) {
|
||||
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_ACCES,
|
||||
"Error creating state directory %s: %s", dirname, strerror(errno));
|
||||
g_free (dirname);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
g_free (dirname);
|
||||
|
||||
/* Write out the initial state to the state file */
|
||||
g_key_file_set_boolean (state_file, "main", "NetworkingEnabled", *net_enabled);
|
||||
g_key_file_set_boolean (state_file, "main", "WirelessEnabled", *wifi_enabled);
|
||||
|
|
@ -442,6 +429,12 @@ main (int argc, char *argv[])
|
|||
*/
|
||||
setenv ("GIO_USE_VFS", "local", 1);
|
||||
|
||||
/* Setup runtime directory */
|
||||
if (g_mkdir_with_parents (NMRUNDIR, 0755) != 0) {
|
||||
nm_log_err (LOGD_CORE, "Cannot create '%s': %s", NMRUNDIR, strerror (errno));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
pidfile = pidfile ? pidfile : g_strdup (NM_DEFAULT_PID_FILE);
|
||||
state_file = state_file ? state_file : g_strdup (NM_DEFAULT_SYSTEM_STATE_FILE);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "nm-config.h"
|
||||
|
||||
#define NM_DEFAULT_SYSTEM_CONF_FILE SYSCONFDIR"/NetworkManager/NetworkManager.conf"
|
||||
#define NM_OLD_SYSTEM_CONF_FILE SYSCONFDIR"/NetworkManager/nm-system-settings.conf"
|
||||
#define NM_DEFAULT_SYSTEM_CONF_FILE NMCONFDIR "/NetworkManager.conf"
|
||||
#define NM_OLD_SYSTEM_CONF_FILE NMCONFDIR "/nm-system-settings.conf"
|
||||
|
||||
struct NMConfig {
|
||||
char *path;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ int main (int argc, char ** argv)
|
|||
char * args[] = { BINDIR "/gdb",
|
||||
"--batch",
|
||||
"--quiet",
|
||||
"--command=" DATADIR "/NetworkManager/gdb-cmd",
|
||||
SBINDIR "/NetworkManager",
|
||||
"--command=" NMDATADIR "/gdb-cmd",
|
||||
NMBINARY,
|
||||
NULL, NULL };
|
||||
|
||||
snprintf (nm_pid, sizeof (nm_pid), "%d", getppid ());
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
#include "nm-session-utils.h"
|
||||
#include "nm-session-monitor.h"
|
||||
|
||||
#define CKDB_PATH "/var/run/ConsoleKit/database"
|
||||
|
||||
/* <internal>
|
||||
* SECTION:nm-session-monitor
|
||||
* @title: NMSessionMonitor
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ libsettings_la_CPPFLAGS = \
|
|||
-DLIBEXECDIR=\"$(libexecdir)\" \
|
||||
-DDATADIR=\"$(datadir)\" \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
-DLOCALSTATEDIR=\"$(localstatedir)\" \
|
||||
-DNMSTATEDIR=\"$(nmstatedir)\" \
|
||||
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
|
||||
-DPLUGINDIR=\"$(pkglibdir)\"
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@
|
|||
#include "nm-agent-manager.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
|
||||
#define SETTINGS_TIMESTAMPS_FILE LOCALSTATEDIR"/lib/NetworkManager/timestamps"
|
||||
#define SETTINGS_SEEN_BSSIDS_FILE LOCALSTATEDIR"/lib/NetworkManager/seen-bssids"
|
||||
#define SETTINGS_TIMESTAMPS_FILE NMSTATEDIR "/timestamps"
|
||||
#define SETTINGS_SEEN_BSSIDS_FILE NMSTATEDIR "/seen-bssids"
|
||||
|
||||
static void impl_settings_connection_get_settings (NMSettingsConnection *connection,
|
||||
DBusGMethodInvocation *context);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ libnm_settings_plugin_example_la_SOURCES = \
|
|||
libnm_settings_plugin_example_la_CPPFLAGS = \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(DBUS_CFLAGS) \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
-DNMCONFDIR=\"$(nmconfdir)\"
|
||||
|
||||
libnm_settings_plugin_example_la_LIBADD = \
|
||||
$(top_builddir)/libnm-util/libnm-util.la \
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#define EXAMPLE_PLUGIN_NAME "example"
|
||||
#define EXAMPLE_PLUGIN_INFO "(c) 2012 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."
|
||||
|
||||
#define EXAMPLE_DIR SYSCONFDIR"/NetworkManager/example-plugin"
|
||||
#define EXAMPLE_DIR NMCONFDIR "/example-plugin"
|
||||
|
||||
/* Boilerplate stuff for the plugin's error domain. Bits of the code that
|
||||
* create new errors in the plugin's domain will create errors of
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <glib.h>
|
||||
|
||||
#define CONF_NET_FILE SYSCONFDIR "/conf.d/net"
|
||||
#define IFNET_SYSTEM_SETTINGS_KEY_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf"
|
||||
#define IFNET_KEY_FILE_GROUP "ifnet"
|
||||
|
||||
gboolean ifnet_init (gchar * config_file);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ libkeyfile_io_la_SOURCES = \
|
|||
libkeyfile_io_la_CPPFLAGS = \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(DBUS_CFLAGS) \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
-DNMCONFDIR=\"$(nmconfdir)\"
|
||||
|
||||
libkeyfile_io_la_LIBADD = $(GLIB_LIBS)
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ libnm_settings_plugin_keyfile_la_SOURCES = \
|
|||
libnm_settings_plugin_keyfile_la_CPPFLAGS = \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(DBUS_CFLAGS) \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
-DNMCONFDIR=\"$(nmconfdir)\"
|
||||
|
||||
libnm_settings_plugin_keyfile_la_LIBADD = \
|
||||
$(top_builddir)/libnm-util/libnm-util.la \
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#define KEYFILE_PLUGIN_NAME "keyfile"
|
||||
#define KEYFILE_PLUGIN_INFO "(c) 2007 - 2010 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."
|
||||
|
||||
#define KEYFILE_DIR SYSCONFDIR "/NetworkManager/system-connections"
|
||||
#define KEYFILE_DIR NMCONFDIR "/system-connections"
|
||||
|
||||
#define VPN_SECRETS_GROUP "vpn-secrets"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ AM_CPPFLAGS = \
|
|||
$(DBUS_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
-DBINDIR=\"$(bindir)\" \
|
||||
-DNM_RUN_DIR=\"$(rundir)\" \
|
||||
-DDATADIR=\"$(datadir)\" \
|
||||
-DNMLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue