diff options
-rw-r--r-- | .SRCINFO | 37 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | PKGBUILD | 242 | ||||
-rw-r--r-- | mullvad-vpn.desktop | 9 | ||||
-rw-r--r-- | mullvad-vpn.install | 75 | ||||
-rw-r--r-- | mullvad-vpn.sh | 2 | ||||
-rw-r--r-- | no-rpm.diff | 13 | ||||
-rwxr-xr-x | update-relays.sh | 19 |
8 files changed, 236 insertions, 165 deletions
@@ -1,28 +1,33 @@ pkgbase = mullvad-vpn pkgdesc = The Mullvad VPN client app for desktop - pkgver = 2019.10 + pkgver = 2024.2 pkgrel = 1 url = https://www.mullvad.net install = mullvad-vpn.install arch = x86_64 - license = GPL3 - makedepends = git + license = GPL-3.0-or-later makedepends = cargo + makedepends = git + makedepends = go + makedepends = libxcrypt-compat makedepends = npm - makedepends = rpm + makedepends = protobuf + depends = alsa-lib + depends = gtk3 + depends = iputils + depends = libnftnl depends = libnotify - depends = libappindicator-gtk3 - depends = libxss depends = nss - source = git+https://github.com/mullvad/mullvadvpn-app.git#tag=2019.10?signed - source = git+https://github.com/mullvad/mullvadvpn-app-binaries.git#commit=0c1a0aca41492fbb9ef1f187122e2f5bda0927ba?signed - source = mullvad-vpn.desktop - source = update-relays.sh - validpgpkeys = EA0A77BF9E115615FC3BD8BC7653B940E494FE87 - sha256sums = SKIP - sha256sums = SKIP - sha256sums = 121d90e6683e64d9c0d2dbb7b346fa918bdb37cf21fdaf9f66232304ed23abc2 - sha256sums = ec125bc9cfe2403bacfcaebf4b58f88b4d734b0f6194c23016efd7e15684f8e0 + source = git+https://github.com/mullvad/mullvadvpn-app.git#tag=2024.2 + source = git+https://github.com/mullvad/mullvadvpn-app-binaries.git#commit=d5772339cee9c1a0d7671968746f02499b78e245?signed + source = no-rpm.diff + source = mullvad-vpn.sh + validpgpkeys = 225E40C8F1C8DEB7977ABF59F293063FECE2E8ED + validpgpkeys = 8339C7D2942EB854E3F27CE5AEE9DECFD582E984 + validpgpkeys = 4B986EF5222BA1B810230C602F391DE6B00D619C + sha256sums = b50af32532ecb05502bbd6eab4514417bd6889bbaefccc11d0f5cefbf7685d8e + sha256sums = 255d3b3de761215b02086184006d65bd5c6972f9e9f7364c177693d67429547f + sha256sums = ea35edffea2cbbb05586abce19581fdd9f133801ed47e6af30fa64a29c5cf116 + sha256sums = 2262346cb57deb187fe32a88ccd873dab669598889269088e749197c6e88954f pkgname = mullvad-vpn - diff --git a/.gitignore b/.gitignore index 3102c7b66867..c75f7f54fd79 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,6 @@ !.gitignore !PKGBUILD !.SRCINFO -!mullvad-vpn.desktop !mullvad-vpn.install -!update-relays.sh +!mullvad-vpn.sh +!no-rpm.diff @@ -1,112 +1,166 @@ -# Maintainer: Mark Wagie <yochanan dot marqos at gmail dot com> +# Maintainer: Mark Wagie <mark dot wagie at proton dot me> # Contributor: Matthew McGinn <mamcgi at gmail dot com> # Contributor: alicewww <almw at protonmail dot com> # Contributor: David Birks <david at tellus dot space> # Contributor: Jeff Henson <jeff at henson dot io> -# Contributor: Linus Färnstrand <linus at mullvad dot net> -# Contributor: Emīls Piņķis <emil at mullvad dot net> -# Contributor: Andrej Mihajlov <and at mullvad dot net> pkgname=mullvad-vpn -pkgver=2019.10 +pkgver=2024.2 pkgrel=1 pkgdesc="The Mullvad VPN client app for desktop" -url="https://www.mullvad.net" arch=('x86_64') -license=('GPL3') -depends=('libnotify' 'libappindicator-gtk3' 'libxss' 'nss') -makedepends=('git' 'cargo' 'npm' 'rpm') +url="https://www.mullvad.net" +license=('GPL-3.0-or-later') +depends=('alsa-lib' 'gtk3' 'iputils' 'libnftnl' 'libnotify' 'nss') +makedepends=('cargo' 'git' 'go' 'libxcrypt-compat' 'npm' 'protobuf') install="$pkgname.install" -_commit='0c1a0aca41492fbb9ef1f187122e2f5bda0927ba' -source=("git+https://github.com/mullvad/mullvadvpn-app.git#tag=$pkgver?signed" - "git+https://github.com/mullvad/mullvadvpn-app-binaries.git#commit=$_commit?signed" - "$pkgname.desktop" - 'update-relays.sh') -sha256sums=('SKIP' - 'SKIP' - '121d90e6683e64d9c0d2dbb7b346fa918bdb37cf21fdaf9f66232304ed23abc2' - 'ec125bc9cfe2403bacfcaebf4b58f88b4d734b0f6194c23016efd7e15684f8e0') -validpgpkeys=('EA0A77BF9E115615FC3BD8BC7653B940E494FE87') - # Linus Färnstrand (code signing key) <linus at mullvad dot net> +_commit=d5772339cee9c1a0d7671968746f02499b78e245 +source=("git+https://github.com/mullvad/mullvadvpn-app.git#tag=$pkgver" # signed by Oskar Nyberg (raksooo), public key not uploaded yet + "git+https://github.com/mullvad/mullvadvpn-app-binaries.git#commit=${_commit}?signed" + 'no-rpm.diff' + "$pkgname.sh") +sha256sums=('b50af32532ecb05502bbd6eab4514417bd6889bbaefccc11d0f5cefbf7685d8e' + '255d3b3de761215b02086184006d65bd5c6972f9e9f7364c177693d67429547f' + 'ea35edffea2cbbb05586abce19581fdd9f133801ed47e6af30fa64a29c5cf116' + '2262346cb57deb187fe32a88ccd873dab669598889269088e749197c6e88954f') +validpgpkeys=('225E40C8F1C8DEB7977ABF59F293063FECE2E8ED' # Linus Färnstrand <linus@mullvad.net> + '8339C7D2942EB854E3F27CE5AEE9DECFD582E984' # David Lönnhager (code signing) <david.l@mullvad.net> + '4B986EF5222BA1B810230C602F391DE6B00D619C' # Oskar Nyberg (code signing) <oskar@mullvad.net> + ) prepare() { - # Point the submodule to our local copy - cd "$srcdir/mullvadvpn-app" - git submodule init dist-assets/binaries - git config submodule.mullvadvpn-app-binaries.url \ - "$srcdir/mullvadvpn-app-binaries" - git submodule update + cd mullvadvpn-app + git submodule init + git config submodule.dist-assets/binaries.url "$srcdir/mullvadvpn-app-binaries" + git -c protocol.file.allow=always submodule update + + # Disable building rpm + patch --strip=1 gui/tasks/distribution.js < ../no-rpm.diff + + export CARGO_HOME="$srcdir/cargo-home" + export RUSTUP_TOOLCHAIN=stable + cargo fetch --locked --target "$CARCH-unknown-linux-gnu" + + pushd wireguard/libwg + export GOPATH="$srcdir/gopath" + mkdir -p "../../build/lib/$CARCH-unknown-linux-gnu" + go mod download -x + popd + + pushd gui + echo "Installing JavaScript dependencies..." + export npm_config_cache="$srcdir/npm_cache" + npm ci + popd } build() { - cd "$srcdir/mullvadvpn-app" - - # Remove old Rust build artifacts - cargo clean --release --locked - - # Build mullvad-daemon - cargo build --release --locked - - # Copy binaries for packaging - cp dist-assets/binaries/x86_64-unknown-linux-gnu/{openvpn,sslocal} \ - dist-assets/ - cp target/release/*talpid_openvpn_plugin* dist-assets/ - cp target/release/{mullvad,mullvad-daemon,mullvad-problem-report} \ - dist-assets/ - - # Update relay list & generate relays.json - ../update-relays.sh - - # Build Electron GUI app - cd gui - npm install --cache "$srcdir/npm-cache" - npm run pack:linux -} - -check() { - cd "$srcdir/mullvadvpn-app" - cargo test --release --locked - - cd gui - npm test + cd mullvadvpn-app + CFLAGS+=" -ffat-lto-objects" + export CARGO_HOME="$srcdir/cargo-home" + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + local RUSTC_VERSION=$(rustc --version) + local PRODUCT_VERSION=$(cargo run -q --bin mullvad-version) + + echo "Building Mullvad VPN ${PRODUCT_VERSION}..." + + echo "Building wireguard-go..." + pushd wireguard/libwg + export GOPATH="$srcdir/gopath" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + go build -v -o "../../build/lib/$CARCH-unknown-linux-gnu"/libwg.a -buildmode c-archive + popd + + # Clean module cache for makepkg -C + go clean -modcache + + echo "Building Rust code in release mode using ${RUSTC_VERSION}..." + + cargo_crates_to_build=( + -p mullvad-daemon --bin mullvad-daemon + -p mullvad-cli --bin mullvad + -p mullvad-setup --bin mullvad-setup + -p mullvad-problem-report --bin mullvad-problem-report + -p talpid-openvpn-plugin --lib + -p mullvad-exclude --bin mullvad-exclude + ) + cargo build --frozen --release "${cargo_crates_to_build[@]}" + + echo "Preparing for packaging Mullvad VPN ${PRODUCT_VERSION}..." + mkdir -p build/shell-completions + for sh in bash zsh fish; do + echo "Generating shell completion script for ${sh}..." + cargo run --bin mullvad --frozen --release -- shell-completions ${sh} \ + build/shell-completions/ + done + + echo "Updating relays.json..." + cargo run --bin relay_list --frozen --release > dist-assets/relays.json + + # Move binaries to correct locations in dist-assets + binaries=( + mullvad-daemon + mullvad + mullvad-problem-report + libtalpid_openvpn_plugin.so + mullvad-setup + mullvad-exclude + ) + for binary in ${binaries[*]}; do + cp "target/release/${binary}" "dist-assets/${binary}" + done + + # Build Electron GUI + pushd gui + echo "Packing Mullvad VPN ${PRODUCT_VERSION} artifact(s)..." + export npm_config_cache="$srcdir/npm_cache" + npm run pack:linux --release + popd } package() { - cd "$srcdir/mullvadvpn-app" - - # Install main files - install -dm755 "$pkgdir/opt/Mullvad VPN" - cp -a dist/linux-unpacked/* "$pkgdir/opt/Mullvad VPN" - - # Install daemon service - install -Dm644 dist/linux-unpacked/resources/mullvad-daemon.service -t \ - "$pkgdir/usr/lib/systemd/system" - - #install CLI binary - install -Dm755 target/release/mullvad -t "$pkgdir/usr/bin" - - # Link to the problem report binary - ln -s "/opt/Mullvad VPN/resources/mullvad-problem-report" \ - "$pkgdir/usr/bin/mullvad-problem-report" - - # Link to the GUI binary - ln -s "/opt/Mullvad VPN/mullvad-gui" "$pkgdir/usr/bin/$pkgname" - - # Install desktop file from .deb - install -Dm644 "$srcdir/$pkgname.desktop" -t \ - "$pkgdir/usr/share/applications" - - # Install icons - for icon_size in 16 48; do - icons_dir=/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps - install -d $pkgdir/$icons_dir - install -m644 dist/.icon-set/icon_${icon_size}x${icon_size}.png \ - $pkgdir$icons_dir/$pkgname.png - done - - for icon_size in 32 64 128 256 512 1024; do - icons_dir=/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps - install -d $pkgdir/$icons_dir - install -m644 dist/.icon-set/icon_${icon_size}.png \ - $pkgdir$icons_dir/$pkgname.png - done + cd mullvadvpn-app + + # Install main files + install -d "$pkgdir/opt/Mullvad VPN" + cp -r dist/linux-unpacked/* "$pkgdir/opt/Mullvad VPN/" + + chmod 4755 "$pkgdir/opt/Mullvad VPN/chrome-sandbox" + + # Install services + install -Dm644 dist-assets/linux/mullvad{-daemon,-early-boot-blocking}.service -t \ + "$pkgdir/usr/lib/systemd/system/" + + # Install binaries + install -Dm755 dist-assets/{mullvad,mullvad{-daemon,-exclude}} -t "$pkgdir/usr/bin/" + + # Link to the problem report binary + ln -s "/opt/Mullvad VPN/resources/mullvad-problem-report" "$pkgdir/usr/bin/" + + # Link to the GUI binary + install -m755 "$srcdir/$pkgname.sh" "$pkgdir/usr/bin/$pkgname" + + # Install completions + install -Dm644 build/shell-completions/mullvad.bash \ + "$pkgdir/usr/share/bash-completion/completions/mullvad" + install -Dm644 build/shell-completions/_mullvad -t \ + "$pkgdir/usr/share/zsh/site-functions/" + install -Dm644 build/shell-completions/mullvad.fish -t \ + "$pkgdir/usr/share/fish/vendor_completions.d/" + + # Install desktop file & icons from deb + cd dist + ar x *.deb + bsdtar -xf data.tar.xz + install -Dm644 "usr/share/applications/$pkgname.desktop" -t \ + "$pkgdir/usr/share/applications/" + + for icon_size in 16 32 48 64 128 256 512 1024; do + icons_dir="usr/share/icons/hicolor/${icon_size}x${icon_size}/apps" + install -Dm644 "${icons_dir}/$pkgname.png" -t "$pkgdir/${icons_dir}/" + done } diff --git a/mullvad-vpn.desktop b/mullvad-vpn.desktop deleted file mode 100644 index 0a407c85db4c..000000000000 --- a/mullvad-vpn.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=Mullvad VPN -Exec="/opt/Mullvad VPN/mullvad-vpn" %U -Terminal=false -Type=Application -Icon=mullvad-vpn -StartupWMClass=Mullvad VPN -Comment=Mullvad VPN client -Categories=Network; diff --git a/mullvad-vpn.install b/mullvad-vpn.install index 6fe7d441bf1f..e276ecebd933 100644 --- a/mullvad-vpn.install +++ b/mullvad-vpn.install @@ -1,42 +1,67 @@ pre_install() { - if systemctl status mullvad-daemon &> /dev/null; then - echo 'Stopping & disabling Mullvad VPN daemon...' - systemctl disable --now mullvad-daemon - fi - - rm -f /var/cache/mullvad-vpn/relays.json || true + if systemctl status mullvad-daemon &> /dev/null; then + echo 'Stopping & disabling Mullvad VPN daemon...' + /opt/Mullvad\ VPN/resources/mullvad-setup prepare-restart || true + systemctl disable --now mullvad-daemon + echo 'Disabling Mullvad early boot blocking service...' + systemctl disable mullvad-early-boot-blocking.service || true + cp /var/log/mullvad-vpn/daemon.log /var/log/mullvad-vpn/old-install-daemon.log \ + || echo "Failed to copy old daemon log" + fi + + pkill -x "mullvad-gui" || true + + rm -f /var/cache/mullvad-vpn/relays.json + rm -f /var/cache/mullvad-vpn/api-ip-address.txt } post_install() { - echo 'Enabling Mullvad VPN daemon...' - systemctl enable --now mullvad-daemon + chmod u+s "/usr/bin/mullvad-exclude" + + echo 'Starting & enabling Mullvad VPN daemon...' + systemctl enable --now mullvad-daemon + echo 'Enabling Mullvad early boot blocking service...' + systemctl enable mullvad-early-boot-blocking } pre_upgrade() { - echo 'Stopping Mullvad VPN daemon...' - systemctl stop mullvad-daemon + pre_install } post_upgrade() { - echo 'Restarting Mullvad VPN daemon...' - systemctl daemon-reload - systemctl start mullvad-daemon + systemctl daemon-reload + + post_install } pre_remove() { - # the user might've disabled or stopped the service themselves already - echo 'Making sure the Mullvad VPN daemon is stopped & disabled...' - systemctl stop mullvad-daemon || true - systemctl disable mullvad-daemon || true + # SIGTERM for some reason causes the app to crash sometimes and SIGINT works as expected. + pkill -2 -x "mullvad-gui" || true + sleep 0.5 + pkill -9 -x "mullvad-gui" || true + + # the user might've disabled or stopped the services themselves already + echo 'Making sure the services are stopped & disabled...' + systemctl disable --now mullvad-daemon || true + systemctl disable --now mullvad-early-boot-blocking.service || true + + /opt/Mullvad\ VPN/resources/mullvad-setup reset-firewall || echo "Failed to reset firewall" + /opt/Mullvad\ VPN/resources/mullvad-setup remove-device || echo "Failed to remove device from account" } post_remove() { - echo ------------------------------------------------------------- - echo 'Optionally remove logs & cache:' - echo 'sudo rm -rf /var/log/mullvad-vpn/' - echo 'sudo rm -rf /var/cache/mullvad-vpn/' - echo '' - echo 'Optionally remove config:' - echo 'sudo rm -rf /etc/mullvad-vpn' - echo ------------------------------------------------------------- + echo ------------------------------------------------------------- + echo 'Optionally remove logs & cache:' + echo 'sudo rm -rf /var/log/mullvad-vpn/' + echo 'sudo rm -rf /var/cache/mullvad-vpn/' + echo '' + echo 'Optionally remove config:' + echo 'sudo rm -rf /etc/mullvad-vpn/' + echo '' + echo 'Optionally remove app settings:' + echo 'rm -rf ~/.config/Mullvad VPN/' + echo '' + echo 'Optionally remove auto-launcher:' + echo 'rm ~/.config/autostart/mullvad-vpn.desktop' + echo ------------------------------------------------------------- } diff --git a/mullvad-vpn.sh b/mullvad-vpn.sh new file mode 100644 index 000000000000..f6346e7455ca --- /dev/null +++ b/mullvad-vpn.sh @@ -0,0 +1,2 @@ +#!/bin/bash +"/opt/Mullvad VPN/mullvad-vpn" "$@" diff --git a/no-rpm.diff b/no-rpm.diff new file mode 100644 index 000000000000..ad1aced767fb --- /dev/null +++ b/no-rpm.diff @@ -0,0 +1,13 @@ +--- distribution-a.js 2022-09-26 09:34:34.906953989 -0600 ++++ distribution-b.js 2022-09-26 10:03:26.305152655 -0600 +@@ -162,10 +162,6 @@ + target: 'deb', + arch: getLinuxTargetArch(), + }, +- { +- target: 'rpm', +- arch: getLinuxTargetArch(), +- }, + ], + artifactName: 'MullvadVPN-${version}_${arch}.${ext}', + category: 'Network', diff --git a/update-relays.sh b/update-relays.sh deleted file mode 100755 index ef63dcd6afbf..000000000000 --- a/update-relays.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -read -d '' JSONRPC_CODE <<-JSONRPC_CODE - var buff = ""; - process.stdin.on('data', function (chunk) { - buff += chunk; - }) - process.stdin.on('end', function () { - var obj = JSON.parse(buff); - var output = JSON.stringify(obj.result, null, ' '); - process.stdout.write(output); - }) - JSONRPC_CODE - - JSONRPC_RESPONSE="$(curl -X POST \ - --fail \ - -H "Content-Type: application/json" \ - -d '{"jsonrpc": "2.0", "id": "0", "method": "relay_list_v3"}' \ - https://api.mullvad.net/rpc/)" - echo "$JSONRPC_RESPONSE" | node -e "$JSONRPC_CODE" > dist-assets/relays.json |