summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/create-exports-NetworkManager.sh28
-rwxr-xr-xtools/meson-post-install.sh47
-rwxr-xr-xtools/test-networkmanager-service.py27
3 files changed, 84 insertions, 18 deletions
diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh
index 68752c54..3c5789d8 100755
--- a/tools/create-exports-NetworkManager.sh
+++ b/tools/create-exports-NetworkManager.sh
@@ -35,7 +35,12 @@ call_nm() {
 }
 
 get_symbols_nm () {
-    call_nm ./src/.libs/libNetworkManager.a |
+    if [ -z "$from_meson" ]; then
+        base=./src/.libs/libNetworkManager.a
+    else
+        base=./src/nm-full-symbols
+    fi
+    call_nm "$base" |
         sed -n 's/^[tTDGRBS] //p' |
         _sort
 }
@@ -47,11 +52,11 @@ EOF
 }
 
 get_symbols_missing() {
-    (for f in $(find ./src/settings/plugins/*/.libs/ \
-              ./src/devices/*/.libs/ \
-              ./src/ppp/.libs/ -name '*.so'); do
+    (for f in $(find ./src/settings/plugins/*/${libs} \
+                     ./src/devices/*/${libs} \
+                     ./src/ppp/${libs} -name '*.so' 2>/dev/null); do
         call_nm "$f" |
-            sed -n 's/^\([U]\) \(\(nm_\|nmp_\|_nm\|NM\|_NM\).*\)$/\2/p'
+            sed -n 's/^\([U]\) \(\(nm_\|nmp_\|_nm\|NM\|_NM\|c_siphash_\).*\)$/\2/p'
     done) |
         _sort |
         grep -Fx -f <(get_symbols_explict) -v |
@@ -90,16 +95,25 @@ local:
 EOF
 }
 
-test -f ./src/.libs/libNetworkManager.a || die "must be called from NetworkManager \$(top_builddir) after building the tree"
+if [ -f "build.ninja" ]; then
+    from_meson=1
+    libs=
+else
+    libs=.libs/
+fi
+
+test -f ./src/${libs}libNetworkManager.a || die "must be called from NetworkManager top build dir after building the tree"
 
 case "$1" in
     rebuild)
+        [ -n "$from_meson" ] && die "can't do a build when called from meson"
         do_rebuild
         ;;
     build)
+        [ -n "$from_meson" ] && die "can't do a build when called from meson"
         do_build
         ;;
-    '--called-from-make')
+    --called-from-build)
         if test -z "${NM_BUILD_NO_CREATE_EXPORTS+x}"; then
             do_update
         else
diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh
new file mode 100755
index 00000000..8a60ce33
--- /dev/null
+++ b/tools/meson-post-install.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+datadir=$1
+bindir=$2
+pkgconfdir=$3
+pkglibdir=$4
+pkgstatedir=$5
+
+[ -n "$DESTDIR" ] && DESTDIR=${DESTDIR%%/}/
+
+if [ -f "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" ]; then
+    mv "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" \
+       "${DESTDIR}${datadir}/bash-completion/completions/nmcli"
+fi
+
+if [ -x "${DESTDIR}${bindir}/nmtui" ]; then
+    for alias in nmtui-connect nmtui-edit nmtui-hostname; do
+        ln -sf nmtui "${DESTDIR}${bindir}/$alias"
+    done
+fi
+
+for dir in "${pkgconfdir}/conf.d" \
+           "${pkgconfdir}/system-connections" \
+           "${pkgconfdir}/dispatcher.d/no-wait.d" \
+           "${pkgconfdir}/dispatcher.d/pre-down.d" \
+           "${pkgconfdir}/dispatcher.d/pre-up.d" \
+           "${pkgconfdir}/dnsmasq.d" \
+           "${pkgconfdir}/dnsmasq-shared.d" \
+           "${pkglibdir}/conf.d" \
+           "${pkglibdir}/VPN"; do
+    mkdir -p "${DESTDIR}${dir}"
+    chmod 0755 "${DESTDIR}${dir}"
+done
+
+mkdir -p "${DESTDIR}${pkgstatedir}"
+chmod 0700 "${DESTDIR}${pkgstatedir}"
+
+if [ "$6" = install_docs ]; then
+    mandir=$7
+
+    for alias in nmtui-connect nmtui-edit nmtui-hostname; do
+        ln -f "${DESTDIR}${mandir}/man1/nmtui.1" "${DESTDIR}${mandir}/man1/${alias}.1"
+    done
+
+    ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf"
+fi
+
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index 7fbed7ec..8a37fb17 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -108,7 +108,9 @@ class Util:
         return (Util.ip_addr_ntop(a, family), family)
 
     @staticmethod
