Browse Source

n/NetworkManager: Added NetworkManager-0.9.8.8.

slackware-14.2
Damien Goutte-Gattat 8 years ago
parent
commit
f06413b2f1
  1. 42
      n/NetworkManager/55NetworkManager
  2. 188
      n/NetworkManager/NetworkManager-0.9.8.8-dns-plugin-none.diff
  3. 1
      n/NetworkManager/NetworkManager-0.9.8.8.tar.xz.sha1
  4. 151
      n/NetworkManager/NetworkManager.SlackBuild
  5. 11
      n/NetworkManager/NetworkManager.conf
  6. 38
      n/NetworkManager/doinst.sh
  7. 105
      n/NetworkManager/rc.networkmanager
  8. 12
      n/NetworkManager/slack-desc

42
n/NetworkManager/55NetworkManager

@ -0,0 +1,42 @@
#!/bin/sh
# If we are running NetworkManager, tell it we are going to sleep.
# TODO: Make NetworkManager smarter about how to handle sleep/resume
# If we are asleep for less time than it takes for TCP to reset a
# connection, and we are assigned the same IP on resume, we should
# not break established connections. Apple can do this, and it is
# rather nifty.
. "${PM_FUNCTIONS}"
suspend_nm()
{
# Tell NetworkManager to shut down networking
printf "Having NetworkManager put all interaces to sleep..."
dbus_send --system \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.NetworkManager.sleep && \
echo Done. || echo Failed.
}
resume_nm()
{
# Wake up NetworkManager and make it do a new connection
printf "Having NetworkManager wake interfaces back up..."
dbus_send --system \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.NetworkManager.wake && \
echo Done. || echo Failed.
}
case "$1" in
hibernate|suspend)
suspend_nm
;;
thaw|resume)
resume_nm
;;
*) exit $NA
;;
esac

188
n/NetworkManager/NetworkManager-0.9.8.8-dns-plugin-none.diff

