fix: remove installed VPN script on uninstall

This commit is contained in:
Kevin Yue committed 2026-07-30 22:51:40 +08:00
1 parent 40b35804e7
commit 7ae09aad8c
11 files changed
+74 -5

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ makedepends="
"
source="$pkgname-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"
install="$pkgname.post-deinstall"
options="!check"
build() {
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
rm -f \
/var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
@@ -14,6 +14,11 @@ post_upgrade() {
post_remove() {
rm -f /usr/bin/gpgui
rm -f \
/var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
update-mime-database /usr/share/mime
update-desktop-database -q
}
+5
View File
@@ -51,3 +51,8 @@ uninstall:
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/gpgui.png
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata || \
echo "Warning: failed to remove the installed VPN script" >&2
rmdir $(DESTDIR)/var/lib/gpclient/scripts 2>/dev/null || true
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
root=${PKG_ROOTDIR:-}
rm -f \
"$root/var/db/gpclient/scripts/vpnc-script" \
"$root/var/db/gpclient/scripts/vpnc-script.metadata" ||
echo "Warning: failed to remove the installed VPN script" >&2
rmdir "$root/var/db/gpclient/scripts" 2>/dev/null || true
+12 -1
View File
@@ -2,7 +2,18 @@
set -e
case "$1" in
purge|remove|upgrade)
purge|remove)
rm -f \
/var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
# Remove the gpgui binary downloaded at runtime
rm -f /usr/bin/gpgui
;;
upgrade)
# Remove the gpgui binary downloaded at runtime
rm -f /usr/bin/gpgui
;;
+1
View File
@@ -14,6 +14,7 @@ depends=('webkit2gtk-4.1' 'libappindicator-gtk3' 'librsvg' 'libsecret' 'openssl'
optdepends=('wmctrl: for window management')
provides=('globalprotect-openconnect' 'gpclient' 'gpservice' 'gpauth' 'gpgui')
install=gp.install
source=("${_pkgname}-${pkgver}.tar.gz")
sha256sums=('SKIP')
+7
View File
@@ -0,0 +1,7 @@
post_remove() {
rm -f \
/var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
}
@@ -50,6 +50,13 @@ A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authenticati
%postun
rm -f %{_bindir}/gpgui
if [ "$1" -eq 0 ]; then
rm -f \
/var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || :
fi
%build
# The injected RUSTFLAGS could fail the build