[arch-commits] Commit in ifplugd/trunk (9 files)
Thomas Bächler
thomas at archlinux.org
Wed Aug 29 19:13:32 UTC 2012
Date: Wednesday, August 29, 2012 @ 15:13:31
Author: thomas
Revision: 165777
ifplugd: 0.28-12
* Add systemd file
* Do not provide a default action script
* Revert config file to upstream default
Added:
ifplugd/trunk/ifplugd-daemon
ifplugd/trunk/ifplugd.install
ifplugd/trunk/ifplugd.systemd
Modified:
ifplugd/trunk/PKGBUILD
ifplugd/trunk/ifplugd
Deleted:
ifplugd/trunk/ifdown.01-route.sh
ifplugd/trunk/ifplugd.action
ifplugd/trunk/ifup.01-route.sh
ifplugd/trunk/ifup.02-ntpdate.sh
--------------------+
PKGBUILD | 43 +++++++++++++++++++------------------------
ifdown.01-route.sh | 3 ---
ifplugd | 15 +++------------
ifplugd-daemon | 7 +++++++
ifplugd.action | 30 ------------------------------
ifplugd.install | 13 +++++++++++++
ifplugd.systemd | 10 ++++++++++
ifup.01-route.sh | 5 -----
ifup.02-ntpdate.sh | 2 --
9 files changed, 52 insertions(+), 76 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2012-08-29 15:06:24 UTC (rev 165776)
+++ PKGBUILD 2012-08-29 19:13:31 UTC (rev 165777)
@@ -5,27 +5,31 @@
pkgname=ifplugd
pkgver=0.28
-pkgrel=11
+pkgrel=12
pkgdesc="A daemon which brings up/down network interfaces upon cable insertion/removal."
arch=('i686' 'x86_64')
url="http://0pointer.de/lennart/projects/ifplugd"
+install=ifplugd.install
license=('GPL2')
-depends=('libdaemon' 'bash' 'net-tools')
-backup=('etc/ifplugd/ifplugd.conf' 'etc/ifplugd/ifplugd.action')
+depends=('libdaemon' 'bash')
+backup=('etc/ifplugd/ifplugd.conf')
options=('!makeflags')
-source=($url/${pkgname}-${pkgver}.tar.gz 'ifplugd' 'ifplugd.action' 'ifplugd-0.28-interface.patch' 'ifdown.01-route.sh' 'ifup.01-route.sh' 'ifup.02-ntpdate.sh')
+source=($url/${pkgname}-${pkgver}.tar.gz
+ ifplugd-0.28-interface.patch
+ ifplugd
+ ifplugd-daemon
+ ifplugd.systemd)
md5sums=('df6f4bab52f46ffd6eb1f5912d4ccee3'
- '2281cd3eda9e3403857863e1a1bc00be'
- '6f98767c4ea2cf0580f73ced81efd21a'
'54eb22844b5aeed161c0b80aa9008570'
- 'd6ce6c7bd481a0b3944c944c5b277c0b'
- 'c35f0a637911b747f8dc3bd3c6156a1b'
- 'f8690ee18a5ca72555585ee96826c2cf')
+ '158bda9014eb35979af9b094feca5fe1'
+ 'f2e8a37af52b79ee0e3c5bcc2470ce10 '
+ 'cd97aad168c109e23824c1011165f94f')
build() {
cd ${srcdir}/${pkgname}-${pkgver}
patch -p0 -i $srcdir/ifplugd-0.28-interface.patch
- ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc \
+ sed 's|/var/run|/run|' -i src/ifplugd.c
+ ./configure --prefix=/usr --sbindir=/usr/bin --mandir=/usr/share/man --sysconfdir=/etc \
--with-initdir=/etc/rc.d --disable-xmltoman --disable-subversion --disable-lynx
make
}
@@ -34,20 +38,11 @@
cd ${srcdir}/${pkgname}-${pkgver}
make DESTDIR=${pkgdir} install
- # replace INTERFACES with NET_IFS since AL already uses it in /etc/rc.conf
- sed -i "s:INTERFACES:NET_IFS:g" \
- ${pkgdir}/etc/ifplugd/ifplugd.conf
-
# replace the default init script & action files with ours.
install -D -m755 ${srcdir}/ifplugd ${pkgdir}/etc/rc.d/ifplugd
- install -D -m755 ${srcdir}/ifplugd.action \
- ${pkgdir}/etc/ifplugd/ifplugd.action
-
- install -Dm755 ${srcdir}/ifdown.01-route.sh \
- ${pkgdir}/etc/ifplugd/ifdown.d/01-route.sh
- install -Dm755 ${srcdir}/ifup.01-route.sh \
- ${pkgdir}/etc/ifplugd/ifup.d/01-route.sh
- install -Dm755 ${srcdir}/ifup.02-ntpdate.sh \
- ${pkgdir}/etc/ifplugd/ifup.d/02-ntpdate.sh
+ install -D -m755 ${srcdir}/ifplugd-daemon ${pkgdir}/usr/bin/ifplugd-daemon
+ # remove default action script
+ rm -f ${pkgdir}/etc/ifplugd/ifplugd.action
+ # install systemd unit
+ install -D -m644 ${srcdir}/ifplugd.systemd ${pkgdir}/usr/lib/systemd/system/ifplugd at .service
}
-
Deleted: ifdown.01-route.sh
===================================================================
--- ifdown.01-route.sh 2012-08-29 15:06:24 UTC (rev 165776)
+++ ifdown.01-route.sh 2012-08-29 19:13:31 UTC (rev 165777)
@@ -1,3 +0,0 @@
-#!/bin/sh
-# same as up...
-/sbin/route del $1
\ No newline at end of file
Modified: ifplugd
===================================================================
--- ifplugd 2012-08-29 15:06:24 UTC (rev 165776)
+++ ifplugd 2012-08-29 19:13:31 UTC (rev 165777)
@@ -16,14 +16,7 @@
[[ -r $cfg ]] && . "$cfg"
# discover interfaces to monitor
-# (replacing INTERFACES with NET_IFS, since AL
-# already uses it in /etc/rc.conf)
-if [[ $NET_IFS ]]; then
- net_ifs=($NET_IFS)
-else
- net_ifs=(/sys/class/net/!(lo))
- net_ifs=("${net_ifs[@]##*/}")
-fi
+net_ifs=($INTERFACES)
case $1 in
start)
@@ -31,10 +24,8 @@
for nic in "${net_ifs[@]}"; do
# only start if a PID doesn't already exist
- if [[ ! -f /var/run/ifplugd.$nic.pid ]]; then
- args=ARGS_$nic
- [[ -z ${!args} ]] && args=$ARGS || args=${!args}
- ifplugd -i "$nic" $args
+ if [[ ! -f /var/run/ifplugd.$nic.pid ]];
+ /usr/bin/ifplugd-daemon $nic
# use presence of PID file to check for start success
[[ -f /var/run/ifplugd.$nic.pid ]] || (( ++err ))
Added: ifplugd-daemon
===================================================================
--- ifplugd-daemon (rev 0)
+++ ifplugd-daemon 2012-08-29 19:13:31 UTC (rev 165777)
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+. /etc/ifplugd/ifplugd.conf
+
+args=ARGS_$1
+[[ -z ${!args} ]] && args=$ARGS || args=${!args}
+/usr/bin/ifplugd -i "$1" $args
Property changes on: ifplugd/trunk/ifplugd-daemon
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Deleted: ifplugd.action
===================================================================
--- ifplugd.action 2012-08-29 15:06:24 UTC (rev 165776)
+++ ifplugd.action 2012-08-29 19:13:31 UTC (rev 165777)
@@ -1,30 +0,0 @@
-#!/bin/bash
-#
-# ifplugd.action script for Arch Linux
-#
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-plugscript() { # arguments are ifup|ifdown, interface_name
- for script in /etc/ifplugd/$1.d/*.sh; do
- [[ -x $script ]] && "$script" $2
- done
- return 0
-}
-
-case $2 in
- up)
- /etc/rc.d/network ifup "$1"
- plugscript ifup "$1"
- ;;
- down)
- plugscript ifdown "$1"
- /etc/rc.d/network ifdown $1
- ;;
- *)
- echo "Wrong arguments" >&2
- ;;
-esac
-
-exit 1
Added: ifplugd.install
===================================================================
--- ifplugd.install (rev 0)
+++ ifplugd.install 2012-08-29 19:13:31 UTC (rev 165777)
@@ -0,0 +1,13 @@
+post_upgrade() {
+ if [ $(vercmp $2 0.28-12) -lt 0 ]; then
+ cat << "EOF"
+* When used with initscripts, /etc/ifplugd/ifplugd.conf now uses
+ INTERFACES= again instead of NET_IFS=.
+* This package no longer provides a default ifplugd.action script.
+* To use ifplugd with systemd, run
+ systemctl enable ifplugd at eth0.service
+EOF
+ fi
+}
+
+# vim:set ts=2 sw=2 et:
Added: ifplugd.systemd
===================================================================
--- ifplugd.systemd (rev 0)
+++ ifplugd.systemd 2012-08-29 19:13:31 UTC (rev 165777)
@@ -0,0 +1,10 @@
+[Unit]
+Description=Daemon which acts upon network cable insertion/removal
+
+[Service]
+Type=forking
+PIDFile=/run/ifplugd.%i.pid
+ExecStart=/usr/bin/ifplugd-daemon %i
+
+[Install]
+WantedBy=multi-user.target
Deleted: ifup.01-route.sh
===================================================================
--- ifup.01-route.sh 2012-08-29 15:06:24 UTC (rev 165776)
+++ ifup.01-route.sh 2012-08-29 19:13:31 UTC (rev 165777)
@@ -1,5 +0,0 @@
-#!/bin/sh
-# ugly way to load up gateway, since
-# al's net configuration doesn't associate
-# gateways with specific interfaces.
-/sbin/route add $gateway
Deleted: ifup.02-ntpdate.sh
===================================================================
--- ifup.02-ntpdate.sh 2012-08-29 15:06:24 UTC (rev 165776)
+++ ifup.02-ntpdate.sh 2012-08-29 19:13:31 UTC (rev 165777)
@@ -1,2 +0,0 @@
-#!/bin/sh
-ntpdate ru.pool.ntp.org | logger
More information about the arch-commits
mailing list