summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Šimerda <pavlix@pavlix.net>2017-12-28 14:31:06 +0100
committerThomas Haller <thaller@redhat.com>2018-01-09 15:30:09 +0100
commit022c87e4ddd1eea5bf1e07852783752bd02e3f44 (patch)
tree2c35520e92e6dc9c8c8ff509247b2a6ab8a4778d
parent4ff155fa70e11ad2658ddfb0b5df62810494a929 (diff)
downloadNetworkManager-th/pr/52.tar.gz
development: make it possible to run NetworkManager from build directoryth/pr/52
The combination of `./develop.sh` for bootstrap and configuration and the `./NetworkManager` and `./nmcli` makes it easy to build NetworkManager and then run it from the build directory.
-rwxr-xr-xNetworkManager8
-rw-r--r--configure.ac10
-rwxr-xr-xdevelop.sh10
-rwxr-xr-xnmcli10
-rw-r--r--src/devices/nm-device-factory.c7
-rw-r--r--src/dhcp/nm-dhcp-manager.c5
-rw-r--r--src/nm-core-utils.c7
7 files changed, 56 insertions, 1 deletions
diff --git a/NetworkManager b/NetworkManager
new file mode 100755
index 0000000000..c8366eeeb0
--- /dev/null
+++ b/NetworkManager
@@ -0,0 +1,8 @@
+#/bin/sh
+
+command="src/NetworkManager"
+arguments="-d"
+
+ldd $command | grep libnm
+
+$command $arguments "$@"
diff --git a/configure.ac b/configure.ac
index 8afebe4cc5..7f5f735297 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,6 +117,15 @@ AC_SUBST(nmrundir, '${runstatedir}'/$PACKAGE, [NetworkManager runtime state dire
AC_GNU_SOURCE
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
+# Development build for running from the build directory
+AC_ARG_ENABLE(develop, AS_HELP_STRING([--enable-develop], [enable running from the build directory]))
+AS_IF([test -z "$enable_develop"], enable_develop=no)
+if test "$enable_develop" = "yes"; then
+ AC_DEFINE(DEVELOP, 1, [Whether running from build directory is enabled])
+else
+ AC_DEFINE(DEVELOP, 0, [Whether running from build directory is enabled])
+fi
+
# Alternative configuration plugins
AC_ARG_ENABLE(config-plugin-ibft, AS_HELP_STRING([--enable-config-plugin-ibft], [enable ibft configuration plugin]))
AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL)]))
@@ -1384,6 +1393,7 @@ echo " nmrundir: $nmrundir"
echo
echo "Platform:"
+echo " development build: $enable_develop"
echo " session tracking: $session_tracking"
echo " suspend/resume: $with_suspend_resume"
if test "${enable_polkit}" = "yes"; then
diff --git a/develop.sh b/develop.sh
new file mode 100755
index 0000000000..58d1aff16e
--- /dev/null
+++ b/develop.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+exec ./autogen.sh \
+ --enable-develop \
+ --disable-doc --disable-gtk-doc \
+ --disable-polkit \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ "$@"
diff --git a/nmcli b/nmcli
new file mode 100755
index 0000000000..a093ee5b75
--- /dev/null
+++ b/nmcli
@@ -0,0 +1,10 @@
+#/bin/sh
+
+command="./clients/cli/nmcli"
+arguments=""
+
+export LD_LIBRARY_PATH=./libnm/.libs
+
+ldd $command | grep libnm
+
+$command $arguments "$@"
diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c
index d8e303460c..92cb4d34ea 100644
--- a/src/devices/nm-device-factory.c
+++ b/src/devices/nm-device-factory.c
@@ -425,5 +425,12 @@ nm_device_factory_manager_load_factories (NMDeviceFactoryManagerFactoryFunc call
_ADD_INTERNAL (nm_vlan_device_factory_get_type);
_ADD_INTERNAL (nm_vxlan_device_factory_get_type);
+#if DEVELOP
+ load_factories_from_dir ("./src/devices/adsl/.libs", callback, user_data);
+ load_factories_from_dir ("./src/devices/bluetooth/.libs", callback, user_data);
+ load_factories_from_dir ("./src/devices/wifi/.libs", callback, user_data);
+ load_factories_from_dir ("./src/devices/wwan/.libs", callback, user_data);
+#else
load_factories_from_dir (NMPLUGINDIR, callback, user_data);
+#endif
}
diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c
index 020eeed578..e17d9135b7 100644
--- a/src/dhcp/nm-dhcp-manager.c
+++ b/src/dhcp/nm-dhcp-manager.c
@@ -62,8 +62,11 @@ G_DEFINE_TYPE (NMDhcpManager, nm_dhcp_manager, G_TYPE_OBJECT)
/*****************************************************************************/
-/* default to installed helper, but can be modified for testing */
+#if DEVELOP
+const char *nm_dhcp_helper_path = LIBEXECDIR "./src/dhcp/nm-dhcp-helper";
+#else
const char *nm_dhcp_helper_path = LIBEXECDIR "/nm-dhcp-helper";
+#endif
/*****************************************************************************/
diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c
index 197fa49ba9..76d8aad09a 100644
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -4213,12 +4213,19 @@ nm_utils_validate_plugin (const char *path, struct stat *st, GError **error)
return FALSE;
}
+#if DEVELOP
+ /* Do not check plugin ownership when running NetworkManager from the
+ * build directory. It will typically belong to the user who is using
+ * sudo to run NetworkManager as root.
+ */
+#else
if (st->st_uid != 0) {
g_set_error_literal (error,
NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"file has invalid owner (should be root)");
return FALSE;
}
+#endif
if (st->st_mode & (S_IWGRP | S_IWOTH | S_ISUID)) {
g_set_error_literal (error,