From 126b94a63ea6a4f41878993a5d727b50daeacee3 Mon Sep 17 00:00:00 2001 From: Martin Väth Date: Sun, 3 Jan 2016 11:45:14 +0100 Subject: net-dns/noip-updater: Copy from gentoo repository to save from removal. Bump to EAPI=6. Support optionally user ez-ipupd instead of nobody. Fix initscript: runscript->openrc-run, avoid bashism. --- net-dns/noip-updater/Manifest | 1 + net-dns/noip-updater/files/noip-2.1.9-daemon.patch | 21 ++++++ net-dns/noip-updater/files/noip-2.1.9-flags.patch | 11 ++++ net-dns/noip-updater/files/noip.service | 12 ++++ net-dns/noip-updater/files/noip2.start | 34 ++++++++++ net-dns/noip-updater/metadata.xml | 15 +++++ net-dns/noip-updater/noip-updater-2.1.9-r2.ebuild | 76 ++++++++++++++++++++++ 7 files changed, 170 insertions(+) create mode 100644 net-dns/noip-updater/Manifest create mode 100644 net-dns/noip-updater/files/noip-2.1.9-daemon.patch create mode 100644 net-dns/noip-updater/files/noip-2.1.9-flags.patch create mode 100644 net-dns/noip-updater/files/noip.service create mode 100644 net-dns/noip-updater/files/noip2.start create mode 100644 net-dns/noip-updater/metadata.xml create mode 100644 net-dns/noip-updater/noip-updater-2.1.9-r2.ebuild (limited to 'net-dns') diff --git a/net-dns/noip-updater/Manifest b/net-dns/noip-updater/Manifest new file mode 100644 index 00000000..226b2e15 --- /dev/null +++ b/net-dns/noip-updater/Manifest @@ -0,0 +1 @@ +DIST noip-2.1.9.tar.gz 152995 SHA256 86ad0a6362263a33f59a658d1b1ce428e255556ddad0d062aa0ee4b7f412f98a diff --git a/net-dns/noip-updater/files/noip-2.1.9-daemon.patch b/net-dns/noip-updater/files/noip-2.1.9-daemon.patch new file mode 100644 index 00000000..b2fb4e66 --- /dev/null +++ b/net-dns/noip-updater/files/noip-2.1.9-daemon.patch @@ -0,0 +1,21 @@ +diff -ur a/noip2.c b/noip2.c +--- a/noip2.c 2004-01-09 14:18:39.000000000 +0000 ++++ b/noip2.c 2007-07-20 14:02:41.100377515 +0100 +@@ -895,16 +895,13 @@ + char *err_string; + static int startup = 1; + +- x = fork(); ++ x = daemon (0, 0); + switch (x) { + case -1: // error + err_string = strerror(errno); + Msg( "Can't fork!! (%s) Ending!\n", err_string); + return FATALERR; +- default: // parent +- exit(0); + case 0: //child +- setsid(); + if (get_shm_info() == FATALERR) + return FATALERR; + log2syslog++; diff --git a/net-dns/noip-updater/files/noip-2.1.9-flags.patch b/net-dns/noip-updater/files/noip-2.1.9-flags.patch new file mode 100644 index 00000000..9fe05f36 --- /dev/null +++ b/net-dns/noip-updater/files/noip-2.1.9-flags.patch @@ -0,0 +1,11 @@ +--- a/Makefile 2006-09-07 09:52:55.000000000 +0200 ++++ b/Makefile 2006-09-07 09:54:54.000000000 +0200 +@@ -21,7 +21,7 @@ + # ARCH=sun + + ${TGT}: Makefile ${TGT}.c +- ${CC} -Wall -g -D${ARCH} -DPREFIX=\"${PREFIX}\" ${TGT}.c -o ${TGT} ${LIBS} ++ ${CC} ${CFLAGS} -D${ARCH} -DPREFIX=\"${PREFIX}\" ${TGT}.c -o ${TGT} ${LIBS} ${LDFLAGS} + + install: ${TGT} + if [ ! -d ${BINDIR} ]; then mkdir -p ${BINDIR};fi diff --git a/net-dns/noip-updater/files/noip.service b/net-dns/noip-updater/files/noip.service new file mode 100644 index 00000000..b4834e84 --- /dev/null +++ b/net-dns/noip-updater/files/noip.service @@ -0,0 +1,12 @@ +[Unit] +Description=No-IP Dynamic DNS Update Client +Require=network-online.target +After=network-online.target + +[Service] +Type=forking +ExecStart=/usr/sbin/noip2 -c /etc/no-ip2.conf + +[Install] +WantedBy=multi-user.target + diff --git a/net-dns/noip-updater/files/noip2.start b/net-dns/noip-updater/files/noip2.start new file mode 100644 index 00000000..20723ab2 --- /dev/null +++ b/net-dns/noip-updater/files/noip2.start @@ -0,0 +1,34 @@ +#!/sbin/openrc-run + +depend() { + need localmount + need net + use dns +} + +checkconfig() { + if [ ! -f /etc/no-ip2.conf ] + then + einfo "Answer the following questions about your no-ip account." + noip2 -C || return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting noip" + start-stop-daemon --quiet --start -x /usr/sbin/noip2 -- -c /etc/no-ip2.conf + eend $? "noip did not start, error code $?" +} + +stop() { + ebegin "Stopping noip" + start-stop-daemon --quiet --stop -x /usr/sbin/noip2 + noip_ecode=$? + eend $noip_ecode "Error stopping the noip daemon, error $noip_ecode" + checkconfig || return 1 + ebegin "Setting noip addresses to 0.0.0.0" + noip2 -c /etc/no-ip2.conf -i 0.0.0.0 >/dev/null 2>&1 + eend $? "Failed to set noip addresses to 0.0.0.0, error $?" + return $noip_ecode +} diff --git a/net-dns/noip-updater/metadata.xml b/net-dns/noip-updater/metadata.xml new file mode 100644 index 00000000..6ac11ba8 --- /dev/null +++ b/net-dns/noip-updater/metadata.xml @@ -0,0 +1,15 @@ + + + + proxy-maintainers + + martin@mvath.de + Martin Väth + + + no-ip.com dynamic DNS updater + + + Use user/group ezipupd instead of nobody: Useful if you restrict outgoing network traffic for user nobody + + diff --git a/net-dns/noip-updater/noip-updater-2.1.9-r2.ebuild b/net-dns/noip-updater/noip-updater-2.1.9-r2.ebuild new file mode 100644 index 00000000..ea3fe35e --- /dev/null +++ b/net-dns/noip-updater/noip-updater-2.1.9-r2.ebuild @@ -0,0 +1,76 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 +inherit eutils readme.gentoo-r1 systemd toolchain-funcs user + +MY_P=${P/-updater/} +DESCRIPTION="no-ip.com dynamic DNS updater" +HOMEPAGE="http://www.no-ip.com" +SRC_URI="http://www.no-ip.com/client/linux/${MY_P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 ~arm ~hppa ia64 ~mips ~ppc ppc64 sparc x86" +IUSE="ezipupd" + +RDEPEND="" +DEPEND="sys-devel/gcc" + +S=${WORKDIR}/${MY_P} + +DOC_CONTENTS=" + Configuration can be done manually via /usr/sbin/noip2 -C or + by using this ebuild's config option. +" + +src_prepare() { + eapply "${FILESDIR}"/noip-2.1.9-flags.patch + eapply "${FILESDIR}"/noip-2.1.9-daemon.patch + local sedarg + sedarg=( + -e "s:\(#define CONFIG_FILEPATH\).*:\1 \"/etc\":" + -e "s:\(#define CONFIG_FILENAME\).*:\1 \"/etc/no-ip2.conf\":" + ) + ! use ezipupd || sedarg+=( + -e "s:\"nobodoy\":\"ez-ipupd\":g" + ) + sed -i "${sedarg[@]}" noip2.c || die "sed failed" + eapply_user +} + +src_compile() { + emake \ + CC=$(tc-getCC) \ + PREFIX=/usr \ + CONFDIR=/etc +} + +src_install() { + dosbin noip2 + dodoc README.FIRST + newinitd "${FILESDIR}"/noip2.start noip + systemd_dounit "${FILESDIR}"/noip.service + readme.gentoo_create_doc +} + +pkg_preinst() { + use ezipupd && ! use prefix || return 0 + enewgroup ez-ipupd + enewuser ez-ipupd -1 -1 /var/cache/ez-ipupdate ez-ipupd + if test -d /var/cache/ez-ipupdate + then chmod 750 /var/cache/ez-ipupdate + chown ez-ipupd:ez-ipupd /var/cache/ez-ipupdate + fi +} + +pkg_postinst() { + readme.gentoo_print_elog +} + +pkg_config() { + cd /tmp + einfo "Answer the following questions." + noip2 -C || die +} -- cgit v1.2.3-65-gdbad