diff --git a/testing/noip2/APKBUILD b/testing/noip2/APKBUILD new file mode 100644 index 00000000000..6254d5f4e40 --- /dev/null +++ b/testing/noip2/APKBUILD @@ -0,0 +1,51 @@ +# Contributor: Magnus Sandin +# Maintainer: Magnus Sandin +pkgname=noip2 +pkgver=2.1.9 +pkgrel=0 +pkgusers=noip +pkggroups=noip +pkgdesc="Dynamic DNS Update Client for noip.com" +url="https://www.noip.com" +arch="all" +license="GPL-2.0-or-later" +subpackages="$pkgname-doc $pkgname-openrc" +install="$pkgname.pre-install" +source="$pkgname-$pkgver.tar.gz::https://www.noip.com/client/linux/noip-duc-linux.tar.gz + fix_config_path.patch + noip2.confd + noip2.initd + " +builddir="$srcdir/noip-$pkgver-1" +options="!check" # No tests available + +build() { + make noip2 +} + +package() { + # binary + install -Dm755 noip2 -t "$pkgdir"/usr/bin/ + + # config + install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + mkdir -p "$pkgdir"/etc/$pkgname + chown $pkgusers:$pkggroups "$pkgdir"/etc/$pkgname + chmod 700 "$pkgdir"/etc/$pkgname + + # docs + mkdir -p "$pkgdir"/usr/share/doc/$pkgname + cp COPYING "$pkgdir"/usr/share/doc/$pkgname/ + cp README* "$pkgdir"/usr/share/doc/$pkgname/ + cp L*.* "$pkgdir"/usr/share/doc/$pkgname/ + + # open-rc + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname +} + +sha512sums=" +6c32397f31e6f4875a2429398c2627cbe52abba569830ddc1190fed3f4c6cb23e232e60b23d9fa97940f98a1c5c019a89812844f92a655c6ebf275b784015125 noip2-2.1.9.tar.gz +7c03dab93387aa786a2e487c22e23458d06b6cae2fc4dab20beee114cdd30a5ad5c8b7366d73fa85d34e11a65c11eaa118022cbd047cd79d8ffccb6f7fdc5396 fix_config_path.patch +c60b567d1cbaeb910917b004406aee102da4281949e8f75fabd9b8951e4ab019187390fc29655cb5a2e6161555b6bfaea7b72b587cd7be3a55f5bb81dbdc69ac noip2.confd +38ba5c089d00fe4713bfb285b1047e0278d8fed948a0f71b30331a0f4ec90be854b475703cc65ed1a8955842167075735115f7dc2bb409c4bfa24c07b39e2649 noip2.initd +" diff --git a/testing/noip2/fix_config_path.patch b/testing/noip2/fix_config_path.patch new file mode 100644 index 00000000000..df0845f4a34 --- /dev/null +++ b/testing/noip2/fix_config_path.patch @@ -0,0 +1,13 @@ +--- a/noip2.c ++++ b/noip2.c +@@ -242,8 +242,8 @@ + #ifndef PREFIX + #define PREFIX "/usr/local" + #endif +-#define CONFIG_FILEPATH PREFIX"/etc" +-#define CONFIG_FILENAME PREFIX"/etc/no-ip2.conf" ++#define CONFIG_FILEPATH "/etc/noip2" ++#define CONFIG_FILENAME "/etc/noip2/no-ip2.conf" + #define CONFSTRLEN 1024 + #define MAX_DEVLEN 16 + #define MAX_INSTANCE 4 diff --git a/testing/noip2/noip2.confd b/testing/noip2/noip2.confd new file mode 100644 index 00000000000..9f6b1f7829d --- /dev/null +++ b/testing/noip2/noip2.confd @@ -0,0 +1,4 @@ +# /etc/conf.d/noip2 + +CFGFILE="/etc/noip2/no-ip2.conf" +ARGS="" diff --git a/testing/noip2/noip2.initd b/testing/noip2/noip2.initd new file mode 100644 index 00000000000..e7a496843a7 --- /dev/null +++ b/testing/noip2/noip2.initd @@ -0,0 +1,48 @@ +#!/sbin/openrc-run +command="/usr/bin/noip2" +command_user="noip:noip" +procname="noip2" + +description="no-ip.com Dynamic DNS Update Client" +description_checkconfig="Verify existenace of a configuration file" +description_configure="Generate a configuration file" + +extra_commands="checkconfig configure" + +depend() { + use logger dns + need net +} + +checkconfig() { + if [ ! -f "${CFGFILE}" ] ; then + eerror "Please create ${CFGFILE} by using the command configure" + return 1 + fi + return 0 +} + +configure() { + if [ -r "${CFGFILE}" ] ; then + read -p "Configuration file already exist, overwrite it? [y/N]: " a + if [[ "$a" != "y" ]] && [[ "$a" != "Y" ]] ; then + eerror "Aborting" + return 1 + fi + fi + + su -mp -s /bin/sh noip -c "$command -C" +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ] ; then + checkconfig || return $? + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return $? + fi +} + diff --git a/testing/noip2/noip2.pre-install b/testing/noip2/noip2.pre-install new file mode 100644 index 00000000000..74b768efd3c --- /dev/null +++ b/testing/noip2/noip2.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup -S noip 2>/dev/null +adduser -S -D -H -s /sbin/nologin -G noip -g noip noip 2>/dev/null + +exit 0