1 Commits

Author SHA1 Message Date
0b35be6284 Include install-scripts 2026-04-09 21:16:08 +02:00
16 changed files with 152 additions and 142 deletions

4
.gitmodules vendored
View File

@@ -2,3 +2,7 @@
path = mullvad-vpn-daemon/mullvadvpn-app
url = git@github.com:mullvad/mullvadvpn-app-priv.git
branch = poc-slint
[submodule "mullvad-vpn-slint/mullvadvpn-app"]
path = mullvad-vpn-slint/mullvadvpn-app
url = git@github.com:mullvad/mullvadvpn-app-priv.git
branch = poc-slint

View File

@@ -14,8 +14,7 @@ RUN apk update && apk add \
libmnl libmnl-dev \
libnftnl libnftnl-dev \
dbus dbus-dev \
fontconfig-dev \
wayland-dev
fontconfig-dev
# Set pkg-config to use static libraries
ENV PKG_CONFIG_ALLOW_STATIC=1

View File

@@ -4,8 +4,6 @@ set -ex
cd "$(dirname "$0")"
package="$1"
shift
builder_image="mullvad-slint-musl-builder"
cargo_home="${CARGO_HOME:-$HOME/.cargo}"
. "$HOME/.abuild/abuild.conf"
@@ -24,5 +22,5 @@ docker run --rm \
-e "CARGO_TARGET_DIR=/cargo-target" \
-it \
"$builder_image" \
abuild -F "$@"
abuild -F

View File

