diff options
Diffstat (limited to 'testing/source')
-rw-r--r-- | testing/source/NetworkManager/55NetworkManager | 39 | ||||
-rwxr-xr-x | testing/source/NetworkManager/NetworkManager.SlackBuild | 201 | ||||
-rw-r--r-- | testing/source/NetworkManager/NetworkManager.conf | 7 | ||||
-rw-r--r-- | testing/source/NetworkManager/conf.d/00-dhcp-client.conf | 8 | ||||
-rw-r--r-- | testing/source/NetworkManager/conf.d/00-rc-manager.conf | 2 | ||||
-rw-r--r-- | testing/source/NetworkManager/doinst.sh | 42 | ||||
-rw-r--r-- | testing/source/NetworkManager/rc.networkmanager | 113 | ||||
-rw-r--r-- | testing/source/NetworkManager/slack-desc | 19 |
8 files changed, 431 insertions, 0 deletions
diff --git a/testing/source/NetworkManager/55NetworkManager b/testing/source/NetworkManager/55NetworkManager new file mode 100644 index 00000000..d7b3ee6a --- /dev/null +++ b/testing/source/NetworkManager/55NetworkManager @@ -0,0 +1,39 @@ +#!/bin/sh +# If we are running NetworkManager, tell it we are going to sleep. + +. "${PM_FUNCTIONS}" + +suspend_nm() +{ + # Tell NetworkManager to shut down networking + printf "Having NetworkManager put all interaces to sleep..." + dbus_send --system --print-reply \ + --dest=org.freedesktop.NetworkManager \ + /org/freedesktop/NetworkManager \ + org.freedesktop.NetworkManager.Sleep \ + boolean:true && \ + 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 --print-reply \ + --dest=org.freedesktop.NetworkManager \ + /org/freedesktop/NetworkManager \ + org.freedesktop.NetworkManager.Sleep \ + boolean:false && \ + echo Done. || echo Failed. +} + +case "$1" in + hibernate|suspend) + suspend_nm + ;; + thaw|resume) + resume_nm + ;; + *) exit $NA + ;; +esac diff --git a/testing/source/NetworkManager/NetworkManager.SlackBuild b/testing/source/NetworkManager/NetworkManager.SlackBuild new file mode 100755 index 00000000..b92ec2b9 --- /dev/null +++ b/testing/source/NetworkManager/NetworkManager.SlackBuild @@ -0,0 +1,201 @@ +#!/bin/bash + +# Copyright 2010, 2011, 2014, 2016 Robby Workman, Northport, Alabama, USA +# Copyright 2013, 2014, 2015, 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, 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. + +# Modified 2011, 2012 by Eric Hameleers, Eindhoven, NL + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=NetworkManager +VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-1} + +# Automatically determine the architecture we're building on: +MARCH=$( uname -m ) +if [ -z "$ARCH" ]; then + case "$MARCH" in + i?86) export ARCH=i586 ;; + armv7hl) export ARCH=$MARCH ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$MARCH ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} + +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "armv7hl" ]; then + SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16" + LIBDIRSUFFIX="" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +case "$ARCH" in + arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; + *) TARGET=$ARCH-slackware-linux ;; +esac + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1 +cd $PKGNAM-$VERSION || exit 1 +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Find the version number for pppd, used to specify the plugin directory: +PPPD=$(echo /usr/lib${LIBDIRSUFFIX}/pppd/?.?.? | rev | cut -f 1 -d / | rev) + +# Apply bugfix patches from upstream git: +for dfile in $CWD/patches/* ; do + zcat $dfile | patch -p1 --verbose || exit 1 +done + +# For git-patched builds +autoreconf -vif +automake +./autogen.sh + +# Configuring --enable-json-validation --enable-ovs requires the Jansson +# json-c library. If there's any interest or usefulness with that, let me +# know. The library is fairly small, but in order to actually use team +# interfaces will probably require more stuff (not sure how much). +# +# Update September 2018: Added those options since we needed Jansson +# already for HTTP/2 support. + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PKGNAM-$VERSION \ + --with-udev-dir=/lib/udev \ + --with-pppd-plugin-dir=/usr/lib${LIBDIRSUFFIX}/pppd/$PPPD \ + --with-crypto=nss \ + --enable-more-warnings=no \ + --without-resolvconf \ + --with-dhcpcd=/sbin/dhcpcd \ + --with-dhclient=yes \ + --with-modem-manager-1=yes \ + --with-nmtui=yes \ + --enable-json-validation \ + --enable-ovs \ + --with-session-tracking=consolekit \ + --with-suspend-resume=consolekit \ + --with-hostname-persist=slackware \ + --build=$TARGET || exit 1 + +make $NUMJOBS || exit 1 +make install DESTDIR=$PKG || exit 1 + +# Don't ship .la files: +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Fix hardlinked manpages: +( cd $PKG/usr/man/man1 + ln -sf nmtui.1 nmtui-connect.1 + ln -sf nmtui.1 nmtui-edit.1 + ln -sf nmtui.1 nmtui-hostname.1 +) + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +# In case NetworkManager tries to install something here: +rm -f $PKG/etc/rc.d/rc.networkmanager + +# Don't clobber existing rc.networkmanager +# Don't run NetworkManager by default just because it got installed. +# Instead, the init script will have to be made executable first. +# This should avoid nasty surprises on potentially remotely located machines. +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.networkmanager > $PKG/etc/rc.d/rc.networkmanager.new +chmod 0644 $PKG/etc/rc.d/rc.networkmanager.new + +# Add the pm-utils hook back in +# xfce4-power-manager needs to be built *without* NM support +mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pm-utils/sleep.d/ +cat $CWD/55NetworkManager > $PKG/usr/lib${LIBDIRSUFFIX}/pm-utils/sleep.d/55NetworkManager +chmod 0755 $PKG/usr/lib${LIBDIRSUFFIX}/pm-utils/sleep.d/55NetworkManager + +# Add default (plain) config file to enable keyfile plugin +cat $CWD/NetworkManager.conf > $PKG/etc/NetworkManager/NetworkManager.conf.new + +# Set dhcp client to "dhcpcd" and rc-manager to "file" by default +mkdir -p $PKG/etc/NetworkManager/conf.d +cat $CWD/conf.d/00-dhcp-client.conf > $PKG/etc/NetworkManager/conf.d/00-dhcp-client.conf.new +cat $CWD/conf.d/00-rc-manager.conf > $PKG/etc/NetworkManager/conf.d/00-rc-manager.conf.new + +mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION +cp -a \ + AUTHORS CONTRIBUTING COPYING ChangeLog INSTALL NEWS README TODO \ + $PKG/usr/doc/$PKGNAM-$VERSION + +# If there's a ChangeLog, installing at least part of the recent history +# is useful, but don't let it get totally out of control: +if [ -r ChangeLog ]; then + cat ChangeLog | head -n 1000 > $PKG/usr/doc/$PKGNAM-$VERSION/ChangeLog + touch -r ChangeLog $PKG/usr/doc/$PKGNAM-$VERSION/ChangeLog +fi + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg --prepend -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD.txz + diff --git a/testing/source/NetworkManager/NetworkManager.conf b/testing/source/NetworkManager/NetworkManager.conf new file mode 100644 index 00000000..eb8f6ae1 --- /dev/null +++ b/testing/source/NetworkManager/NetworkManager.conf @@ -0,0 +1,7 @@ +# /etc/NetworkManager/NetworkManager.conf +# +# See additional config files (such as for DHCP settings) in ./conf.d + +[main] +plugins=keyfile + diff --git a/testing/source/NetworkManager/conf.d/00-dhcp-client.conf b/testing/source/NetworkManager/conf.d/00-dhcp-client.conf new file mode 100644 index 00000000..2fc42be4 --- /dev/null +++ b/testing/source/NetworkManager/conf.d/00-dhcp-client.conf @@ -0,0 +1,8 @@ +[main] +# Choose a DHCP client below. Upstream recommends internal, but results may vary. +# dhcpcd is the DHCP client usually used by Slackware: +dhcp=dhcpcd +# dhclient is the ISC reference DHCP client, part of the dhcp package: +#dhcp=dhclient +# This is a simple DHCP client that is built into NetworkManager: +#dhcp=internal diff --git a/testing/source/NetworkManager/conf.d/00-rc-manager.conf b/testing/source/NetworkManager/conf.d/00-rc-manager.conf new file mode 100644 index 00000000..c848c003 --- /dev/null +++ b/testing/source/NetworkManager/conf.d/00-rc-manager.conf @@ -0,0 +1,2 @@ +[main] +rc-manager=file diff --git a/testing/source/NetworkManager/doinst.sh b/testing/source/NetworkManager/doinst.sh new file mode 100644 index 00000000..6c88b8cf --- /dev/null +++ b/testing/source/NetworkManager/doinst.sh @@ -0,0 +1,42 @@ + +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +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 +config etc/NetworkManager/conf.d/00-rc-manager.conf.new +config etc/NetworkManager/conf.d/00-dhcp-client.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 + diff --git a/testing/source/NetworkManager/rc.networkmanager b/testing/source/NetworkManager/rc.networkmanager new file mode 100644 index 00000000..b6b311ed --- /dev/null +++ b/testing/source/NetworkManager/rc.networkmanager @@ -0,0 +1,113 @@ +#!/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" + XDG_CACHE_HOME=/root/.cache $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 + # If wpa_supplicant is running here, it needs to be shut down as well. + # Since you're asking for NetworkManager to shut down, we have to assume + # that wpa_supplicant was started by it. + if [ -r /var/run/wpa_supplicant.pid ]; then + kill $(cat /var/run/wpa_supplicant.pid) + elif [ -r /run/wpa_supplicant.pid ]; then + kill $(cat /run/wpa_supplicant.pid) + 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 diff --git a/testing/source/NetworkManager/slack-desc b/testing/source/NetworkManager/slack-desc new file mode 100644 index 00000000..31e34d44 --- /dev/null +++ b/testing/source/NetworkManager/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----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: |