aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2022-09-06 17:37:23 -0700
committerTrumeet <yuuta@yuuta.moe>2022-09-06 17:37:23 -0700
commitf4600605fd49e81adbd875f2a6e988db6fa57d59 (patch)
tree47451abc97fd4bc9928c5ff880b378affa54651f
parent935c2efd5de3181c143a170c08473b62873edbd1 (diff)
downloadvpnswitch-f4600605fd49e81adbd875f2a6e988db6fa57d59.tar
vpnswitch-f4600605fd49e81adbd875f2a6e988db6fa57d59.tar.gz
vpnswitch-f4600605fd49e81adbd875f2a6e988db6fa57d59.tar.bz2
vpnswitch-f4600605fd49e81adbd875f2a6e988db6fa57d59.zip
Add PKGBUILDHEADmaster
-rw-r--r--arch/.gitignore4
-rw-r--r--arch/PKGBUILD39
-rw-r--r--arch/vpnswitch@.service12
3 files changed, 55 insertions, 0 deletions
diff --git a/arch/.gitignore b/arch/.gitignore
new file mode 100644
index 0000000..2e07e5c
--- /dev/null
+++ b/arch/.gitignore
@@ -0,0 +1,4 @@
+pkg/
+src/
+*.zst
+*.log
diff --git a/arch/PKGBUILD b/arch/PKGBUILD
new file mode 100644
index 0000000..46c138f
--- /dev/null
+++ b/arch/PKGBUILD
@@ -0,0 +1,39 @@
+# Maintainer: Yuuta Liang <yuuta@yuuta.moe>
+pkgname=vpnswitch-git
+pkgver=r2.935c2ef
+pkgrel=1
+pkgdesc="Automatically switch VPN based on internal network connectivity"
+arch=(any)
+url="https://git.yuuta.moe/vpnswitch.git/"
+license=('custom')
+groups=()
+depends=(sh coreutils)
+makedepends=('git')
+provides=("vpnswitch")
+conflicts=("vpnswitch")
+replaces=()
+backup=(etc/vpnswitch/)
+options=()
+install=
+source=('src::git+https://git.yuuta.moe/vpnswitch.git'
+'vpnswitch@.service')
+noextract=()
+md5sums=('SKIP'
+ '92b328333779a4be3aaf150267edda30')
+
+pkgver() {
+ cd "$srcdir/src"
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+package() {
+ cd "$srcdir/src"
+ mkdir -p "$pkgdir/etc/vpnswitch/"
+ install -Dm644 ./profile "$pkgdir/etc/vpnswitch/example.conf"
+ mkdir -p "$pkgdir/usr/bin/"
+ install -Dm755 ./vpnswitch "$pkgdir/usr/bin/"
+ mkdir -p "$pkgdir/usr/share/licenses/vpnswitch/"
+ install -Dm644 ./LICENSE "$pkgdir/usr/share/licenses/vpnswitch/"
+ mkdir -p "$pkgdir/usr/lib/systemd/system/"
+ install -Dm644 ../vpnswitch@.service "$pkgdir/usr/lib/systemd/system/"
+}
diff --git a/arch/vpnswitch@.service b/arch/vpnswitch@.service
new file mode 100644
index 0000000..8841051
--- /dev/null
+++ b/arch/vpnswitch@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Automatic VPN switch for %I
+Documentation=man:vpnswitch(1)
+After=network.target network-online-target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/vpnswitch %I
+RemainAfterExit=true
+
+[Install]
+WantedBy=multi-user.target