@@ -1,93 +1,81 @@
maintainer="Joakim Hulthe <joakim@hulthe.net>"
# Contributor:
# Maintainer: Joakim Hulthe <joakim@hulthe.net>
pkgname=mullvad-vpn-daemon
pkgver=2026.2_beta1
pkgrel=0
pkgdesc="Mullvad VPN client (daemon and CLI)"
pkgver=2026.1_git
pkgrel=1
pkgdesc="Mullvad VPN system service"
url="https://mullvad.net/"
# Mullvad depends on old versions of the `nix` library
# which are broken on on loongarch64 and s390x
arch="all !loongarch64 !s390x"
license="GPL-3.0-or-later"
arch="$(uname -m)"
license="GPL-3-or-later"
depends="
dbus
libmnl
libnftnl
"
makedepends="
build-base
cargo-auditable
rust
pkgconfig
git
protobuf-dev
dbus-dev
libmnl-dev
libnftnl-dev
"
install="
$pkgname.pre-upgrade
$pkgname.pre-deinstall
$pkgname-systemd.post-install
$pkgname-systemd.post-upgrade
$pkgname-systemd.pre-deinstall
"
subpackages="
$pkgname-systemd
$pkgname-suid
"
source="
https://github.com/mullvad/mullvadvpn-app/archive/refs/tags/${pkgver//_/-}.tar.gz
"
builddir="$srcdir/mullvadvpn-app-${pkgver//_/-}/"
checkdepends=""
# TODO: pre/post(de)install-scripts
install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-deinstall $pkgname.post-deinstall"
#install=""
subpackages="$pkgname-systemd"
source=""
builddir="$srcdir/"
options="net suid"
_cargo_target_dir="${CARGO_TARGET_DIR:-$builddir/target}"
_cargo_release_dir="$_cargo_target_dir/$CHOST/release"
_cargo_target_dir="${CARGO_TARGET_DIR:-$startdir/mullvadvpn-app/target}"
prepare() {
default_prepare
cd "$startdir/mullvadvpn-app"
cargo fetch --target "$CHOST" --locked
}
build() {
# Specify `--target` so that build artifacts will be in target/<target>/release
# This avoids clashes with host system when building in a container.
cd "$startdir/mullvadvpn-app"
# Compile all binaries
cargo auditable build --release --frozen \
--target "$CHOST" \
-p mullvad-cli \
-p mullvad-daemon \
-p mullvad-exclude \
-p mullvad-problem-report \
-p mullvad-setup
# * Force the `stable` toolchain since it's installed in the container.
# We don't wan't to needlessly download rust while building.
# * Specify `--target` so that the final binary ends up in target/<target>/release.
cargo auditable build --release --locked \
--target "$CHOST" \
-p mullvad-daemon \
-p mullvad-cli \
-p mullvad-exclude \
-p mullvad-problem-report
}
check() {
cargo test --target "$CHOST" --frozen
cd "$startdir/mullvadvpn-app"
cargo test --frozen
}
package() {
install -m755 -Dt "$pkgdir/usr/bin/" \
"$_cargo_release_dir/mullvad" \
"$_cargo_release_dir/mullvad-daemon" \
"$_cargo_release_dir/mullvad-problem-report" \
"$_cargo_release_dir/mullvad-setup"
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-daemon" \
"$pkgdir"/usr/bin/mullvad-daemon
# TODO: Bundle a relay list.
# We can't generate one at build time since that would break build reproducibility.
# Once mullvad starts checking a relay list into their release branches, we can bundle that.
#install -m644 -D "$builddir/<todo>/relays.json" \
# "$pkgdir/usr/share/mullvad-vpn/relays.json"
# TODO: Copy relay list into /var/cache/ in post-upgrade/post-install
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad" \
"$pkgdir"/usr/bin/mullvad
# files in /usr/lib/systemd/ are automatically put in systemd subpackage
install -m755 -Dt "$pkgdir/usr/lib/systemd/system/" \
"$builddir/dist-assets/linux/mullvad-daemon.service" \
"$builddir/dist-assets/linux/mullvad-early-boot-blocking.service"
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-exclude" \
"$pkgdir"/usr/bin/mullvad-exclude
chmod u+s "$pkgdir"/usr/bin/mullvad-exclude
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-problem-report" \
"$pkgdir"/usr/bin/mullvad-problem-report
}
suid() {
pkgdesc="mullvad-exclude cli for split tunneling"
depends="$pkgname=$pkgver-r$pkgrel"
install -m4755 -Dt "$subpkgdir/usr/bin/" \
"$_cargo_release_dir/mullvad-exclude"
systemd() {
install -m755 -D "$startdir/mullvadvpn-app/dist-assets/linux/mullvad-daemon.service" \
"$subpkgdir"/usr/lib/systemd/system/mullvad-daemon.service
}
sha512sums="
9af0c263f0e5985d7842099f50a5070da0b23691f08ffe57c3b6d239d2c1c9acea89c07890f31d89bd75448a2dd1fd3c878b85be458baba0bcd90760e714b032 2026.2-beta1.tar.gz
"

View File

@@ -1,9 +0,0 @@
#!/bin/sh
set -eu
# Enable and start systemd services
if which systemctl >/dev/null 2>&1 && systemctl is-system-running | grep -vq offline >/dev/null 2>&1; then
systemctl enable "/usr/lib/systemd/system/mullvad-daemon.service"
systemctl start mullvad-daemon.service || echo "Failed to start mullvad-daemon.service"
systemctl enable "/usr/lib/systemd/system/mullvad-early-boot-blocking.service"
fi

View File

@@ -1,9 +0,0 @@
#!/bin/sh
set -eu
# Enable and start systemd services
if which systemctl >/dev/null 2>&1 && systemctl is-system-running | grep -vq offline >/dev/null 2>&1; then
systemctl enable "/usr/lib/systemd/system/mullvad-daemon.service"
systemctl start mullvad-daemon.service || echo "Failed to start mullvad-daemon.service"
systemctl enable "/usr/lib/systemd/system/mullvad-early-boot-blocking.service"
fi

View File

@@ -1,8 +0,0 @@
#!/bin/sh
set -eu
# Stop and disable all mullvad services
systemctl stop mullvad-daemon.service || true
systemctl disable mullvad-daemon.service || true
systemctl stop mullvad-early-boot-blocking.service || true
systemctl disable mullvad-early-boot-blocking.service || true

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -eu
function remove_logs_and_cache {
rm -r --interactive=never /var/log/mullvad-vpn/ || \
echo "Failed to remove mullvad-vpn logs"
rm -r --interactive=never /var/cache/mullvad-vpn/ || \
echo "Failed to remove mullvad-vpn cache"
}
function remove_config {
rm -r --interactive=never /etc/mullvad-vpn || \
echo "Failed to remove mullvad-vpn config"
}
function remove_symlinks {
rm /usr/bin/mullvad-problem-report || \
echo "Failed to remove mullvad-problem-report"
}
# checking what kind of an action is taking place
case $@ in
# apt purge passes "purge"
"purge")
remove_logs_and_cache
remove_config
remove_symlinks
;;
# apt remove passes "remove"
"remove")
remove_symlinks
;;
# dnf remove passes a 0
"0")
remove_logs_and_cache
remove_config
remove_symlinks
;;
esac

View File

@@ -1,8 +1,8 @@
#!/bin/sh
#!/usr/bin/env bash
set -eu
# TODO: see `package()` in APKBUILD
# Copy vendored relay list into place
# mkdir -p /var/cache/mullvad-vpn \
# && cp /usr/share/mullvad-vpn/relays.json /var/cache/mullvad-vpn/relays.json \
# || echo "failed to install /var/cache/mullvad-vpn/relays.json"
ln -sf /opt/Mullvad\ VPN/resources/mullvad-problem-report /usr/bin/mullvad-problem-report
systemctl enable "/usr/lib/systemd/system/mullvad-daemon.service"
systemctl start mullvad-daemon.service || echo "Failed to start mullvad-daemon.service"
systemctl enable "/usr/lib/systemd/system/mullvad-early-boot-blocking.service"

View File

