From 4724ab5b91bf5e26647a57178019bf00bfc82866 Mon Sep 17 00:00:00 2001 From: AP <67675386+Anaple@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:35:17 +0800 Subject: [PATCH] fix SUID chrome-sandbox (#12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 布丁狗~ --- build/linux/deb/postinst | 21 +++++++++++++++++++++ electron-builder.yml | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 build/linux/deb/postinst diff --git a/build/linux/deb/postinst b/build/linux/deb/postinst new file mode 100644 index 0000000..bb1b53d --- /dev/null +++ b/build/linux/deb/postinst @@ -0,0 +1,21 @@ +#!/bin/bash + +if type update-alternatives 2>/dev/null >&1; then + # Remove previous link if it doesn't use update-alternatives + if [ -L '/usr/bin/mihomo-party' -a -e '/usr/bin/mihomo-party' -a "`readlink '/usr/bin/mihomo-party'`" != '/etc/alternatives/mihomo-party' ]; then + rm -f '/usr/bin/mihomo-party' + fi + update-alternatives --install '/usr/bin/mihomo-party' 'mihomo-party' '/opt/mihomo-party/mihomo-party' 100 || ln -sf '/opt/mihomo-party/mihomo-party' '/usr/bin/mihomo-party' +else + ln -sf '/opt/mihomo-party/mihomo-party' '/usr/bin/mihomo-party' +fi + +chmod 4755 '/opt/mihomo-party/chrome-sandbox' || 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/electron-builder.yml b/electron-builder.yml index cf69086..a7b5f46 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -58,5 +58,7 @@ linux: maintainer: mihomo-party category: Utility artifactName: ${name}-linux-${version}-${arch}.${ext} +deb: + afterInstall: "build/linux/deb/postinst" npmRebuild: true publish: []