fix(linux): preserve CLI link during package upgrades

This commit is contained in:
Neil
2026-08-31 05:48:38 -07:00
parent b29bec1121
commit a4d2b09f87
2 changed files with 24 additions and 0 deletions
@@ -0,0 +1,18 @@
import { readFileSync } from 'node:fs'
import { describe, expect, it } from 'vitest'
describe('Linux package maintainer scripts', () => {
it('keeps upgrades from removing the installed CLI', () => {
const script = readFileSync(
new URL('../../resources/linux/packaging/after-remove.sh', import.meta.url),
'utf8'
)
const unlinkStart = script.indexOf('link="/usr/bin/orca-ide"')
const upgradeGuard = script.slice(0, unlinkStart)
expect(unlinkStart).toBeGreaterThan(-1)
expect(upgradeGuard).toContain('case "${1-}" in')
expect(upgradeGuard).toContain('0 | remove | purge) ;;')
expect(upgradeGuard).toContain('*) exit 0 ;;')
})
})
@@ -4,6 +4,12 @@
# /usr/bin/orca-ide a user or other package may own.
set -e
# RPM passes an instance count; dpkg passes the package lifecycle action.
case "${1-}" in
0 | remove | purge) ;;
*) exit 0 ;;
esac
link="/usr/bin/orca-ide"
if [ -L "$link" ]; then