@ -0,0 +1,188 @@
diff --git a/src/dns-manager/Makefile.am b/src/dns-manager/Makefile.am
index e6c2ff2..a9d1c39 100644
--- a/src/dns-manager/Makefile.am
+++ b/src/dns-manager/Makefile.am
@@ -16,6 +16,8 @@ libdns_manager_la_SOURCES = \
nm-dns-plugin.c \
nm-dns-dnsmasq.h \
nm-dns-dnsmasq.c \
+ nm-dns-none.h \
+ nm-dns-none.c \
nm-dns-utils.h \
nm-dns-utils.c
diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c
index fb42663..fcd458b 100644
--- a/src/dns-manager/nm-dns-manager.c
+++ b/src/dns-manager/nm-dns-manager.c
@@ -1043,6 +1043,8 @@ load_plugins (NMDnsManager *self, const char **plugins)
for (iter = plugins; iter && *iter; iter++) {
if (!strcasecmp (*iter, "dnsmasq"))
plugin = NM_DNS_PLUGIN (nm_dns_dnsmasq_new ());
+ else if (!strcasecmp (*iter, "none"))
+ plugin = NM_DNS_PLUGIN(nm_dns_none_new());
else {
nm_log_warn (LOGD_DNS, "Unknown DNS plugin '%s'", *iter);\
continue;
diff --git a/src/dns-manager/nm-dns-none.c b/src/dns-manager/nm-dns-none.c
new file mode 100644
index 0000000..dce7323
--- /dev/null
+++ b/src/dns-manager/nm-dns-none.c
@@ -0,0 +1,102 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2014 Damien Goutte-Gattat
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "nm-dns-none.h"
+
+G_DEFINE_TYPE (NMDnsNone, nm_dns_none, NM_TYPE_DNS_PLUGIN)
+
+#define NM_DNS_NONE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DNS_NONE, NMDnsNonePrivate))
+
+typedef struct {
+ guint32 foo;
+} NMDnsNonePrivate;
+
+/*******************************************/
+
+static gboolean
+update (NMDnsPlugin *plugin,
+ const GSList *vpn_configs,
+ const GSList *dev_configs,
+ const GSList *other_configs,
+ const char *hostname)
+{
+ return TRUE;
+}
+
+static void
+child_quit (NMDnsPlugin *plugin, gint status)
+{
+}
+
+static gboolean
+init (NMDnsPlugin *plugin)
+{
+ return TRUE;
+}
+
+static gboolean
+is_caching (NMDnsPlugin *plugin)
+{
+ return TRUE;
+}
+
+static const char *
+get_name (NMDnsPlugin *plugin)
+{
+ return "none";
+}
+
+/****************************************************************/
+
+NMDnsNone *
+nm_dns_none_new (void)
+{
+ return (NMDnsNone *) g_object_new (NM_TYPE_DNS_NONE, NULL);
+}
+
+static void
+nm_dns_none_init (NMDnsNone *self)
+{
+}
+
+static void
+dispose (GObject *object)
+{
+ G_OBJECT_CLASS (nm_dns_none_parent_class)->dispose (object);
+}
+
+static void
+nm_dns_none_class_init (NMDnsNoneClass *dns_class)
+{
+ NMDnsPluginClass *plugin_class = NM_DNS_PLUGIN_CLASS (dns_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (dns_class);
+
+ g_type_class_add_private (dns_class, sizeof (NMDnsNonePrivate));
+
+ object_class->dispose = dispose;
+
+ plugin_class->init = init;
+ plugin_class->child_quit = child_quit;
+ plugin_class->is_caching = is_caching;
+ plugin_class->update = update;
+ plugin_class->get_name = get_name;
+}
diff --git a/src/dns-manager/nm-dns-none.h b/src/dns-manager/nm-dns-none.h
new file mode 100644
index 0000000..f519193
--- /dev/null
+++ b/src/dns-manager/nm-dns-none.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2014 Damien Goutte-Gattat
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef NM_DNS_NONE_H
+#define NM_DNS_NONE_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "nm-dns-plugin.h"
+
+#define NM_TYPE_DNS_NONE (nm_dns_none_get_type ())
+#define NM_DNS_NONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DNS_NONE, NMDnsNone))
+#define NM_DNS_NONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DNS_NONE, NMDnsNoneClass))
+#define NM_IS_DNS_NONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DNS_NONE))
+#define NM_IS_DNS_NONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DNS_NONE))
+#define NM_DNS_NONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DNS_NONE, NMDnsNoneClass))
+
+typedef struct {
+ NMDnsPlugin parent;
+} NMDnsNone;
+
+typedef struct {
+ NMDnsPluginClass parent;
+} NMDnsNoneClass;
+
+GType nm_dns_none_get_type (void);
+
+NMDnsNone *nm_dns_none_new (void);
+
+#endif /* NM_DNS_NONE_H */
+

1
n/NetworkManager/NetworkManager-0.9.8.8.tar.xz.sha1

@ -0,0 +1 @@
c134f5fa9fa1736d0af636430bc0c16cc3ab0dd1 NetworkManager-0.9.8.8.tar.xz

151
n/NetworkManager/NetworkManager.SlackBuild

@ -0,0 +1,151 @@
#!/bin/bash
# Build script for Slackware
# Copyright (C) 2010, 2011 Robby Workman, Northport, Alabama, USA
# Copyright (C) 2013 Patrick J. Volkerding, Sebeka, NM, USA
# Copyright (C) 2014 Damien Goutte-Gattat
#
# Redistribution and use of this script, with or without modifications,
# is permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
#
# Latest NetworkManager sourcecode is available at:
# <http://projects.gnome.org/NetworkManager/>.
#
# This SlackBuild is intended to replace the NetworkManager package
# provided with Slackware 14.1; it builds a patched version of
# NetworkManager.
# Source package infos
NAMESRC=${NAMESRC:-NetworkManager}
VERSION=${VERSION:-0.9.8.8}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.xz}
WGET=${WGET:-ftp://ftp.gnome.org/pub/GNOME/sources/NetworkManager/0.9/$ARCHIVE}
# Build infos
NAMEPKG=${NAMEPKG:-NetworkManager}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMEPKG}
CWD=$(pwd)
set -e # Quit if a command returns non-zero
# Sanity checks
if [ $UID -eq 0 ]; then
echo "You should NOT run this script as ROOT!"
exit 1
fi
if [ ! -d $TMP ]; then
echo "$TMP does not exists or is not a directory!"
exit 1
fi
# Compilation flags
LIBDIRSUFFIX=""
case "$ARCH" in
i?86)
CPUOPT="-O2 -march=$ARCH -mtune=i686"
;;
x86_64)
CPUOPT="-O2 -fPIC"
LIBDIRSUFFIX="64"
;;
*)
CPUOPT="-O2"
;;
esac
# Get and verify the source archive
if [ ! -r $ARCHIVE ]; then
wget -c -O $ARCHIVE.part "$WGET"
mv $ARCHIVE.part $ARCHIVE
fi
sha1sum -c $ARCHIVE.sha1
NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
# Extract
cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
# Apply patches
patch -p 1 < $CWD/NetworkManager-0.9.8.8-dns-plugin-none.diff
# Regenerate the build system since we patched some of its files
NOCONFIGURE=yes ./autogen.sh
# Compile
CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
./configure \
--prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$NAME \
--with-pppd-plugin-dir=/usr/lib$LIBDIRSUFFIX/pppd/2.4.5 \
--with-crypto=nss \
--enable-more-warnings=no \
--without-resolvconf \
--with-dhcpcd=/sbin/dhcpcd \
--with-dhclient=yes \
--with-modem-manager-1=yes
make -j $JOBS
make install-strip DESTDIR=$PKG
# Compress man pages
find $PKG/usr/man -type f -exec gzip -9 {} \;
# Install configuration file
install -D -m 644 $CWD/NetworkManager.conf $PKG/etc/NetworkManager/NetworkManager.conf.new
# Install run script
install -D -m 644 $CWD/rc.networkmanager $PKG/etc/rc.d/rc.networkmanager.new
# Install the documentation
mkdir -p $PKG/usr/doc/$NAME
install -m 644 AUTHORS CONTRIBUTING COPYING ChangeLog NEWS README TODO \
$CWD/55NetworkManager $PKG/usr/doc/$NAME
# Copy slack-desc and doinst.sh files
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
/sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
rm -rf $PKG
rm -rf $TMP/$NAME
"
if type -p fakeroot ; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi

