From 6bcfb24dde323ccd9ff12b9415435cb6a4ceb21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0?= Date: Sat, 11 Nov 2023 23:25:21 +0100 Subject: [PATCH] Fix installing DEB package when lib64 is a symlink to lib (fixes #414) --- native/Cargo.toml | 3 +-- native/packages/deb/postinst | 6 ++++++ native/packages/deb/postrm | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/native/Cargo.toml b/native/Cargo.toml index b7cb214c..6d541004 100644 --- a/native/Cargo.toml +++ b/native/Cargo.toml @@ -111,9 +111,8 @@ assets = [ ["target/release/firefoxpwa", "/usr/bin/firefoxpwa", "755"], ["target/release/firefoxpwa-connector", "/usr/libexec/firefoxpwa-connector", "755"], - # Manifests + # Manifest ["manifests/linux.json", "/usr/lib/mozilla/native-messaging-hosts/firefoxpwa.json", "644"], - ["manifests/linux.json", "/usr/lib64/mozilla/native-messaging-hosts/firefoxpwa.json", "644"], # Completions ["target/release/completions/firefoxpwa.bash", "/usr/share/bash-completion/completions/firefoxpwa", "644"], diff --git a/native/packages/deb/postinst b/native/packages/deb/postinst index 6afa48fd..976204fa 100644 --- a/native/packages/deb/postinst +++ b/native/packages/deb/postinst @@ -1,6 +1,12 @@ #!/bin/sh set -e +# Duplicate the manifest file over lib and lib64 directories +# Needed because otherwise the manifest may not be detected on some platforms +# Needed here because packaging it normally breaks when lib64 is a symlink to lib +mkdir -p /usr/lib64/mozilla/native-messaging-hosts || true +cp -f /usr/lib/mozilla/native-messaging-hosts/firefoxpwa.json /usr/lib64/mozilla/native-messaging-hosts/firefoxpwa.json || true + # Make shell completions executable # We cannot do this in Cargo.toml because of cargo-deb bug # See: https://github.com/mmstick/cargo-deb/issues/67 diff --git a/native/packages/deb/postrm b/native/packages/deb/postrm index 7500c1b9..b471e997 100644 --- a/native/packages/deb/postrm +++ b/native/packages/deb/postrm @@ -1,6 +1,13 @@ #!/bin/sh set -e +# Remove the duplicated manifest files +if [ "$1" = "remove" ] +then + rm /usr/lib/mozilla/native-messaging-hosts/firefoxpwa.json || true + rm /usr/lib64/mozilla/native-messaging-hosts/firefoxpwa.json || true +fi + # Add warning that runtime, profiles and web apps are still installed if [ "$1" = "remove" ] then