fix: disconnect VPN when sleep/shutdown

This commit is contained in:
Kevin Yue
2025-01-12 14:41:03 +08:00
parent ec85e857bc
commit 9740231910
18 changed files with 285 additions and 172 deletions

View File

@@ -10,6 +10,10 @@ install:
install -Dm755 artifacts/usr/bin/gpgui $(DESTDIR)/usr/bin/gpgui; \
fi
# Install the sleep/shutdown scripts
install -Dm755 artifacts/usr/lib/systemd/system-sleep/gpclient $(DESTDIR)/usr/lib/systemd/system-sleep/gpclient
install -Dm755 artifacts/usr/lib/systemd/system-shutdown/gpclient $(DESTDIR)/usr/lib/systemd/system-shutdown/gpclient
install -Dm644 artifacts/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
install -Dm644 artifacts/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png
@@ -26,6 +30,9 @@ uninstall:
rm -f $(DESTDIR)/usr/bin/gpgui-helper
rm -f $(DESTDIR)/usr/bin/gpgui
rm -f $(DESTDIR)/usr/lib/systemd/system-sleep/gpclient
rm -f $(DESTDIR)/usr/lib/systemd/system-shutdown/gpclient
rm -f $(DESTDIR)/usr/share/applications/gpgui.desktop
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
rm -f $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png

View File

@@ -0,0 +1,3 @@
#!/bin/sh
/usr/bin/gpclient disconnect

View File

@@ -0,0 +1,5 @@
#!/bin/sh
if [ "${1}" == "pre" ]; then
/usr/bin/gpclient disconnect
fi

View File

@@ -60,6 +60,13 @@ make build OFFLINE=@OFFLINE@ BUILD_FE=0
%{_datadir}/icons/hicolor/scalable/apps/gpgui.svg
%{_datadir}/polkit-1/actions/com.yuezk.gpgui.policy
%dir /usr/lib/systemd
%dir /usr/lib/systemd/system-sleep
%dir /usr/lib/systemd/system-shutdown
/usr/lib/systemd/system-sleep/gpclient
/usr/lib/systemd/system-shutdown/gpclient
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/32x32
%dir %{_datadir}/icons/hicolor/32x32/apps