Subject: [alpine-devel] [PATCH 1/2] ifplugd: new aport

From: Pablo Castorino <[email-masked]>
Date: Tue, 20 Nov 2012 09:55:19 -0300

---
 testing/ifplugd/APKBUILD      |   48 +++++++++++++++++++++++++++++++++++++++++
 testing/ifplugd/ifplugd.initd |   32 +++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 testing/ifplugd/APKBUILD
 create mode 100644 testing/ifplugd/ifplugd.initd

diff --git a/testing/ifplugd/APKBUILD b/testing/ifplugd/APKBUILD
new file mode 100644
index 0000000..8a75dfd
--- /dev/null
+++ b/testing/ifplugd/APKBUILD
@@ -0,0 +1,48 @@
+# Contributor: Pablo Castorino <[email-masked]>
+# Maintainer:
+pkgname=ifplugd
+pkgver=0.28
+pkgrel=0
+pkgdesc="ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected."
+url="http://0pointer.de/lennart/projects/ifplugd"
+arch="all"
+license="GPL2"
+depends="libdaemon"
+depends_dev="libdaemon-dev"
+makedepends="$depends_dev"
+install=""
+subpackages=""
+source="http://0pointer.de/lennart/projects/ifplugd/ifplugd-$pkgver.tar.gz
+	$pkgname.initd"
+
+_builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+		./configure --prefix=/usr \
+		--sysconfdir=/etc \
+		--localstatedir=/var \
+        --disable-lynx \
+                || return 1
+        make || return 1
+}
+
+package() {
+	cd "$_builddir"
+ 	make DESTDIR="$pkgdir" install
+ 	install -m755 -D "$pkgdir"/etc/init.d/$pkgname "$pkgdir"/usr/sbin/$pkgname-helper
+ 	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+}
+
+md5sums="df6f4bab52f46ffd6eb1f5912d4ccee3  ifplugd-0.28.tar.gz
+7d7d45d6cf8edcb46ff18bedf7cfb961  ifplugd.initd"
diff --git a/testing/ifplugd/ifplugd.initd b/testing/ifplugd/ifplugd.initd
new file mode 100644
index 0000000..c5b8ec5
--- /dev/null
+++ b/testing/ifplugd/ifplugd.initd
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/ifplugd.init,v 1.2 2007/02/25 09:57:18 mrness Exp $
+
+depend() {
+	need net
+	after firewall opennhrp
+}
+
+checkconfig() {
+        if [ ! -e /etc/ifplugd/ifplugd.conf ] ; then
+        	eerror "You need to create /etc/ifplugd/ifplugd.conf first."
+          return 1
+        fi
+}
+
+start() {
+	checkconfig || return 1
+
+	ebegin "Starting ifplugd"
+	sh /usr/sbin/ifplugd-helper start
+	result=$?
+	eend $result
+}
+
+stop() {
+	ebegin "Stopping ifplugd"
+	sh /usr/sbin/ifplugd-helper stop
+	result=$?
+	eend $result
+}
-- 
1.7.10

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Wed, 21 Nov 2012 10:40:36 +0100

On Tue, 20 Nov 2012 09:55:19 -0300
Pablo Castorino <[email-masked]> wrote:

> ---
>  testing/ifplugd/APKBUILD      |   48

Applied. I also fixed mandir, added a -doc subpackage and removed
libdaemon depends as it gets autodetected by abuild.

> +++++++++++++++++++++++++++++++++++++++++
> testing/ifplugd/ifplugd.initd |   32 +++++++++++++++++++++++++++ 2
> files changed, 80 insertions(+) create mode 100644
> testing/ifplugd/APKBUILD create mode 100644
> testing/ifplugd/ifplugd.initd
> 
...

> +	sh /usr/sbin/ifplugd-helper start

I think the ifplugd-helper script, which appears to be a sysv/upstart
script, should be ported to a proper openrc runscript. In other words,
do what the helper script does in initd instead of just wrap it.

> +	eend $result

-nc

---