refactor(linux): package the service uninstaller wrapper through Tauri files

Place both uninstaller files in /usr/bin directly from the deb and rpm
`files` maps instead of having prebuild copy the wrapper over the
uninstaller sidecar and move the real binary to /usr/lib.

/usr/bin/clash-verge-service-uninstall stays the entry point that
released rpm %preun scripts and the app call, and is now
packages/linux/service-uninstall.sh itself. The real uninstaller is
packaged as /usr/bin/clash-verge-service-uninstall.real.

`files` sources cannot vary by target, while release builds run one
prebuild per Linux target, so prebuild stores the uninstaller without
the target-triple suffix. It is no longer an externalBin.

Refs #8515

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Tunglies
2026-11-09 23:46:30 +08:00
co-authored by Copilot
parent d09f78f9b1
commit afc85f2d55
5 changed files with 10 additions and 32 deletions
+5 -24
View File
@@ -550,16 +550,13 @@ const SERVICE_BINARIES = [
'clash-verge-service-uninstall',
]
// Linux packages install the uninstaller under /usr/lib behind a wrapper sidecar; see
// src-tauri/packages/linux/service-uninstall.sh and the files entries in tauri.linux.conf.json.
const LINUX_UNINSTALLER_FILE = 'clash-verge-service-uninstall-bin'
function serviceFileInfo(name) {
const ext = platform === 'win32' ? '.exe' : ''
const suffix = platform === 'linux' ? `-${SIDECAR_HOST}` : ''
if (platform === 'linux' && name === 'clash-verge-service-uninstall') {
return { sourceFile: name, targetFile: LINUX_UNINSTALLER_FILE }
}
// The Linux uninstaller is packaged through `files`, whose sources cannot vary by target.
const suffix =
platform === 'linux' && name !== 'clash-verge-service-uninstall'
? `-${SIDECAR_HOST}`
: ''
return {
sourceFile: `${name}${ext}`,
targetFile: `${name}${suffix}${ext}`,
@@ -580,22 +577,6 @@ async function findExtractedFile(dir, fileName) {
}
async function resolveServiceBundle() {
await fetchServiceBundle()
if (platform === 'linux') {
const wrapper = path.join(
SERVICE_DIR,
`clash-verge-service-uninstall-${SIDECAR_HOST}`,
)
await fsp.copyFile(
path.join(cwd, 'src-tauri', 'packages', 'linux', 'service-uninstall.sh'),
wrapper,
)
await fsp.chmod(wrapper, 0o755)
await updateHashCache(wrapper)
}
}
async function fetchServiceBundle() {
const files = SERVICE_BINARIES.map((name) => {
const info = serviceFileInfo(name)
return {