summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Brock2023-09-21 09:19:19 +0200
committerLaurent Brock2023-09-21 09:19:19 +0200
commitb0125701158f3205dd2e5b8c7b91c61e9dfc64f5 (patch)
tree354e755c428f88bd66b3ef1359eae6c72cc9038f
parent4dea9cc0f6ff61b040d83c5492e649181d0354a6 (diff)
downloadaur-b0125701158f3205dd2e5b8c7b91c61e9dfc64f5.tar.gz
rt_tables now gets copied and modified in /etc/iproute2 location, as recommended. Existing, modified files will not be overwritten nor deleted post-removal
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD5
-rw-r--r--piavpn-bin.install31
3 files changed, 24 insertions, 14 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 5ee382869e41..08d85c4eb9f2 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = piavpn-bin
pkgdesc = Private Internet Access client
pkgver = 3.3.1_06924
- pkgrel = 4
+ pkgrel = 5
url = https://privateinternetaccess.com/
install = piavpn-bin.install
arch = x86_64
diff --git a/PKGBUILD b/PKGBUILD
index a7591378dde9..ed8d2c6b23fe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@ pkgname=piavpn-bin
pkgver=3.3.1_06924
_pkgver=${pkgver/\.0_/_}
_pkgver=${_pkgver/_/-}
-pkgrel=4
+pkgrel=5
pkgdesc="Private Internet Access client"
# https://www.privateinternetaccess.com/pages/changelog
arch=('x86_64' 'aarch64')
@@ -66,9 +66,6 @@ package() {
# limit log to the minimum to avoid excessive flooding
mkdir -p $pkgdir/opt/piavpn/var
cat > $pkgdir/opt/piavpn/var/debug.txt << EOF
-
- echo "== For a first install, you need to enable and start piavpn.service. Run sudo systemctl enable --now piavpn.service =="
- echo "== If you are upgrading from 3.3.1_06924-3 to 3.3.1_06924-4, you need to uninstall and reinstall the package, as the rt_tables file has changed locations =="
[rules]
*.debug=false
diff --git a/piavpn-bin.install b/piavpn-bin.install
index 080526e04c6e..7479a0d7851c 100644
--- a/piavpn-bin.install
+++ b/piavpn-bin.install
@@ -1,11 +1,11 @@
-# copy-pasted from install.sh in .run file, but with modified rt_tables path
+# copy-pasted from install.sh in .run file, but with rt_tables copying logic, for if needed
function addRoutingTable() {
- local highestIndex=$(awk '/^[0-9]/{print $1}' /usr/lib/iproute2/rt_tables | sort -n | tail -1)
+ local highestIndex=$(awk '/^[0-9]/{print $1}' /etc/iproute2/rt_tables | sort -n | tail -1)
local newIndex=$(($highestIndex + 1))
local routingTable="$1"
- if ! grep -q "$routingTable" /usr/lib/iproute2/rt_tables; then
- echo -e "$newIndex\t$routingTable" >> /usr/lib/iproute2/rt_tables
+ if ! grep -q "$routingTable" /etc/iproute2/rt_tables; then
+ echo -e "$newIndex\t$routingTable" >> /etc/iproute2/rt_tables
fi
}
@@ -13,6 +13,12 @@ pre_install() {
groupadd piavpn
groupadd piahnsd
+ if ! cat /etc/iproute2/rt_tables > /dev/null 2>&1 # If this doesn't exist, create it!
+ then
+ mkdir -p /etc/iproute2
+ cp /usr/lib/iproute2/rt_tables /etc/iproute2/rt_tables
+ fi
+
addRoutingTable piavpnrt
addRoutingTable piavpnOnlyrt
addRoutingTable piavpnWgrt
@@ -30,16 +36,23 @@ pre_remove() {
}
post_remove() {
- sed -i '/.*piavpnrt$/d' /usr/lib/iproute2/rt_tables
- sed -i '/.*piavpnOnlyrt$/d' /usr/lib/iproute2/rt_tables
- sed -i '/.*piavpnWgrt$/d' /usr/lib/iproute2/rt_tables
- sed -i '/.*piavpnFwdrt$/d' /usr/lib/iproute2/rt_tables
+ sed -i '/.*piavpnrt$/d' /etc/iproute2/rt_tables
+ sed -i '/.*piavpnOnlyrt$/d' /etc/iproute2/rt_tables
+ sed -i '/.*piavpnWgrt$/d' /etc/iproute2/rt_tables
+ sed -i '/.*piavpnFwdrt$/d' /etc/iproute2/rt_tables
groupdel piavpn
groupdel piahnsd
+
+ if diff -q /usr/lib/iproute2/rt_tables /etc/iproute2/rt_tables > /dev/null 2>&1 # If files are identical
+ then
+ echo "/etc/iproute2/rt_tables is identical to default at /usr/lib/iproute2/rt_tables, removing"
+ rm /etc/iproute2/rt_tables
+ rmdir /etc/iproute2
+ fi
}
post_upgrade() {
- if ! grep -q piavpnFwdrt /usr/lib/iproute2/rt_tables; then
+ if ! grep -q piavpnFwdrt /etc/iproute2/rt_tables; then
addRoutingTable piavpnFwdrt
fi
systemctl daemon-reload