11
n/NetworkManager/NetworkManager.conf

@ -0,0 +1,11 @@
# /etc/NetworkManager/NetworkManager.conf
#
# See NetworkManager.conf(5) for more information on this file
[main]
plugins=keyfile
dhcp=dhclient
[keyfile]
hostname=yourhostname

38
n/NetworkManager/doinst.sh

@ -0,0 +1,38 @@
#!/bin/sh
config()
{
NEW="$1"
OLD="`dirname $NEW`/`basename $NEW .new`"
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then
rm $NEW
fi
}
preserve_perms() {
NEW="$1"
OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
if [ -e ${OLD} ]; then
cp -a ${OLD} ${NEW}.incoming
cat ${NEW} > ${NEW}.incoming
mv ${NEW}.incoming ${NEW}
fi
mv ${NEW} ${OLD}
}
if [ -e etc/HOSTNAME ]; then
sed -i "s,yourhostname,$(cat etc/HOSTNAME | cut -f1 -d .)," \
etc/NetworkManager/NetworkManager.conf.new
fi
# Preserve permissions, but move this into place. Otherwise the net
# connection could be lost at a remote location.
preserve_perms etc/rc.d/rc.networkmanager.new
config etc/NetworkManager/NetworkManager.conf.new
# If the .pid file is found in the old location, move it to the new one:
if [ -r var/run/NetworkManager.pid ]; then
mv var/run/NetworkManager.pid var/run/NetworkManager/NetworkManager.pid
fi

