Subject: [alpine-devel] [PATCH] main/ez-ipupdate: new aport

From: Jeremy Thomerson <[email-masked]>
Date: Sat, 22 Aug 2009 00:05:37 -0500

Attached is my patch for adding ez-ipupdate.  I have not tested it on a real
box with a public IP, but I have run it in my chroot environment on my
laptop with an internal IP, and it was successfully running as a daemon and
updating DynDNS.  I did have a little worry because rc-status is indicating
that it is crashed, but I think this is because within the chroot
environment it can't tell the process is still running.  I'll have to test
that part on a real box later.

Let me know if you have any feedback on this.

Jeremy Thomerson
From 261fcd68d77c494c7728675a1e5cf3add65d962d Mon Sep 17 00:00:00 2001
From: Jeremy Thomerson <[email-masked]>
Date: Sat, 22 Aug 2009 05:00:23 +0000
Subject: [PATCH] main/ez-ipupdate: new aport

utility for updating your host name for many of the dynamic DNS services (ez-ip.net, dyndns.org, etc)
http://ez-ipupdate.com/
---
 main/ez-ipupdate/APKBUILD                 |   36 +++++++++++++++++++
 main/ez-ipupdate/ez-ipupdate.confd        |   34 ++++++++++++++++++
 main/ez-ipupdate/ez-ipupdate.initd        |   54 +++++++++++++++++++++++++++++
 main/ez-ipupdate/ez-ipupdate.post-install |    5 +++
 main/ez-ipupdate/ez-ipupdate.pre-install  |    5 +++
 5 files changed, 134 insertions(+), 0 deletions(-)
 create mode 100644 main/ez-ipupdate/APKBUILD
 create mode 100644 main/ez-ipupdate/ez-ipupdate.confd
 create mode 100644 main/ez-ipupdate/ez-ipupdate.initd
 create mode 100644 main/ez-ipupdate/ez-ipupdate.post-install
 create mode 100644 main/ez-ipupdate/ez-ipupdate.pre-install

