diff --git a/.changeset/lovely-fishes-impress.md b/.changeset/lovely-fishes-impress.md new file mode 100644 index 0000000000..9625f5878e --- /dev/null +++ b/.changeset/lovely-fishes-impress.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": patch +--- + +fix(deb): soft symlink instead of hardlink to handle when /opt is on a separate partition diff --git a/packages/app-builder-lib/templates/linux/after-install.tpl b/packages/app-builder-lib/templates/linux/after-install.tpl index 0f541f984f..65e7326773 100644 --- a/packages/app-builder-lib/templates/linux/after-install.tpl +++ b/packages/app-builder-lib/templates/linux/after-install.tpl @@ -3,9 +3,9 @@ if type update-alternatives 2>/dev/null >&1; then # Remove previous link if it doesn't use update-alternatives if [ -L '/usr/bin/${executable}' -a -e '/usr/bin/${executable}' -a "`readlink '/usr/bin/${executable}'`" != '/etc/alternatives/${executable}' ]; then - rm -f '/usr/bin/${executable}' + rm -f '/usr/bin/${executable}' fi - update-alternatives --install '/usr/bin/${executable}' '${executable}' '/opt/${sanitizedProductName}/${executable}' 100 + update-alternatives --install '/usr/bin/${executable}' '${executable}' '/opt/${sanitizedProductName}/${executable}' 100 || ln -sf '/opt/${sanitizedProductName}/${executable}' '/usr/bin/${executable}' else ln -sf '/opt/${sanitizedProductName}/${executable}' '/usr/bin/${executable}' fi @@ -13,5 +13,10 @@ fi # SUID chrome-sandbox for Electron 5+ chmod 4755 '/opt/${sanitizedProductName}/chrome-sandbox' || true -update-mime-database /usr/share/mime || true -update-desktop-database /usr/share/applications || true +if hash update-mime-database 2>/dev/null; then + update-mime-database /usr/share/mime || true +fi + +if hash update-desktop-database 2>/dev/null; then + update-desktop-database /usr/share/applications || true +fi diff --git a/test/snapshots/linux/debTest.js.snap b/test/snapshots/linux/debTest.js.snap index 3efaa02c0d..9c013447bb 100644 --- a/test/snapshots/linux/debTest.js.snap +++ b/test/snapshots/linux/debTest.js.snap @@ -541,9 +541,9 @@ exports[`executable path in postinst script 5`] = ` if type update-alternatives 2>/dev/null >&1; then # Remove previous link if it doesn't use update-alternatives if [ -L '/usr/bin/Boo' -a -e '/usr/bin/Boo' -a \\"\`readlink '/usr/bin/Boo'\`\\" != '/etc/alternatives/Boo' ]; then - rm -f '/usr/bin/Boo' + rm -f '/usr/bin/Boo' fi - update-alternatives --install '/usr/bin/Boo' 'Boo' '/opt/foo/Boo' 100 + update-alternatives --install '/usr/bin/Boo' 'Boo' '/opt/foo/Boo' 100 || ln -sf '/opt/foo/Boo' '/usr/bin/Boo' else ln -sf '/opt/foo/Boo' '/usr/bin/Boo' fi @@ -551,8 +551,13 @@ fi # SUID chrome-sandbox for Electron 5+ chmod 4755 '/opt/foo/chrome-sandbox' || true -update-mime-database /usr/share/mime || true -update-desktop-database /usr/share/applications || true" +if hash update-mime-database 2>/dev/null; then + update-mime-database /usr/share/mime || true +fi + +if hash update-desktop-database 2>/dev/null; then + update-desktop-database /usr/share/applications || true +fi" `; exports[`no quotes for safe exec name 1`] = `