Commit 37a63824 authored by Slugger@Github's avatar Slugger@Github
Browse files

address latest review comments

* remove pre/post scripts that modify services
* don't grab and package the jar from upstream, build the jar from source instead
* run tests against built jar
parent 1258ffd4
Pipeline #66341 failed with stages
in 21 minutes and 51 seconds
......@@ -7,29 +7,42 @@ pkgdesc="WireGuard management service for PIA"
url="https://github.com/Slugger/piawgmgr"
arch="noarch"
license="GPL-3.0-or-later"
options="!check" # tests run upstream
makedepends="git openjdk8"
depends="wireguard-tools openjdk8-jre-base sudo iputils"
install="$pkgname.pre-install $pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
install="$pkgname.pre-install $pkgname.post-install"
subpackages="$pkgname-doc $pkgname-openrc"
source="
$pkgname-$pkgver.tar.gz::https://github.com/Slugger/piawgmgr/archive/$pkgver.tar.gz
https://github.com/Slugger/piawgmgr/releases/download/$pkgver/piawgmgr-jar-$pkgver.tgz
"
builddir="$srcdir/"
_apksrcdir="$srcdir/piawgmgr-$pkgver/install/apk/src"
#source="$pkgname-$pkgver.tar.gz::https://github.com/Slugger/piawgmgr/archive/$pkgver.tar.gz"
builddir="$srcdir/piawgmgr"
_apkoutdir="$builddir/build/apk/piawgmgr"
_jaroutdir="$builddir/build/libs"
prepare() { # the jar must be built from git repo; build process extracts data from git repo
cd "$srcdir"
git clone ${url}.git
cd piawgmgr
git checkout $pkgver
}
build() {
cd "$builddir"
export PIAWGMGR_BRANCH=release/${pkgver%.*}; /bin/sh ./gradlew clean mkapk
}
check() {
cd "$builddir"
/bin/sh ./gradlew test
}
package() {
gzip -k "$_apksrcdir"/piawgmgr.man
install -m755 -D "$_apksrcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -m644 -D "$_apksrcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
install -m644 -D "$srcdir"/*.jar "$pkgdir"/usr/share/piawgmgr/piawgmgr.jar
install -m755 -D "$_apksrcdir"/piawgmgr "$pkgdir"/usr/bin/piawgmgr
install -m644 -D "$srcdir"/piawgmgr-$pkgver/piawgmgr.properties.ref "$pkgdir"/etc/piawgmgr/piawgmgr.properties.ref
install -m644 -D "$srcdir"/piawgmgr-$pkgver/piawgmgr.properties.sample "$pkgdir"/etc/piawgmgr/piawgmgr.properties.sample
install -m644 -D "$_apksrcdir"/piawgmgr.logrotate "$pkgdir"/etc/logrotate.d/piawgmgr
install -m400 -D "$_apksrcdir"/piawgmgr.sudoers "$pkgdir"/etc/sudoers.d/piawgmgr
install -m644 -D "$_apksrcdir"/piawgmgr.man.gz "$pkgdir"/usr/share/man/man1/piawgmgr.gz
gzip -k "$_apkoutdir"/piawgmgr.man
install -m755 -D "$_apkoutdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -m644 -D "$_apkoutdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
install -m644 -D "$_jaroutdir"/*.jar "$pkgdir"/usr/share/piawgmgr/piawgmgr.jar
install -m755 -D "$_apkoutdir"/piawgmgr "$pkgdir"/usr/bin/piawgmgr
install -m644 -D "$builddir"/piawgmgr.properties.ref "$pkgdir"/etc/piawgmgr/piawgmgr.properties.ref
install -m644 -D "$builddir"/piawgmgr.properties.sample "$pkgdir"/etc/piawgmgr/piawgmgr.properties.sample
install -m644 -D "$_apkoutdir"/piawgmgr.logrotate "$pkgdir"/etc/logrotate.d/piawgmgr
install -m400 -D "$_apkoutdir"/piawgmgr.sudoers "$pkgdir"/etc/sudoers.d/piawgmgr
install -m644 -D "$_apkoutdir"/piawgmgr.man.gz "$pkgdir"/usr/share/man/man1/piawgmgr.gz
}
sha512sums="6b5faeb23bb3b215c1fe0ea8a91b4ba1d916d4f0c2ce1bf21bc8a5369f99e72bb95b07bc7d91001c3bce735e58afc33b6551b65681f15e6a95b4c4ff18ce7712 piawgmgr-0.0.1.tar.gz
a9c59512ff0b5eb12aeff65c92012af16de2e79d805b3ed61f572d82466940ace9d19cc1d8086285bf8699a75d116b4efbba9d3316aee001fe1d65aa24106638 piawgmgr-jar-0.0.1.tgz"
......@@ -19,18 +19,21 @@
SYSCTL=/sbin/sysctl
INSTALL=/usr/bin/install
if [ ! -d /var/log/piawgmgr ]; then
$INSTALL -m700 -o piawgmgr -g piawgmgr -d /var/log/piawgmgr
SVCUSER=piawgmgr
LOGDIR=/var/log/piawgmgr
if [ ! -d $LOGDIR ]; then
$INSTALL -m700 -o $SVCUSER -g $SVCUSER -d $LOGDIR
fi
SYSCTL_IPV4_FWDING=net.ipv4.conf.all.forwarding
SYSCTL_IPV4_FWDING=net.ipv4.ip_forward
IPFWD=`$SYSCTL -n $SYSCTL_IPV4_FWDING`
if [ "$IPFWD" != "1" ]; then
cat << EOF
WARNING: IPv4 packet forwarding is not enabled, this will prevent you from
routing packets outside this system
Set $SYSCTL_IPV4_FWDING=1 to enable packet forwarding, if desired
Run $SYSCTL $SYSCTL_IPV4_FWDING=1 to enable packet forwarding, if desired
EOF
fi
......@@ -43,7 +46,7 @@ WARNING: IPv6 is not disabled on this system
There is a risk of data leaking while using PIA when IPv6 is enabled. Review
your configuration as needed.
Set $SYSCTL_IPV6_STATUS=1 to disable IPv6, if desired
Run $SYSCTL $SYSCTL_IPV6_STATUS=1 to disable IPv6, if desired
EOF
fi
#!/bin/sh
# piawgmgr: A Wireguard interface manager for PIA
#
# Copyright (C) 2020 Battams, Derek <derek@battams.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/sbin/rc-service -s piawgmgr restart
\ No newline at end of file
#!/bin/sh
# piawgmgr: A Wireguard interface manager for PIA
#
# Copyright (C) 2020 Battams, Derek <derek@battams.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/sbin/rc-service -s piawgmgr stop
\ No newline at end of file
......@@ -19,11 +19,11 @@
SVCUSER=piawgmgr
# Create the service group
if grep -q "^$SVCUSER" /etc/group ;then
if grep -q "^$SVCUSER" /etc/group; then
/usr/sbin/addgroup -S $SVCUSER
fi
# Create the service user
if grep -q "^$SVCUSER" /etc/passwd ;then
if grep -q "^$SVCUSER" /etc/passwd; then
/usr/sbin/adduser -H -D -S -G $SVCUSER -s /sbin/nologin $SVCUSER
fi
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment