diff options
Diffstat (limited to 'user')
-rw-r--r-- | user/networkmanager/01-org.freedesktop.NetworkManager.rules | 7 | ||||
-rw-r--r-- | user/networkmanager/10-openrc-status | 35 | ||||
-rw-r--r-- | user/networkmanager/APKBUILD | 100 | ||||
-rw-r--r-- | user/networkmanager/editline.patch | 128 | ||||
-rw-r--r-- | user/networkmanager/errno.patch | 21 | ||||
-rw-r--r-- | user/networkmanager/musl.patch | 223 | ||||
-rw-r--r-- | user/networkmanager/nm.confd | 4 | ||||
-rw-r--r-- | user/networkmanager/nm.initd | 58 | ||||
-rw-r--r-- | user/networkmanager/tests.patch | 18 |
9 files changed, 594 insertions, 0 deletions
diff --git a/user/networkmanager/01-org.freedesktop.NetworkManager.rules b/user/networkmanager/01-org.freedesktop.NetworkManager.rules new file mode 100644 index 000000000..d00b26853 --- /dev/null +++ b/user/networkmanager/01-org.freedesktop.NetworkManager.rules @@ -0,0 +1,7 @@ +// Let users in plugdev group modify NetworkManager +polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.NetworkManager.settings.modify.system" && + subject.isInGroup("plugdev") && subject.active) { + return "yes"; + } +}); diff --git a/user/networkmanager/10-openrc-status b/user/networkmanager/10-openrc-status new file mode 100644 index 000000000..06b22bd77 --- /dev/null +++ b/user/networkmanager/10-openrc-status @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright (c) 2012 Alexandre Rostovtsev +# Released under the 2-clause BSD license. + +# Ensures that the NetworkManager OpenRC service is marked as started and +# providing net only when it has a successful connection. + +if [ ! -e "/run/openrc/softlevel" ]; then + # OpenRC is not running + exit 0 +fi + +# Ensure rc-service is in PATH +PATH="${PATH}:/sbin:/usr/sbin" + +# Exit if the NetworkManager OpenRC service is not running +rc-service NetworkManager status 2>&1 | grep -Eq "status: (starting|started|inactive|stopping)" || exit 0 + +# Call rc-service in background mode so that the start/stop functions update +# NetworkManager service status to started or inactive instead of actually +# starting or stopping the daemon +export IN_BACKGROUND=YES + +case "$2" in + up) nm-online -t 0 -x && + ! rc-service NetworkManager status 2>&1 | grep -q started && + exec rc-service NetworkManager start ;; + down) nm-online -t 0 -x || + rc-service NetworkManager status 2>&1 | grep -q stopped || + exec rc-service NetworkManager stop ;; + pre-sleep) rc-service NetworkManager status 2>&1 | grep -q stopped || + exec rc-service NetworkManager stop ;; +esac +exit 0 +# vim: set ts=4: diff --git a/user/networkmanager/APKBUILD b/user/networkmanager/APKBUILD new file mode 100644 index 000000000..daf79c413 --- /dev/null +++ b/user/networkmanager/APKBUILD @@ -0,0 +1,100 @@ +# Contributor: A. Wilcox <awilfox@adelielinux.org> +# Maintainer: A. Wilcox <awilfox@adelielinux.org> +pkgname=networkmanager +pkgver=1.18.1 +pkgrel=0 +pkgdesc="Network management daemon" +url="https://wiki.gnome.org/Projects/NetworkManager" +arch="all" +options="!check" # Requires dbus-python and running DBus server. +license="GPL-2.0+ AND LGPL-2.1+" +depends="dhcpcd iputils ppp wpa_supplicant-dbus" +makedepends="bluez-dev consolekit2-dev curl-dev dbus-dev dbus-glib-dev + eudev-dev glib-dev gobject-introspection-dev intltool libedit-dev + libndp-dev libxslt modemmanager-dev ncurses-dev newt-dev nss-dev + perl polkit-dev ppp-dev py3-pygobject util-linux-dev vala-dev" +subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-openrc" +source="https://download.gnome.org/sources/NetworkManager/1.18/NetworkManager-$pkgver.tar.xz + editline.patch + errno.patch + musl.patch + tests.patch + + 01-org.freedesktop.NetworkManager.rules + 10-openrc-status + nm.confd + nm.initd + " +builddir="$srcdir/NetworkManager-$pkgver" + +build() { + # pppd plugin dir is a huge hack. + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --disable-json-validation \ + --disable-more-warnings \ + --disable-ovs \ + --disable-qt \ + --disable-static \ + --enable-bluez5-dun \ + --enable-concheck \ + --enable-polkit=yes \ + --enable-ppp \ + --enable-vala \ + --with-crypto=nss \ + --with-dbus-sys-dir=/etc/dbus-1/system.d \ + --with-dhcpcd \ + --with-ebpf=yes \ + --with-iptables=/sbin/iptables \ + --with-libnm-glib \ + --with-nmcli=yes \ + --with-nmtui \ + --with-pppd-plugin-dir=/usr/lib/pppd/$(ls -1 /usr/lib/pppd | head) \ + --with-session-tracking=consolekit \ + --with-suspend-resume=consolekit \ + --without-dhclient \ + --without-libaudit \ + --without-libpsl \ + --without-netconfig \ + --without-systemd-journal + make +} + +check() { + make check +} + +package() { + make DESTDIR="$pkgdir" install + + install -D -m755 "$srcdir"/nm.initd "$pkgdir"/etc/init.d/NetworkManager + install -D -m644 "$srcdir"/nm.confd "$pkgdir"/etc/conf.d/NetworkManager + install -D -m600 -t "$pkgdir"/usr/share/polkit-1/rules.d/ \ + "$srcdir"/01-org.freedesktop.NetworkManager.rules + install -D -m755 -t "$pkgdir"/etc/NetworkManager/dispatcher.d/ \ + "$srcdir"/10-openrc-status + install -d "$pkgdir"/etc/NetworkManager/system-connections + touch "$pkgdir"/etc/NetworkManager/system-connections/.keepdir +} + +openrc() { + default_openrc + mkdir -p "$subpkgdir"/etc/NetworkManager/dispatcher.d + mv "$pkgdir"/etc/NetworkManager/dispatcher.d/10-openrc-status \ + "$subpkgdir"/etc/NetworkManager/dispatcher.d/ +} + +sha512sums="24ffd5b5802692ce392a5ce65623679014d4e476cddedf76222829118f3ab4c92e180c1814db80438f66e2ab7a4e93eb1bac1e0b77575ff7620b0bf0e27d2992 NetworkManager-1.18.1.tar.xz +559dc42d3017508bfc35ea91da3d0169d601cd6b1764210fd8a27733e9c6671ec2d2d4d6a88af6749df450ea0c16dbc5269258cf2a0b608b9223688a40ca3ec0 editline.patch +0006d9c538a72673746b6aede8c61e0b7a23b055f8276fa2dde6e70f8c00d60854cf49678c996764f83b40cf06c5c2cd24c8c382d900aaf97fc840342e29500f errno.patch +2d77b08d737653999631b8d51b884d12a2f6ba62ef99f0115e0fe2513fcdabec44ea67083684a6762dbc0423d9b41706d6223e4751bbabb70e8ef0691af57256 musl.patch +2c987c464c31e6ad5a34abd8401bb625e9438e656a55adca21e07ca6ee974d39b6d7e942805b17a72ef38154612e2475fd7951f185b775945c8bd740226668af tests.patch +22dfa5b071891ba16b9a8b90a1964d56e370cb640d78191934ae802e568f92c299b9d4d965f7081fb36a8c09378bfb0b33193b2332cbdc28c6799b152128c214 01-org.freedesktop.NetworkManager.rules +26f962cea0b6a75549d16c19a71e3559239b08b001927882702f5d9355a2cc95f7b13c581439f758a950d9a5bfb73b86ba61a5ffb22c9abe19f5b05fe5f5834a 10-openrc-status +f8c9331834cbc66ab0e4e6f4a120fde6a08a435d680a1e1087718fdbb2b9843a313e7ec30b7008822999dafd98e152aa7d2a96f87320ba9c91c3adb63e0b7c9a nm.confd +a8356480592ec5e818b390b83cb258248d64850748e9e485bed68befabf067219d02fda137ee63684e0cd2c0e4f5fca30f94f8db71f811149183ff4715159658 nm.initd" diff --git a/user/networkmanager/editline.patch b/user/networkmanager/editline.patch new file mode 100644 index 000000000..e97461d3a --- /dev/null +++ b/user/networkmanager/editline.patch @@ -0,0 +1,128 @@ +--- NetworkManager-1.18.1/clients/cli/agent.c.old 2019-04-18 09:19:11.000000000 +0000 ++++ NetworkManager-1.18.1/clients/cli/agent.c 2019-05-10 06:15:55.614930112 +0000 +@@ -25,8 +25,7 @@ + + #include <stdio.h> + #include <stdlib.h> +-#include <readline/readline.h> +-#include <readline/history.h> ++#include <editline/readline.h> + + #include "common.h" + #include "utils.h" +--- NetworkManager-1.18.1/clients/cli/common.c.old 2019-04-20 19:01:59.000000000 +0000 ++++ NetworkManager-1.18.1/clients/cli/common.c 2019-05-10 07:07:34.506620687 +0000 +@@ -26,8 +26,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <sys/ioctl.h> +-#include <readline/readline.h> +-#include <readline/history.h> ++#include <editline/readline.h> + + #include "nm-vpn-helpers.h" + #include "nm-client-utils.h" +@@ -984,7 +983,7 @@ + * nmc_readline_echo: + * + * The same as nmc_readline() except it can disable echoing of input characters if @echo_on is %FALSE. +- * nmc_readline(TRUE, ...) == nmc_readline(...) ++ * nmc_readline_echo(TRUE, ...) == nmc_readline(...) + */ + char * + nmc_readline_echo (const NmcConfig *nmc_config, +@@ -995,8 +994,7 @@ + va_list args; + gs_free char *prompt = NULL; + char *str; +- HISTORY_STATE *saved_history; +- HISTORY_STATE passwd_history = { 0, }; ++ int whence, curpos; + + va_start (args, prompt_fmt); + prompt = g_strdup_vprintf (prompt_fmt, args); +@@ -1006,8 +1004,7 @@ + + /* Hide the actual password */ + if (!echo_on) { +- saved_history = history_get_history_state (); +- history_set_history_state (&passwd_history); ++ whence = where_history (); + rl_redisplay_function = nmc_secret_redisplay; + } + +@@ -1016,7 +1013,10 @@ + /* Restore the non-hiding behavior */ + if (!echo_on) { + rl_redisplay_function = rl_redisplay; +- history_set_history_state (saved_history); ++ curpos = where_history (); ++ for (; curpos > whence; curpos--) { ++ remove_history (curpos); ++ } + } + + return str; +--- NetworkManager-1.18.1/clients/cli/connections.c.old 2019-04-20 19:01:59.000000000 +0000 ++++ NetworkManager-1.18.1/clients/cli/connections.c 2019-05-10 07:05:43.058781503 +0000 +@@ -26,8 +26,7 @@ + #include <unistd.h> + #include <signal.h> + #include <netinet/ether.h> +-#include <readline/readline.h> +-#include <readline/history.h> ++#include <editline/readline.h> + #include <fcntl.h> + + #include "nm-client-utils.h" +@@ -6007,9 +6006,6 @@ + return nmc_rl_gen_func_basic (text, state, avals); + } + +-/* from readline */ +-extern int rl_complete_with_tilde_expansion; +- + /* + * Attempt to complete on the contents of TEXT. START and END show the + * region of TEXT that contains the word to complete. We can use the +@@ -6036,9 +6032,6 @@ + /* Disable default filename completion */ + rl_attempted_completion_over = 1; + +- /* Enable tilde expansion when filenames are completed */ +- rl_complete_with_tilde_expansion = 1; +- + /* Filter out possible ANSI color escape sequences */ + prompt_tmp = nmc_filter_out_colors ((const char *) rl_prompt); + +@@ -9142,7 +9135,6 @@ + generator_func = _meta_abstract_generator; + } else if (g_strcmp0 (rl_prompt, PROMPT_IMPORT_FILE) == 0) { + rl_attempted_completion_over = 0; +- rl_complete_with_tilde_expansion = 1; + } else if (g_strcmp0 (rl_prompt, PROMPT_VPN_CONNECTION) == 0) { + generator_func = gen_vpn_ids; + } +--- NetworkManager-1.18.1/clients/cli/devices.c.old 2019-04-20 19:01:59.000000000 +0000 ++++ NetworkManager-1.18.1/clients/cli/devices.c 2019-05-10 06:16:21.432108032 +0000 +@@ -23,7 +23,7 @@ + + #include <stdio.h> + #include <stdlib.h> +-#include <readline/readline.h> ++#include <editline/readline.h> + + #include "nm-secret-agent-simple.h" + #include "nm-client-utils.h" +--- NetworkManager-1.18.1/clients/cli/nmcli.c.old 2019-04-20 19:01:59.000000000 +0000 ++++ NetworkManager-1.18.1/clients/cli/nmcli.c 2019-05-10 06:16:29.211257692 +0000 +@@ -30,8 +30,7 @@ + #include <unistd.h> + #include <locale.h> + #include <glib-unix.h> +-#include <readline/readline.h> +-#include <readline/history.h> ++#include <editline/readline.h> + + #include "nm-client-utils.h" + diff --git a/user/networkmanager/errno.patch b/user/networkmanager/errno.patch new file mode 100644 index 000000000..825cc97a7 --- /dev/null +++ b/user/networkmanager/errno.patch @@ -0,0 +1,21 @@ +--- NetworkManager-1.18.1/shared/nm-glib-aux/nm-errno.c.old 2019-04-19 09:31:51.000000000 +0000 ++++ NetworkManager-1.18.1/shared/nm-glib-aux/nm-errno.c 2019-05-10 06:01:00.812741059 +0000 +@@ -121,7 +121,6 @@ + nm_assert (buf); + nm_assert (buf_size > 0); + +-#if (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE + /* XSI-compliant */ + { + int errno_saved = errno; +@@ -132,10 +131,6 @@ + } + buf2 = buf; + } +-#else +- /* GNU-specific */ +- buf2 = strerror_r (errsv, buf, buf_size); +-#endif + + /* like g_strerror(), ensure that the error message is UTF-8. */ + if ( !g_get_charset (NULL) diff --git a/user/networkmanager/musl.patch b/user/networkmanager/musl.patch new file mode 100644 index 000000000..2e4370969 --- /dev/null +++ b/user/networkmanager/musl.patch @@ -0,0 +1,223 @@ +Misc header fixes for compatibility with musl libc. + +diff --git a/shared/systemd/src/basic/stdio-util.h b/shared/systemd/src/basic/stdio-util.h +index c3b9448..e80a938 100644 +--- a/shared/systemd/src/basic/stdio-util.h ++++ b/shared/systemd/src/basic/stdio-util.h +@@ -1,7 +1,9 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + #pragma once + ++#if defined(__GLIBC__) + #include <printf.h> ++#endif + #include <stdarg.h> + #include <stdio.h> + #include <sys/types.h> +diff --git a/shared/systemd/src/basic/sort-util.h b/shared/systemd/src/basic/sort-util.h +index e029f86..935f136 100644 +--- a/shared/systemd/src/basic/sort-util.h ++++ b/shared/systemd/src/basic/sort-util.h +@@ -5,6 +5,13 @@ + + #include "macro.h" + ++#ifndef __COMPAR_FN_T ++# define __COMPAR_FN_T ++typedef int (*__compar_fn_t) (const void *, const void *); ++typedef __compar_fn_t comparison_fn_t; ++typedef int (*__compar_d_fn_t) (const void *, const void *, void *); ++#endif ++ + void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, + __compar_d_fn_t compar, void *arg); + +diff --git a/shared/systemd/src/basic/util.h b/shared/systemd/src/basic/util.h +index 25e6ab8..7967e8a 100644 +--- a/shared/systemd/src/basic/util.h ++++ b/shared/systemd/src/basic/util.h +@@ -46,6 +46,12 @@ static inline unsigned u64log2(uint64_t n) { + #endif + } + ++#if !defined(__GLIBC__) ++typedef int (*__compar_fn_t) (const void*, const void*); ++typedef __compar_fn_t comparison_fn_t; ++typedef int (*__compar_d_fn_t) (const void *, const void *, void *); ++#endif ++ + static inline unsigned u32ctz(uint32_t n) { + #if __SIZEOF_INT__ == 4 + return n != 0 ? __builtin_ctz(n) : 32; +diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h +index 2b5baba..976850c 100644 +--- a/libnm-core/nm-utils.h ++++ b/libnm-core/nm-utils.h +@@ -30,7 +30,11 @@ + #include <netinet/in.h> + + /* For ETH_ALEN and INFINIBAND_ALEN */ ++#if defined(__GLIBC__) + #include <linux/if_ether.h> ++#else ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ ++#endif + #include <linux/if_infiniband.h> + + #include "nm-core-enum-types.h" +diff --git a/shared/systemd/src/basic/socket-util.h b/shared/systemd/src/basic/socket-util.h +index d2246a8..4cb0807 100644 +--- a/shared/systemd/src/basic/socket-util.h ++++ b/shared/systemd/src/basic/socket-util.h +@@ -12,6 +12,11 @@ + #include <sys/socket.h> + #include <sys/types.h> + #include <sys/un.h> ++#if !defined(__GLIBC__) ++/* SIOCGSTAMPNS from linux/asm-generic.h ++ * for src/systemd/src/libsystemd-network/sd-lldp.c */ ++#include <linux/sockios.h> ++#endif + + #include "macro.h" + #include "missing_socket.h" +diff --git a/src/platform/wifi/nm-wifi-utils.h b/src/platform/wifi/nm-wifi-utils.h +index 36148b5..d282eb2 100644 +--- a/src/platform/wifi/nm-wifi-utils.h ++++ b/src/platform/wifi/nm-wifi-utils.h +@@ -22,7 +22,11 @@ + #ifndef __WIFI_UTILS_H__ + #define __WIFI_UTILS_H__ + ++#if defined(__GLIBC__) + #include <net/ethernet.h> ++#else /* musl libc */ ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ ++#endif + + #include "nm-dbus-interface.h" + #include "nm-setting-wireless.h" +diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c +index 7514fa7..f041382 100644 +--- a/src/devices/nm-device.c ++++ b/src/devices/nm-device.c +@@ -32,7 +32,11 @@ + #include <arpa/inet.h> + #include <fcntl.h> + #include <linux/if_addr.h> ++#if defined(__GLIBC__) + #include <linux/if_arp.h> ++#else ++#include <linux/if.h> ++#endif + #include <linux/rtnetlink.h> + #include <linux/pkt_sched.h> + +diff --git a/src/nm-manager.c b/src/nm-manager.c +index 0bf6a75..e392507 100644 +--- a/src/nm-manager.c ++++ b/src/nm-manager.c +@@ -26,6 +26,7 @@ + #include <stdlib.h> + #include <fcntl.h> + #include <unistd.h> ++#include <asm/types.h> + + #include "nm-utils/nm-c-list.h" + +--- NetworkManager-1.18.1/shared/systemd/src/basic/fs-util.h.old 2019-04-18 09:19:11.000000000 +0000 ++++ NetworkManager-1.18.1/shared/systemd/src/basic/fs-util.h 2019-05-10 06:02:21.493921788 +0000 +@@ -7,6 +7,7 @@ + #include <stdbool.h> + #include <stdint.h> + #include <sys/inotify.h> ++#include <sys/stat.h> + #include <sys/types.h> + #include <unistd.h> + +diff --git a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h +index 8c07c53..d043afc 100644 +--- a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h ++++ b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h +@@ -65,7 +65,7 @@ + # ifdef HAVE___SECURE_GETENV + # define secure_getenv __secure_getenv + # else +-# error neither secure_getenv nor __secure_getenv is available ++# define secure_getenv getenv + # endif + #endif + +--- NetworkManager-1.18.1/src/platform/nm-linux-platform.c.old 2019-04-19 09:31:51.000000000 +0000 ++++ NetworkManager-1.18.1/src/platform/nm-linux-platform.c 2019-05-10 07:21:32.665163629 +0000 +@@ -20,6 +20,7 @@ + #include "nm-default.h" + + #include "nm-linux-platform.h" ++#include "wpan/nm-wpan-utils.h" + + #include <arpa/inet.h> + #include <dlfcn.h> +@@ -28,7 +29,11 @@ + #include <libudev.h> + #include <linux/fib_rules.h> + #include <linux/ip.h> ++#ifdef __GLIBC__ + #include <linux/if_arp.h> ++#else ++#include <linux/if.h> ++#endif + #include <linux/if_bridge.h> + #include <linux/if_link.h> + #include <linux/if_tun.h> +@@ -57,7 +62,6 @@ + #include "nm-platform-private.h" + #include "wifi/nm-wifi-utils.h" + #include "wifi/nm-wifi-utils-wext.h" +-#include "wpan/nm-wpan-utils.h" + #include "nm-glib-aux/nm-io-utils.h" + #include "nm-udev-aux/nm-udev-utils.h" + +diff --git a/shared/systemd/src/basic/process-util.c b/shared/systemd/src/basic/process-util.c +index b0afb5c..f72e346 100644 +--- a/shared/systemd/src/basic/process-util.c ++++ b/shared/systemd/src/basic/process-util.c +@@ -21,6 +21,9 @@ + #include <sys/wait.h> + #include <syslog.h> + #include <unistd.h> ++#ifndef __GLIBC__ ++#include <pthread.h> ++#endif + #if 0 /* NM_IGNORED */ + #if HAVE_VALGRIND_VALGRIND_H + #include <valgrind/valgrind.h> +@@ -1168,11 +1171,13 @@ void reset_cached_pid(void) { + cached_pid = CACHED_PID_UNSET; + } + ++#ifdef __GLIBC__ + /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc + * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against + * libpthread, as it is part of glibc anyway. */ + extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle); + extern void* __dso_handle _weak_; ++#endif + + pid_t getpid_cached(void) { + static bool installed = false; +@@ -1201,7 +1206,12 @@ pid_t getpid_cached(void) { + * only half-documented (glibc doesn't document it but LSB does — though only superficially) + * we'll check for errors only in the most generic fashion possible. */ + +- if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) { ++ #ifdef __GLIBC__ ++ if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) { ++ #else ++ if (pthread_atfork(NULL, NULL, reset_cached_pid) != 0) { ++ #endif ++ + /* OOM? Let's try again later */ + cached_pid = CACHED_PID_UNSET; + return new_pid; + diff --git a/user/networkmanager/nm.confd b/user/networkmanager/nm.confd new file mode 100644 index 000000000..4a9922965 --- /dev/null +++ b/user/networkmanager/nm.confd @@ -0,0 +1,4 @@ +# If NetworkManager does not establish a connection within $INACTIVE_TIMEOUT +# seconds after starting, the service will be marked as inactive, and it will +# continue to wait for a connection in background mode. +INACTIVE_TIMEOUT=1 diff --git a/user/networkmanager/nm.initd b/user/networkmanager/nm.initd new file mode 100644 index 000000000..3209644c5 --- /dev/null +++ b/user/networkmanager/nm.initd @@ -0,0 +1,58 @@ +#!/sbin/openrc-run +# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org> +# Copyright 2013-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="NetworkManager daemon. The service is marked as started only \ +when a network connection is established." + +depend() { + need dbus + use consolekit + provide net +} + +start() { + # If we are re-called by a dispatcher event, we want to mark the service + # as started without starting the daemon again + yesno "${IN_BACKGROUND}" && return 0 + + [ -z "${INACTIVE_TIMEOUT}" ] && INACTIVE_TIMEOUT="1" + + ebegin "Starting NetworkManager" + start-stop-daemon --start --quiet --pidfile /run/NetworkManager/NetworkManager.pid \ + --exec /usr/sbin/NetworkManager -- --pid-file /run/NetworkManager/NetworkManager.pid + local _retval=$? + eend "${_retval}" + if [ "x${_retval}" = 'x0' ] && ! nm-online -t "${INACTIVE_TIMEOUT}"; then + einfo "Marking NetworkManager as inactive. It will automatically be marked" + einfo "as started after a network connection has been established." + mark_service_inactive + fi + return "${_retval}" +} + +stop() { + # If we are re-called by a dispatcher event, we want to mark the service + # as inactive without stopping the daemon + if yesno "${IN_BACKGROUND}"; then + mark_service_inactive "${SVCNAME}" + return 0 + fi + + ebegin "Stopping NetworkManager" + local pidfile=/run/NetworkManager/NetworkManager.pid + if [ ! -e "${pidfile}" ] && [ -e /var/run/NetworkManager.pid ]; then + # Try stopping the pid file used by <0.9.7 + pidfile=/var/run/NetworkManager.pid + start-stop-daemon --stop --quiet --pidfile "${pidfile}" + ret=$? + [ ${ret} = 0 ] && [ -e "${pidfile}" ] && rm "${pidfile}" + eend ${ret} + else + start-stop-daemon --stop --quiet --pidfile "${pidfile}" + eend $? + fi +} + +# vim: set ft=gentoo-init-d ts=4 : diff --git a/user/networkmanager/tests.patch b/user/networkmanager/tests.patch new file mode 100644 index 000000000..8fb5cda60 --- /dev/null +++ b/user/networkmanager/tests.patch @@ -0,0 +1,18 @@ +--- NetworkManager-1.18.1/src/devices/tests/test-lldp.c.old 2019-04-18 09:19:11.000000000 +0000 ++++ NetworkManager-1.18.1/src/devices/tests/test-lldp.c 2019-05-10 07:23:58.979198831 +0000 +@@ -21,7 +21,6 @@ + #include "nm-default.h" + + #include <fcntl.h> +-#include <linux/if_tun.h> + #include <sys/ioctl.h> + #include <sys/stat.h> + #include <sys/types.h> +@@ -32,6 +31,7 @@ + #include "platform/tests/test-common.h" + + #include "nm-test-utils-core.h" ++#include <linux/if_tun.h> + + /*****************************************************************************/ + |