@@ -1,8 +0,0 @@
#!/bin/sh
set -eu
# TODO: see `package()` in APKBUILD
# Overwrite the cached relay list with the vendored one.
# mkdir -p /var/cache/mullvad-vpn \
# && cp /usr/share/mullvad-vpn/relays.json /var/cache/mullvad-vpn/relays.json \
# || echo "failed to install /var/cache/mullvad-vpn/relays.json"

View File

@@ -1,6 +1,23 @@
#!/bin/sh
#!/usr/bin/env bash
set -eu
# Log out and remove any firewall rules
mullvad-setup reset-firewall || echo "Failed to reset firewall"
mullvad-setup remove-device || echo "Failed to remove device from account"
echo "Running prerm."
is_number_re='^[0-9]+$'
# Check if we're running during an upgrade step on Fedora
# https://fedoraproject.org/wiki/Packaging:Scriptlets#Syntax
if [[ "$1" =~ $is_number_re ]] && [ "$1" -gt 0 ]; then
exit 0;
fi
if [[ "$1" == "upgrade" ]]; then
exit 0;
fi
# the user might've disabled or stopped the service themselves already
systemctl stop mullvad-daemon.service || true
systemctl disable mullvad-daemon.service || true
systemctl stop mullvad-early-boot-blocking.service || true
systemctl disable 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"

View File

@@ -1,11 +1,9 @@
#!/bin/sh
#!/usr/bin/env bash
set -eu
# Stop the daemon gracefully, and set up firewall rules to prevent network
# leaks during upgrade.
if which systemctl >/dev/null 2>&1 && systemctl is-system-running | grep -vq offline >/dev/null 2>&1; then
if systemctl status mullvad-daemon >/dev/null 2>&1; then
mullvad-setup prepare-restart || true
if which systemctl &> /dev/null && systemctl is-system-running | grep -vq offline &> /dev/null; then
if systemctl status mullvad-daemon &> /dev/null; then
/opt/Mullvad\ VPN/resources/mullvad-setup prepare-restart || true
systemctl stop mullvad-daemon.service
systemctl disable mullvad-daemon.service
systemctl disable mullvad-early-boot-blocking.service || true
@@ -14,5 +12,5 @@ if which systemctl >/dev/null 2>&1 && systemctl is-system-running | grep -vq off
fi
fi
# Clear the cached API IP address.
rm -f /var/cache/mullvad-vpn/relays.json
rm -f /var/cache/mullvad-vpn/api-ip-address.txt

View File

@@ -2,23 +2,22 @@
# Maintainer: Joakim Hulthe <joakim@hulthe.net>
pkgname=mullvad-vpn-slint
pkgver=2026.1_git
pkgrel=4
pkgrel=1
pkgdesc="Mullvad VPN GUI"
url="https://mullvad.net/"
arch="all"
arch="$(uname -m)"
license="GPL-3-or-later"
# TODO: maybe depend on mullvad-vpn-daemon?
depends="
"
makedepends="
build-base
cargo-auditable
rust
pkgconfig
protobuf-dev
fontconfig-dev
dbus-dev
wayland-dev
build-base
rustup
musl-dev
pkgconfig
protobuf-dev
fontconfig-dev
dbus-dev
"
checkdepends=""
install=""
@@ -29,25 +28,28 @@ options="net !check"
_cargo_target_dir="${CARGO_TARGET_DIR:-$startdir/mullvadvpn-app/target}"
prepare() {
default_prepare
cd "$startdir/mullvadvpn-app"
cargo fetch --target "$CHOST" --locked
}
build() {
# rustup-init -y --default-toolchain stable
source "$HOME/.cargo/env"
cd "$startdir/mullvadvpn-app"
# Specify `--target` so that the final binary ends up in target/<target>/release.
cargo build --release --locked \
--target "$CHOST" \
# rustup default stable
local target="$(rustup +stable show active-toolchain | sed 's/^[^-]*-//' | grep -o "^[^ ]*")"
# * Force the `stable` toolchain since it's installed in the container.
# We don't wan't to needlessly download rust while building.
# * Specify `--target` so that the final binary ends up in target/<target>/release.
cargo +stable build --release --locked \
--target "$target" \
-p mullvad-slint
}
package() {
local target="$(rustup +stable show active-toolchain | sed 's/^[^-]*-//' | grep -o "^[^ ]*")"
# Executable
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-slint" \
install -m755 -D "$_cargo_target_dir/$target/release/mullvad-slint" \
"$pkgdir"/usr/bin/mullvad-slint
# .desktop file

View File

@@ -4,8 +4,6 @@ set -ex
cd "$(dirname "$0")"
package="$1"
shift
builder_image="mullvad-slint-musl-builder"
cargo_home="${CARGO_HOME:-$HOME/.cargo}"
. "$HOME/.abuild/abuild.conf"
@@ -24,5 +22,5 @@ podman run --rm \
-e "CARGO_TARGET_DIR=/cargo-target" \
-it \
"$builder_image" \
abuild -F "$@"
abuild -F