X-Original-To: alpine-aports@lists.alpinelinux.org Received: from mail.toastin.space (mail.toastin.space [207.246.93.162]) by lists.alpinelinux.org (Postfix) with ESMTP id 753AF5C5917 for ; Wed, 7 Nov 2018 03:00:39 +0000 (GMT) Received: from mail.toastin.space (localhost [127.0.0.1]) by mail.toastin.space (OpenSMTPD) with ESMTP id 57df7f3b for ; Tue, 6 Nov 2018 22:00:39 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=toastin.space; h=from:to :subject:date:message-id:mime-version:content-transfer-encoding; s=ml; bh=MBc+9LYhCcSOz6s9OynJRHMj+eE=; b=Hr0JvtEeJiQsJQZhTznZ/a ZjPN9pBoT0KitKmF9P35N9rfPb84CyBH2G6h4cdIUVDBn5oyz0JHgMxsuSHjeDUH VhCj/lIXe5ITLCLJtkbCpP+iS0QRlN1Caq/ErCYXY6yOJUswAwntb4q/DVG3dig3 PU43zQujuMBlNu3bq8Y7GrI6eWMHGeaRUGFBLJlvIRBL+a/6HXCErRKZd8lKHCEW 2Q28WhkRUdf2yxO0XuiNUwZj4y6ANP7xH6emESVul1c11bXsFYwwFe32opApVqye B5iMIetxnhJYDpKKy4dpitGMq2cu0BaItMu5vB5M0KFw1HlyLwIAnFp2bBHlExpg == DomainKey-Signature: a=rsa-sha1; c=nofws; d=toastin.space; h=from:to :subject:date:message-id:mime-version:content-transfer-encoding; q=dns; s=ml; b=KffvR2Ekyw4A9xSbwy1kUyl9D1YOBHRTy8OvdyRZrCFhHAzI SCKCqeHMrfsHfbn2NfHypiv7XYqLfLGqO4u0f/qQLWUl6Ip3oR0GhJgqE2GMk8Ik IZ5oA52k7tzO2uYiM0PUyd7muNMesnMvOvErz6frP43+S/dVwkOScTXevcEFpUWe /pUSxOaskkWXCEOmpap8TT12+MvC77nh/UTM/SJYUBjcSRCbq0L+vVnMSyjIkk6g fIOtuBrUasH0tQB9ZqRoIayXARiCUFLc2YOJzvZ4iF0N+fCQCcwGopJzqzStxfHx Da1jcKlqfnyAxJOc019nRLzSQ7pHpganOt+LcA== Received: from LapToast.home.toastin.space (192-222-169-215.qc.cable.ebox.net [192.222.169.215]) by mail.toastin.space (OpenSMTPD) with ESMTPSA id 7e226fcd (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Tue, 6 Nov 2018 22:00:39 -0500 (EST) From: Chloe Kudryavtsev To: alpine-aports@lists.alpinelinux.org Subject: [alpine-aports] [PATCH] main/ferm: add check, documentation, openrc Date: Tue, 6 Nov 2018 22:00:38 -0500 Message-Id: <20181107030038.8869-1-toast@toastin.space> X-Mailer: git-send-email 2.19.1 X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit - ferm has a test suite, which passes - ferm has multiple (generated) pieces of documentation - it makes sense to use ferm in-place of iptables-save This patch adds tests, packages docs, and adds an openrc init script that I've been using for about a month now. For well-behaved packages (`need firewall`, rather than `need iptables) it can be an in-place replacement (as it `provide firewall`). --- main/ferm/APKBUILD | 40 +++++++++++++++++++++++++++++++--------- main/ferm/ferm.confd | 1 + main/ferm/ferm.initd | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 main/ferm/ferm.confd create mode 100755 main/ferm/ferm.initd diff --git a/main/ferm/APKBUILD b/main/ferm/APKBUILD index d5eccce8b5..05b25ef005 100644 --- a/main/ferm/APKBUILD +++ b/main/ferm/APKBUILD @@ -2,26 +2,48 @@ # Maintainer: Michael Mason pkgname=ferm pkgver=2.4.1 -pkgrel=0 +pkgrel=1 pkgdesc="firewall configuration tool" url="http://ferm.foo-projects.org/" arch="noarch" license="GPL" depends="perl iptables" -options="!check" -source="http://ferm.foo-projects.org/download/${pkgver%.*}/$pkgname-$pkgver.tar.xz" +source=" + http://ferm.foo-projects.org/download/${pkgver%.*}/$pkgname-$pkgver.tar.xz + ferm.confd + ferm.initd + " +subpackages="$pkgname-doc $pkgname-openrc" builddir="$srcdir"/$pkgname-$pkgver build() { - return 0 + cd "$builddir" + make +} + +check() { + cd "$builddir" + make check } package() { cd "$builddir" - install -m755 -D "$srcdir"/"$pkgname-$pkgver"/src/ferm \ - "$pkgdir"/usr/sbin/"$pkgname" - install -m755 -D "$srcdir"/"$pkgname-$pkgver"/src/import-ferm \ - "$pkgdir"/usr/sbin/import-ferm + install -m755 -D src/ferm "$pkgdir/usr/sbin/$pkgname" + install -m755 -D src/import-ferm "$pkgdir/usr/sbin/import-$pkgname" + + install -m644 -D doc/ferm.1 "$pkgdir/usr/share/man/man1/ferm.1" + install -m644 -D doc/import-ferm.1 \ + "$pkgdir/usr/share/man/man1/import-ferm.1" + install -m644 -D doc/ferm.txt "$pkgdir/usr/share/doc/ferm.txt" + install -m644 -D doc/ferm.html "$pkgdir/usr/share/html/ferm.html" + + install -m644 -D "$srcdir/ferm.confd" "$pkgdir/etc/conf.d/$pkgname" + install -m755 -D "$srcdir/ferm.initd" "$pkgdir/etc/init.d/$pkgname" } -sha512sums="beea4b8dd04e00662ef380442f8249c2d2dadf6d35b90e415038df807c8d08295d2575efbf3265f48f5e92afa174135a9c662f74d52545dd3e1c55a1436aa5bb ferm-2.4.1.tar.xz" +openrc() { + mv "$pkgdir/etc" "$subpkgdir/" +} +sha512sums="beea4b8dd04e00662ef380442f8249c2d2dadf6d35b90e415038df807c8d08295d2575efbf3265f48f5e92afa174135a9c662f74d52545dd3e1c55a1436aa5bb ferm-2.4.1.tar.xz +26e4673f7c8d0f77eb1d8fdc2051f1a3729e482b075346c65e39305e29014391c390c682cd597cf3dc67fa0f9fe69818e928c41cb362814a69fc67e8bbdf7ad5 ferm.confd +c36a275d7abeac7dcb17240311b47007aafa8e07e4fd50ce45af3d79e713627624d26eea1bffe7854824f2c174a18524669cedab510ca9cea1565dda4606d394 ferm.initd" diff --git a/main/ferm/ferm.confd b/main/ferm/ferm.confd new file mode 100644 index 0000000000..2a4037d25c --- /dev/null +++ b/main/ferm/ferm.confd @@ -0,0 +1 @@ +inputfile=/etc/ferm/ferm.conf diff --git a/main/ferm/ferm.initd b/main/ferm/ferm.initd new file mode 100755 index 0000000000..d855f6f79a --- /dev/null +++ b/main/ferm/ferm.initd @@ -0,0 +1,40 @@ +#!/sbin/openrc-run + +name="ferm" +description="For Easy Rule Making is a perl-based iptables frontend" +description_checkconfig="Checks script validity" + +extra_commands="checkconfig" + +depend() { + after net sysctl + provide firewall +} + +checkconfig() { + ferm -n "$inputfile" +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ] ; then + checkconfig || return $? + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return $? + fi +} + +start() { + ebegin "Loading $inputfile rules" + ferm "$inputfile" + eend $? +} + +stop() { + ebegin "Unloading $inputfile rules" + ferm -F "$inputfile" + eend $? +} -- 2.19.1 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---