105
n/NetworkManager/rc.networkmanager

@ -0,0 +1,105 @@
#!/bin/sh
#
# NetworkManager: NetworkManager daemon
#
# description: This is a daemon for automatically switching network \
# connections to the best available connection. \
#
# processname: NetworkManager
# pidfile: /var/run/NetworkManager/NetworkManager.pid
#
prefix=/usr
exec_prefix=/usr
sbindir=${exec_prefix}/sbin
NETWORKMANAGER_BIN=${sbindir}/NetworkManager
# Sanity checks.
[ -x $NETWORKMANAGER_BIN ] || exit 0
PIDFILE=/var/run/NetworkManager/NetworkManager.pid
nm_start()
{
if [ "`pgrep dbus-daemon`" = "" ]; then
echo "D-BUS must be running to start NetworkManager"
return
fi
# Just in case the pidfile is still there, we may need to nuke it.
if [ -e "$PIDFILE" ]; then
rm -f $PIDFILE
fi
echo "Starting NetworkManager daemon: $NETWORKMANAGER_BIN"
$NETWORKMANAGER_BIN
}
nm_status()
{
local pidlist=`cat $PIDFILE 2>/dev/null`
if [ -z "$pidlist" ]; then
return 1
fi
local command=`ps -p $pidlist -o comm=`
if [ "$command" != 'NetworkManager' ]; then
return 1
fi
}
nm_stop()
{
echo -en "Stopping NetworkManager: "
# Shut down any DHCP connections, otherwise the processes will be orphaned
# and the connections will not come up when NetworkManager restarts.
if ps ax | grep /sbin/dhcpcd | grep -q libexec/nm-dhcp ; then
ps ax | grep /sbin/dhcpcd | grep libexec/nm-dhcp | while read line ; do
kill -HUP $(echo $line | cut -b 1-5)
done
fi
if ps ax | grep /sbin/dhclient | grep -q /var/lib/NetworkManager ; then
ps ax | grep /sbin/dhclient | grep /var/lib/NetworkManager | while read line ; do
kill -HUP $(echo $line | cut -b 1-5)
done
fi
local pidlist=`cat $PIDFILE 2>/dev/null`
if [ ! -z "$pidlist" ]; then
kill $pidlist &>/dev/null
sleep 3
rm -f $PIDFILE &>/dev/null
fi
echo "stopped";
sleep 3
}
nm_restart()
{
nm_stop
nm_start
}
case "$1" in
'start')
if ( ! nm_status ); then
nm_start
else
echo "NetworkManager is already running (will not start it twice)."
fi
;;
'stop')
nm_stop
;;
'restart')
nm_restart
;;
'status')
if ( nm_status ); then
echo "NetworkManager is currently running"
else
echo "NetworkManager is not running."
fi
;;
*)
echo "usage $0 start|stop|status|restart"
esac

12
n/NetworkManager/slack-desc

@ -0,0 +1,12 @@
|-----handy-ruler------------------------------------------------------|
NetworkManager: NetworkManager (Networking that Just Works)
NetworkManager:
NetworkManager: The point of NetworkManager is to make networking configuration and
NetworkManager: setup as painless and automatic as possible. NetworkManager sets IP
NetworkManager: addresses, default routes, associating with wireless access points
NetworkManager: or wired LANs, and other network configuration settings in a simple,
NetworkManager: automated fashion (manual overrides are still possible).
NetworkManager:
NetworkManager: Home page: http://projects.gnome.org/NetworkManager/
NetworkManager:
NetworkManager:
Loading…
Cancel
Save