-    def ip4_addr_ne32(addr):
+    def ip4_addr_be32(addr):
+        # return the IPv4 address as 32 bit integer in network byte order
+        # (big endian).
         a, family = Util.ip_addr_pton(addr, socket.AF_INET)
         n = 0
         for i in range(4):
@@ -279,6 +281,8 @@ class Util:
             return GLib.Variant('s', str(val))
         if isinstance(val, dbus.UInt32):
             return GLib.Variant('u', int(val))
+        if isinstance(val, dbus.UInt64):
+            return GLib.Variant('t', int(val))
         if isinstance(val, dbus.Boolean):
             return GLib.Variant('b', bool(val))
         if isinstance(val, dbus.Byte):
@@ -479,11 +483,12 @@ class NmUtil:
         if not do_verify_strict:
             return;
         t = s_con[NM.SETTING_CONNECTION_TYPE]
-        if t not in [ NM.SETTING_WIRED_SETTING_NAME,
-                      NM.SETTING_WIRELESS_SETTING_NAME,
+        if t not in [ NM.SETTING_GSM_SETTING_NAME,
                       NM.SETTING_VLAN_SETTING_NAME,
+                      NM.SETTING_VPN_SETTING_NAME,
                       NM.SETTING_WIMAX_SETTING_NAME,
-                      NM.SETTING_VPN_SETTING_NAME ]:
+                      NM.SETTING_WIRED_SETTING_NAME,
+                      NM.SETTING_WIRELESS_SETTING_NAME ]:
             raise BusErr.InvalidPropertyException('connection.type: unsupported connection type "%s"' % (t))
 
         try:
@@ -645,7 +650,7 @@ class ExportedObj(dbus.service.Object):
         # compatibility reasons. Note that this stub server implementation gets this wrong,
         # for example, it emits PropertiesChanged signal on org.freedesktop.NetworkManager.Device,
         # which NetworkManager never did.
-        # See https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/nm-dbus-manager.c?id=db80d5f62a1edf39c5970887ef7b9ec62dd4163f#n1274
+        # See https://gitlab.freedesktop.org/NetworkManager/NetworkManager/blob/db80d5f62a1edf39c5970887ef7b9ec62dd4163f/src/nm-dbus-manager.c#L1274
         if dbus_interface.legacy_prop_changed_func is not None:
             dbus_interface.legacy_prop_changed_func(self, prop)
 
@@ -1852,9 +1857,9 @@ class IP4Config(ExportedObj):
 
         return {
             PRP_IP4_CONFIG_ADDRESSES:   dbus.Array([
-                                                [ Util.ip4_addr_ne32(a['addr']),
+                                                [ Util.ip4_addr_be32(a['addr']),
                                                   a['prefix'],
-                                                  Util.ip4_addr_ne32(a['gateway']) if a['gateway'] else 0
+                                                  Util.ip4_addr_be32(a['gateway']) if a['gateway'] else 0
                                                 ] for a in addrs
                                             ],
                                             'au'),
@@ -1868,9 +1873,9 @@ class IP4Config(ExportedObj):
                                             'a{sv}'),
             PRP_IP4_CONFIG_GATEWAY:     dbus.String(gateway) if gateway else "",
             PRP_IP4_CONFIG_ROUTES:      dbus.Array([
-                                                [ Util.ip4_addr_ne32(a['dest']),
+                                                [ Util.ip4_addr_be32(a['dest']),
                                                   a['prefix'],
-                                                  Util.ip4_addr_ne32(a['next-hop'] or '0.0.0.0'),
+                                                  Util.ip4_addr_be32(a['next-hop'] or '0.0.0.0'),
                                                   max(a['metric'], 0)
                                                 ] for a in routes
                                             ],
@@ -1884,12 +1889,12 @@ class IP4Config(ExportedObj):
                                                 for a in routes
                                             ],
                                             'a{sv}'),
-            PRP_IP4_CONFIG_NAMESERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_ne32(n)) for n in nameservers], 'u'),
+            PRP_IP4_CONFIG_NAMESERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_be32(n)) for n in nameservers], 'u'),
             PRP_IP4_CONFIG_DOMAINS:     dbus.Array(domains, 's'),
             PRP_IP4_CONFIG_SEARCHES:    dbus.Array(searches, 's'),
             PRP_IP4_CONFIG_DNSOPTIONS:  dbus.Array(dnsoptions, 's'),
             PRP_IP4_CONFIG_DNSPRIORITY: dbus.Int32(dnspriority),
-            PRP_IP4_CONFIG_WINSSERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_ne32(n)) for n in winsservers], 'u'),
+            PRP_IP4_CONFIG_WINSSERVERS: dbus.Array([dbus.UInt32(Util.ip4_addr_be32(n)) for n in winsservers], 'u'),
         }
 
     def props_regenerate(self, generate_seed):