mirror of
				https://github.com/yuezk/GlobalProtect-openconnect.git
				synced 2025-05-20 07:26:58 -04:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			a884c41813
			...
			feature/ha
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					1bbfee34b8 | ||
| 
						 | 
					d97b3ba350 | ||
| 
						 | 
					e69de98884 | ||
| 
						 | 
					e602b3b018 | 
							
								
								
									
										27
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							@@ -66,20 +66,39 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
 | 
			
		||||
        package: [deb, rpm, pkg, binary]
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Prepare workspace
 | 
			
		||||
      run: rm -rf build-gp && mkdir build-gp
 | 
			
		||||
      run: |
 | 
			
		||||
        rm -rf build-gp-${{ matrix.package }}
 | 
			
		||||
        mkdir -p build-gp-${{ matrix.package }}
 | 
			
		||||
    - name: Download tarball
 | 
			
		||||
      uses: actions/download-artifact@v3
 | 
			
		||||
      with:
 | 
			
		||||
        name: artifact-source
 | 
			
		||||
        path: build-gp
 | 
			
		||||
        path: build-gp-${{ matrix.package }}
 | 
			
		||||
    - name: Docker Login
 | 
			
		||||
      run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
 | 
			
		||||
    - name: Build gp in Docker
 | 
			
		||||
    - name: Build ${{ matrix.package }} package in Docker
 | 
			
		||||
      run: |
 | 
			
		||||
        docker run --rm -v $(pwd)/build-gp:/gp yuezk/gpdev:gp-builder
 | 
			
		||||
        docker run --rm \
 | 
			
		||||
          -v $(pwd)/build-gp-${{ matrix.package }}:/${{ matrix.package }} \
 | 
			
		||||
          yuezk/gpdev:${{ matrix.package }}-builder
 | 
			
		||||
    - name: Install ${{ matrix.package }} package in Docker
 | 
			
		||||
      run: |
 | 
			
		||||
        docker run --rm \
 | 
			
		||||
          -e GPGUI_INSTALLED=0 \
 | 
			
		||||
          -v $(pwd)/build-gp-${{ matrix.package }}:/${{ matrix.package }} \
 | 
			
		||||
          yuezk/gpdev:${{ matrix.package }}-builder \
 | 
			
		||||
          bash install.sh
 | 
			
		||||
    - name: Upload ${{ matrix.package }} package
 | 
			
		||||
      uses: actions/upload-artifact@v3
 | 
			
		||||
      with:
 | 
			
		||||
        name: artifact-gp-${{ matrix.os }}-${{ matrix.package }}
 | 
			
		||||
        if-no-files-found: error
 | 
			
		||||
        path: |
 | 
			
		||||
          build-gp-${{ matrix.package }}/artifacts/*
 | 
			
		||||
 | 
			
		||||
  build-gpgui:
 | 
			
		||||
    needs:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								.github/workflows/release.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/workflows/release.yaml
									
									
									
									
										vendored
									
									
								
							@@ -109,11 +109,16 @@ jobs:
 | 
			
		||||
      run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
 | 
			
		||||
    - name: Build ${{ matrix.package }} package in Docker
 | 
			
		||||
      run: |
 | 
			
		||||
        docker run --rm -v $(pwd)/build-${{ matrix.package }}:/${{ matrix.package }} -e INCLUDE_GUI=1 yuezk/gpdev:${{ matrix.package }}-builder
 | 
			
		||||
        docker run --rm \
 | 
			
		||||
          -v $(pwd)/build-${{ matrix.package }}:/${{ matrix.package }} \
 | 
			
		||||
          -e INCLUDE_GUI=1 \
 | 
			
		||||
          yuezk/gpdev:${{ matrix.package }}-builder
 | 
			
		||||
 | 
			
		||||
    - name: Install ${{ matrix.package }} package in Docker
 | 
			
		||||
      run: |
 | 
			
		||||
        docker run --rm -v $(pwd)/build-${{ matrix.package }}:/${{ matrix.package }} yuezk/gpdev:${{ matrix.package }}-builder \
 | 
			
		||||
        docker run --rm \
 | 
			
		||||
          -v $(pwd)/build-${{ matrix.package }}:/${{ matrix.package }} \
 | 
			
		||||
          yuezk/gpdev:${{ matrix.package }}-builder \
 | 
			
		||||
          bash install.sh
 | 
			
		||||
 | 
			
		||||
    - name: Upload ${{ matrix.package }} package
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										39
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								Makefile
									
									
									
									
									
								
							@@ -13,6 +13,12 @@ PKG = $(PKG_NAME)-$(VERSION)
 | 
			
		||||
SERIES ?= $(shell lsb_release -cs)
 | 
			
		||||
PUBLISH ?= 0
 | 
			
		||||
 | 
			
		||||
# Indicate if it is a Debian packaging
 | 
			
		||||
DEB_PACKAGING ?= 0
 | 
			
		||||
INCLUDE_SYSTEMD ?= $(shell [ -d /run/systemd/system ] && echo 1 || echo 0)
 | 
			
		||||
# Enable the systemd service after installation
 | 
			
		||||
ENABLE_SERVICE ?= 1
 | 
			
		||||
 | 
			
		||||
export DEBEMAIL = k3vinyue@gmail.com
 | 
			
		||||
export DEBFULLNAME = Kevin Yue
 | 
			
		||||
 | 
			
		||||
@@ -116,9 +122,34 @@ install:
 | 
			
		||||
	install -Dm644 packaging/files/usr/share/icons/hicolor/256x256@2/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
 | 
			
		||||
	install -Dm644 packaging/files/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
 | 
			
		||||
 | 
			
		||||
	# Install the systemd service
 | 
			
		||||
	if [ $(INCLUDE_SYSTEMD) -eq 1 ]; then \
 | 
			
		||||
		if [ $(DEB_PACKAGING) -eq 1 ]; then \
 | 
			
		||||
			install -Dm644 packaging/files/usr/lib/systemd/system/gp-suspend.service $(DESTDIR)/lib/systemd/system/gp-suspend.service; \
 | 
			
		||||
		else \
 | 
			
		||||
			install -Dm644 packaging/files/usr/lib/systemd/system/gp-suspend.service $(DESTDIR)/usr/lib/systemd/system/gp-suspend.service; \
 | 
			
		||||
		fi; \
 | 
			
		||||
		if [ $(ENABLE_SERVICE) -eq 1 ]; then \
 | 
			
		||||
			systemctl --system daemon-reload \
 | 
			
		||||
			systemctl enable gp-suspend.service || true; \
 | 
			
		||||
		fi \
 | 
			
		||||
	else \
 | 
			
		||||
		echo "Skipping systemd service installation"; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	@echo "Installation complete."
 | 
			
		||||
 | 
			
		||||
uninstall:
 | 
			
		||||
	@echo "Uninstalling $(PKG_NAME)..."
 | 
			
		||||
 | 
			
		||||
	# Disable the systemd service
 | 
			
		||||
	if [ -d /run/systemd/system ]; then \
 | 
			
		||||
		systemctl disable gp-suspend.service >/dev/null || true; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	rm -f $(DESTDIR)/lib/systemd/system/gp-suspend.service
 | 
			
		||||
	rm -f $(DESTDIR)/usr/lib/systemd/system/gp-suspend.service
 | 
			
		||||
 | 
			
		||||
	rm -f $(DESTDIR)/usr/bin/gpclient
 | 
			
		||||
	rm -f $(DESTDIR)/usr/bin/gpauth
 | 
			
		||||
	rm -f $(DESTDIR)/usr/bin/gpservice
 | 
			
		||||
@@ -195,7 +226,7 @@ init-rpm: clean-rpm
 | 
			
		||||
	sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.spec
 | 
			
		||||
	sed -i "s/@REVISION@/$(REVISION)/g" .build/rpm/globalprotect-openconnect.spec
 | 
			
		||||
	sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/rpm/globalprotect-openconnect.spec
 | 
			
		||||
	sed -i "s/@DATE@/$(shell date "+%a %b %d %Y")/g" .build/rpm/globalprotect-openconnect.spec
 | 
			
		||||
	sed -i "s/@DATE@/$(shell LC_ALL=en.US date "+%a %b %d %Y")/g" .build/rpm/globalprotect-openconnect.spec
 | 
			
		||||
 | 
			
		||||
	sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.changes
 | 
			
		||||
	sed -i "s/@DATE@/$(shell LC_ALL=en.US date -u "+%a %b %e %T %Z %Y")/g" .build/rpm/globalprotect-openconnect.changes
 | 
			
		||||
@@ -223,6 +254,7 @@ init-pkgbuild: clean-pkgbuild tarball
 | 
			
		||||
 | 
			
		||||
	cp .build/tarball/${PKG}.tar.gz .build/pkgbuild
 | 
			
		||||
	cp packaging/pkgbuild/PKGBUILD.in .build/pkgbuild/PKGBUILD
 | 
			
		||||
	cp packaging/pkgbuild/gp.install .build/pkgbuild
 | 
			
		||||
 | 
			
		||||
	sed -i "s/@PKG_NAME@/$(PKG_NAME)/g" .build/pkgbuild/PKGBUILD
 | 
			
		||||
	sed -i "s/@VERSION@/$(VERSION)/g" .build/pkgbuild/PKGBUILD
 | 
			
		||||
@@ -244,7 +276,10 @@ binary: clean-binary tarball
 | 
			
		||||
	mkdir -p .build/binary/$(PKG_NAME)_$(VERSION)/artifacts
 | 
			
		||||
 | 
			
		||||
	make -C .build/binary/${PKG} build OFFLINE=$(OFFLINE) BUILD_FE=0 INCLUDE_GUI=$(INCLUDE_GUI)
 | 
			
		||||
	make -C .build/binary/${PKG} install DESTDIR=$(PWD)/.build/binary/$(PKG_NAME)_$(VERSION)/artifacts
 | 
			
		||||
	make -C .build/binary/${PKG} install \
 | 
			
		||||
		DESTDIR=$(PWD)/.build/binary/$(PKG_NAME)_$(VERSION)/artifacts \
 | 
			
		||||
		INCLUDE_SYSTEMD=1 \
 | 
			
		||||
		ENABLE_SERVICE=0
 | 
			
		||||
 | 
			
		||||
	cp packaging/binary/Makefile.in .build/binary/$(PKG_NAME)_$(VERSION)/Makefile
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,7 @@
 | 
			
		||||
INCLUDE_SYSTEMD ?= $(shell [ -d /run/systemd/system ] && echo 1 || echo 0)
 | 
			
		||||
# Enable the systemd service after installation
 | 
			
		||||
ENABLE_SERVICE ?= 1
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	@echo "===> Installing..."
 | 
			
		||||
 | 
			
		||||
@@ -5,7 +9,10 @@ install:
 | 
			
		||||
	install -Dm755 artifacts/usr/bin/gpservice $(DESTDIR)/usr/bin/gpservice
 | 
			
		||||
	install -Dm755 artifacts/usr/bin/gpauth $(DESTDIR)/usr/bin/gpauth
 | 
			
		||||
	install -Dm755 artifacts/usr/bin/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
 | 
			
		||||
	install -Dm755 artifacts/usr/bin/gpgui $(DESTDIR)/usr/bin/gpgui
 | 
			
		||||
 | 
			
		||||
	if [ -f artifacts/usr/bin/gpgui ]; then \
 | 
			
		||||
		install -Dm755 artifacts/usr/bin/gpgui $(DESTDIR)/usr/bin/gpgui; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	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
 | 
			
		||||
@@ -14,9 +21,28 @@ install:
 | 
			
		||||
	install -Dm644 artifacts/usr/share/icons/hicolor/256x256@2/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
 | 
			
		||||
	install -Dm644 artifacts/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
 | 
			
		||||
 | 
			
		||||
	# Install the service
 | 
			
		||||
	if [ $(INCLUDE_SYSTEMD) -eq 1 ]; then \
 | 
			
		||||
		install -Dm644 artifacts/usr/lib/systemd/system/gp-suspend.service $(DESTDIR)/usr/lib/systemd/system/gp-suspend.service; \
 | 
			
		||||
		if [ $(ENABLE_SERVICE) -eq 1 ]; then \
 | 
			
		||||
			systemctl --system daemon-reload; \
 | 
			
		||||
			systemctl enable gp-suspend.service; \
 | 
			
		||||
		fi; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	@echo "===> Done."
 | 
			
		||||
 | 
			
		||||
uninstall:
 | 
			
		||||
	@echo "===> Uninstalling from $(DESTDIR)..."
 | 
			
		||||
 | 
			
		||||
	# Disable the systemd service
 | 
			
		||||
	if [ -d /run/systemd/system ]; then \
 | 
			
		||||
		systemctl disable gp-suspend.service >/dev/null || true; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	rm -f $(DESTDIR)/lib/systemd/system/gp-suspend.service
 | 
			
		||||
	rm -f $(DESTDIR)/usr/lib/systemd/system/gp-suspend.service
 | 
			
		||||
 | 
			
		||||
	rm -f $(DESTDIR)/usr/bin/gpclient
 | 
			
		||||
	rm -f $(DESTDIR)/usr/bin/gpservice
 | 
			
		||||
	rm -f $(DESTDIR)/usr/bin/gpauth
 | 
			
		||||
@@ -29,3 +55,5 @@ uninstall:
 | 
			
		||||
	rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/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
 | 
			
		||||
 | 
			
		||||
	@echo "===> Done."
 | 
			
		||||
 
 | 
			
		||||
@@ -11,4 +11,6 @@ case "$1" in
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
#DEBHELPER#
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,12 @@
 | 
			
		||||
 | 
			
		||||
export OFFLINE = @OFFLINE@
 | 
			
		||||
export BUILD_FE = 0
 | 
			
		||||
export DEB_PACKAGING = 1
 | 
			
		||||
export INCLUDE_SYSTEMD = 1
 | 
			
		||||
export ENABLE_SERVICE = 0
 | 
			
		||||
 | 
			
		||||
%:
 | 
			
		||||
	dh $@ --no-parallel
 | 
			
		||||
 | 
			
		||||
override_dh_installsystemd:
 | 
			
		||||
	dh_installsystemd gp-suspend.service --no-start
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								packaging/files/usr/lib/systemd/system/gp-suspend.service
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								packaging/files/usr/lib/systemd/system/gp-suspend.service
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
[Unit]
 | 
			
		||||
Description=Disconnect from the VPN when suspending
 | 
			
		||||
Before=sleep.target
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
Type=oneshot
 | 
			
		||||
ExecStart=/usr/bin/gpclient disconnect
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=sleep.target
 | 
			
		||||
@@ -14,6 +14,8 @@ optdepends=('wmctrl: for window management')
 | 
			
		||||
 | 
			
		||||
provides=('globalprotect-openconnect' 'gpclient' 'gpservice' 'gpauth' 'gpgui')
 | 
			
		||||
 | 
			
		||||
install=gp.install
 | 
			
		||||
 | 
			
		||||
source=("${_pkgname}-${pkgver}.tar.gz")
 | 
			
		||||
sha256sums=('SKIP')
 | 
			
		||||
 | 
			
		||||
@@ -31,5 +33,5 @@ build() {
 | 
			
		||||
package() {
 | 
			
		||||
  cd "$pkgname-$pkgver"
 | 
			
		||||
 | 
			
		||||
  make install DESTDIR="$pkgdir"
 | 
			
		||||
  make install DESTDIR="$pkgdir" INCLUDE_SYSTEMD=1 ENABLE_SERVICE=0
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								packaging/pkgbuild/gp.install
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								packaging/pkgbuild/gp.install
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
post_install() {
 | 
			
		||||
    systemctl --system daemon-reload
 | 
			
		||||
    systemctl enable gp-suspend.service
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
post_upgrade() {
 | 
			
		||||
    post_install
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
post_remove() {
 | 
			
		||||
    systemctl disable gp-suspend.service
 | 
			
		||||
}
 | 
			
		||||
@@ -22,6 +22,7 @@ BuildRequires:  perl
 | 
			
		||||
BuildRequires:  (webkit2gtk4.0-devel or webkit2gtk3-soup2-devel)
 | 
			
		||||
BuildRequires:  (libappindicator-gtk3-devel or libappindicator3-1)
 | 
			
		||||
BuildRequires:  (librsvg2-devel or librsvg-devel)
 | 
			
		||||
BuildRequires:  systemd-rpm-macros
 | 
			
		||||
 | 
			
		||||
Requires:       openconnect >= 8.20, (libayatana-appindicator or libappindicator-gtk3)
 | 
			
		||||
Conflicts:      globalprotect-openconnect-snapshot
 | 
			
		||||
@@ -34,16 +35,42 @@ A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authenticati
 | 
			
		||||
%prep
 | 
			
		||||
%setup
 | 
			
		||||
 | 
			
		||||
%pre
 | 
			
		||||
%if 0%{?suse_version}
 | 
			
		||||
  %service_add_pre gp-suspend.service
 | 
			
		||||
%endif
 | 
			
		||||
 | 
			
		||||
%post
 | 
			
		||||
%if 0%{?suse_version}
 | 
			
		||||
  %service_add_post gp-suspend.service
 | 
			
		||||
%else
 | 
			
		||||
  %systemd_post gp-suspend.service
 | 
			
		||||
%endif
 | 
			
		||||
 | 
			
		||||
%preun
 | 
			
		||||
%if 0%{?suse_version}
 | 
			
		||||
  %service_del_preun gp-suspend.service
 | 
			
		||||
%else
 | 
			
		||||
  %systemd_preun gp-suspend.service
 | 
			
		||||
%endif
 | 
			
		||||
 | 
			
		||||
%postun
 | 
			
		||||
# Clean up the gpgui downloaded at runtime
 | 
			
		||||
rm -f %{_bindir}/gpgui
 | 
			
		||||
 | 
			
		||||
%if 0%{?suse_version}
 | 
			
		||||
  %service_del_postun_without_restart gp-suspend.service
 | 
			
		||||
%else
 | 
			
		||||
  %systemd_postun gp-suspend.service
 | 
			
		||||
%endif
 | 
			
		||||
 | 
			
		||||
%build
 | 
			
		||||
# The injected RUSTFLAGS could fail the build
 | 
			
		||||
unset RUSTFLAGS
 | 
			
		||||
make build OFFLINE=@OFFLINE@ BUILD_FE=0
 | 
			
		||||
 | 
			
		||||
%install
 | 
			
		||||
%make_install
 | 
			
		||||
%make_install INCLUDE_SYSTEMD=1 ENABLE_SERVICE=0
 | 
			
		||||
 | 
			
		||||
%files
 | 
			
		||||
%defattr(-,root,root)
 | 
			
		||||
@@ -54,6 +81,7 @@ make build OFFLINE=@OFFLINE@ BUILD_FE=0
 | 
			
		||||
%{_datadir}/icons/hicolor/256x256@2/apps/gpgui.png
 | 
			
		||||
%{_datadir}/icons/hicolor/scalable/apps/gpgui.svg
 | 
			
		||||
%{_datadir}/polkit-1/actions/com.yuezk.gpgui.policy
 | 
			
		||||
%{_unitdir}/gp-suspend.service
 | 
			
		||||
 | 
			
		||||
%dir %{_datadir}/icons/hicolor
 | 
			
		||||
%dir %{_datadir}/icons/hicolor/32x32
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user