diff --git a/main/ez-ipupdate/APKBUILD b/main/ez-ipupdate/APKBUILD
new file mode 100644
index 0000000..fbc0219
--- /dev/null
+++ b/main/ez-ipupdate/APKBUILD
@@ -0,0 +1,36 @@
+# Contributor: Jeremy Thomerson <[email-masked]>
+# Maintainer: Jeremy Thomerson <[email-masked]>
+pkgname=ez-ipupdate
+pkgver=3.0.10
+pkgrel=0
+pkgdesc="utility for updating your host name for many of the dynamic DNS services (ez-ip.net, dyndns.org, etc)"
+url="http://ez-ipupdate.com/"
+license="GPL"
+depends=""
+makedepends=""
+install="$pkgname.pre-install $pkgname.post-install"
+subpackages=""
+source="http://ez-ipupdate.com/dist/$pkgname-$pkgver.tar.gz
+	ez-ipupdate.confd
+	ez-ipupdate.initd
+	"
+
+build() {
+	cd "$srcdir"/$pkgname-$pkgver
+
+	./configure --prefix=/usr \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--infodir=/usr/share/info
+	make || return 1
+	make DESTDIR="$pkgdir" install
+
+	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+        install -d "$pkgdir"/var/lib/$pkgname
+	install -d "$pkgdir"/var/run/$pkgname
+}
+
+md5sums="6505c9d18ef6b5ce13fe2a668eb5724b  ez-ipupdate-3.0.10.tar.gz
+e6e06780b1896f2250132cc16cd10710  ez-ipupdate.confd
+04b773d467e9793c9a4e3b0e9d6a2f7f  ez-ipupdate.initd"
diff --git a/main/ez-ipupdate/ez-ipupdate.confd b/main/ez-ipupdate/ez-ipupdate.confd
new file mode 100644
index 0000000..10349cf
--- /dev/null
+++ b/main/ez-ipupdate/ez-ipupdate.confd
@@ -0,0 +1,34 @@
+# conf.d file for ez-ipupdate
+
+# NOTE: all of the options defined in this configuration file need
+# to remain in the file (do not remove them).  modify them as needed
+# or leave them at the default
+
+# the type of service that you are using
+#	try one of: ezip, pgpow, dhs, dyndns, 
+#	dyndns-static, ods, tzo, gnudip, easydns, 
+#	justlinux, dyns, hn, zoneedit
+SERVICE=""
+
+# What hostname are you updating?
+HOST=your-domain.service-domain.tld
+
+# Credentials used to update the service
+USER=yourusername
+PASS=yourpassword
+
+# Which interface has the IP to be updated?
+IFACE="eth0"
+
+# If you want your domain to have a wildcard alias, set this to 1
+WILDCARD=0
+
+# If you need to override the server to send updates to, do it here.
+#	You can also specify the port, in this format: server[:port] 
+SERVER=
+
+# max time in between updates (seconds - must be 86400 or larger)
+MAX_INTERVAL=86400
+
+# I/O timeout (seconds.millis)
+TIMEOUT=45.0
diff --git a/main/ez-ipupdate/ez-ipupdate.initd b/main/ez-ipupdate/ez-ipupdate.initd
new file mode 100644
index 0000000..45d2874
--- /dev/null
+++ b/main/ez-ipupdate/ez-ipupdate.initd
@@ -0,0 +1,54 @@
+#!/sbin/runscript
+
+# init.d file for ez-ipupdate
+
+NAME=ez-ipupdate
+DAEMON=/usr/bin/$NAME
+DAEMON_GROUP=ipupdate
+DAEMON_USER=ipupdate
+
+# load the config
+. /etc/conf.d/${NAME}
+
+# now convert it into command line options
+OPTS="-d -S ${SERVICE} -h ${HOST} -u \"${USER}:${PASS}\" -i ${IFACE}"
+if [ "$WILDCARD" == 1 ]; then
+        OPTS="${OPTS} -w"
+fi
+if [ "$SERVER" != "" ]; then
+        OPTS="${OPTS} -s \"${SERVER}\""
+fi
+OPTS="${OPTS} -t ${TIMEOUT} -M ${MAX_INTERVAL}"
+
+depend() {
+	need net
+}
+
+start() {
+        ebegin "Starting ${NAME}"
+                start-stop-daemon --start --quiet \
+                        --pidfile /var/run/${NAME}.pid \
+                        --chuid ${DAEMON_USER}:${DAEMON_GROUP} \
+                        --exec ${DAEMON} -- ${OPTS}
+        eend $?
+}
+
+stop() {
+	ebegin "Stopping ${NAME}"
+		start-stop-daemon --stop --quiet \
+			--exec ${DAEMON} \
+			--pidfile /var/run/${NAME}.pid \
+	eend $?
+}
+
+reload() {
+	ebegin "Reloading ${NAME}"
+	if ! service_started "${NAME}" ; then
+		eend 1 "${NAME} is not started"
+		return 1
+	fi
+	start-stop-daemon --stop --oknodo --signal HUP \
+		--exec ${DAEMON} --pidfile /var/run/${NAME}.pid
+	eend $?
+}
+
diff --git a/main/ez-ipupdate/ez-ipupdate.post-install b/main/ez-ipupdate/ez-ipupdate.post-install
new file mode 100644
index 0000000..846c211
--- /dev/null
+++ b/main/ez-ipupdate/ez-ipupdate.post-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+chown ipupdate:ipupdate var/run/ez-ipupdate var/lib/ez-ipupdate
+exit 0
+
diff --git a/main/ez-ipupdate/ez-ipupdate.pre-install b/main/ez-ipupdate/ez-ipupdate.pre-install
new file mode 100644
index 0000000..a8d0c47
--- /dev/null
+++ b/main/ez-ipupdate/ez-ipupdate.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+adduser -h /var/lib/ez-ipupdate -s /bin/false -D ipupdate 2>/dev/null
+exit 0
+
-- 
1.6.4

---

From: Natanael Copa <[email-masked]>
Date: Sat, 22 Aug 2009 14:58:03 +0000

On Sat, Aug 22, 2009 at 5:05 AM, Jeremy Thomerson <
[email-masked]> wrote:

> Attached is my patch for adding ez-ipupdate.  I have not tested it on a
> real box with a public IP, but I have run it in my chroot environment on my

I think the crash report problem comes from that the init.d script tried to
stor the pidfile in /var/run rather than /var/run/ez-ipupdate. It didnt have
permissions to write there and the pidfile was missing. With no pidfile it
reported it as crashed.

I commited the patch and fixed that issue. I have not been able to test it
though.

A tip, I normally just rip the init.d scripts from gentoo. They also use
openrc. But in this case i'm not sure if i prefer your way to do it than
gentoo version of init.d script.

Thanks!

-nc

-- 
Natanael Copa