Include install-scripts

This commit is contained in:
2026-04-09 21:16:08 +02:00
parent c5383fd2c9
commit 4e232c39be
6 changed files with 36 additions and 52 deletions

View File

@@ -24,9 +24,7 @@ makedepends="
libnftnl-dev
"
checkdepends=""
# TODO: pre/post(de)install-scripts
#install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-deinstall $pkgname.post-deinstall"
install=""
install="$pkgname.post-install $pkgname.pre-upgrade $pkgname.post-upgrade $pkgname.pre-deinstall $pkgname.post-deinstall"
subpackages="$pkgname-systemd"
source=""
builddir="$srcdir/"
@@ -49,10 +47,11 @@ build() {
# * 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-daemon \
-p mullvad-exclude \
-p mullvad-problem-report
-p mullvad-problem-report \
-p mullvad-setup
}
check() {
@@ -61,18 +60,21 @@ check() {
}
package() {
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-daemon" \
"$pkgdir"/usr/bin/mullvad-daemon
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad" \
"$pkgdir"/usr/bin/mullvad
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-daemon" \
"$pkgdir"/usr/bin/mullvad-daemon
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
install -m755 -D "$_cargo_target_dir/$CHOST/release/mullvad-setup" \
"$pkgdir"/usr/bin/mullvad-setup
}
systemd() {

View File

@@ -1,39 +1,9 @@
#!/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,10 @@
#!/usr/bin/env bash
set -eu
ln -sf /opt/Mullvad\ VPN/resources/mullvad-problem-report /usr/bin/mullvad-problem-report
if which systemctl &> /dev/null && systemctl is-system-running | grep -vq offline &> /dev/null; then
if systemctl status mullvad-daemon &> /dev/null; 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
fi

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -eu
if which systemctl &> /dev/null && systemctl is-system-running | grep -vq offline &> /dev/null; then
if systemctl status mullvad-daemon &> /dev/null; 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
fi

View File

@@ -19,5 +19,5 @@ 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"
mullvad-setup reset-firewall || echo "Failed to reset firewall"
mullvad-setup remove-device || echo "Failed to remove device from account"

View File

@@ -3,7 +3,7 @@ set -eu
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
mullvad-setup prepare-restart || true
systemctl stop mullvad-daemon.service
systemctl disable mullvad-daemon.service
systemctl disable mullvad-early-boot-blocking.service || true