From a6414533887fa3167d93b073c6308deb20ecd469 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Tue, 5 Nov 2024 23:25:27 +0800 Subject: [PATCH] docs: update README for manual installation --- README.md | 10 +++---- scripts/deb-install.sh | 59 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 7 deletions(-) create mode 100755 scripts/deb-install.sh diff --git a/README.md b/README.md index aa4aeb97..664ac6b2 100644 --- a/README.md +++ b/README.md @@ -85,17 +85,13 @@ sudo apt-get install globalprotect-openconnect #### **Ubuntu 24.04 and later** -The `libwebkit2gtk-4.0-37` package was [removed](https://bugs.launchpad.net/ubuntu/+source/webkit2gtk/+bug/2061914) from its repo, before [the issue](https://github.com/yuezk/GlobalProtect-openconnect/issues/351) gets resolved, you need to install them manually: +The `libwebkit2gtk-4.0-37` package was [removed](https://bugs.launchpad.net/ubuntu/+source/webkit2gtk/+bug/2061914) from its repo. You can use the [`deb-install.sh`](./scripts/deb-install.sh) script to install the package: ```bash -wget http://launchpadlibrarian.net/704701349/libwebkit2gtk-4.0-37_2.43.3-1_amd64.deb -wget http://launchpadlibrarian.net/704701345/libjavascriptcoregtk-4.0-18_2.43.3-1_amd64.deb - -sudo dpkg --install *.deb +curl -o- https://raw.githubusercontent.com/yuezk/GlobalProtect-openconnect/main/scripts/deb-install.sh \ + | bash -s -- 2.3.9 ``` -And the latest package is not available in the PPA, you can follow the [Install from deb package](#install-from-deb-package) section to install the latest package. - #### **Ubuntu 18.04** The latest package is not available in the PPA either, but you still needs to add the `ppa:yuezk/globalprotect-openconnect` repo beforehand to use the required `openconnect` package. Then you can follow the [Install from deb package](#install-from-deb-package) section to install the latest package. diff --git a/scripts/deb-install.sh b/scripts/deb-install.sh new file mode 100755 index 00000000..622aa23c --- /dev/null +++ b/scripts/deb-install.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +set -e + +# Usage: ./deb-install.sh + +usage() { + echo "Usage: $0 " + echo "Example: $0 2.3.9" + exit 1 +} + +if [ $# -ne 1 ]; then + usage +fi + +VERSION=$1 + +# Check the architecture, only support x86_64 and aarch64/arm64 +ARCH=$(uname -m) + +# Normalize the architecture name +if [ "$ARCH" == "x86_64" ]; then + ARCH="amd64" +elif [ "$ARCH" == "aarch64" ] || [ "$ARCH" == "arm64" ]; then + ARCH="arm64" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi + +LIB_JAVASCRIPT_x86="http://launchpadlibrarian.net/704701345/libjavascriptcoregtk-4.0-18_2.43.3-1_amd64.deb" +LIB_WEBKIT_x86="http://launchpadlibrarian.net/704701349/libwebkit2gtk-4.0-37_2.43.3-1_amd64.deb" + +LIB_JAVASCRIPT_arm="http://launchpadlibrarian.net/704735771/libjavascriptcoregtk-4.0-18_2.43.3-1_arm64.deb" +LIB_WEBKIT_arm="http://launchpadlibrarian.net/704735777/libwebkit2gtk-4.0-37_2.43.3-1_arm64.deb" + +DEB_URL="https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v${VERSION}/globalprotect-openconnect_${VERSION}-1_${ARCH}.deb" + +# Install the dependencies +if [ "$ARCH" == "amd64" ]; then + wget -O /tmp/libjavascriptcoregtk.deb $LIB_JAVASCRIPT_x86 + wget -O /tmp/libwebkit2gtk.deb $LIB_WEBKIT_x86 +else + wget -O /tmp/libjavascriptcoregtk.deb $LIB_JAVASCRIPT_arm + wget -O /tmp/libwebkit2gtk.deb $LIB_WEBKIT_arm +fi + +sudo dpkg -i /tmp/libjavascriptcoregtk.deb /tmp/libwebkit2gtk.deb + +# Install the package +wget -O /tmp/globalprotect-openconnect.deb $DEB_URL +sudo apt install --fix-broken -y /tmp/globalprotect-openconnect.deb + +# Clean up +rm /tmp/libjavascriptcoregtk.deb /tmp/libwebkit2gtk.deb /tmp/globalprotect-openconnect.deb + +echo "" +echo "GlobalProtect OpenConnect VPN client has been installed successfully."