mirror of
https://github.com/stablyai/orca.git
synced 2026-10-02 00:02:05 +00:00
fix(linux): preserve CLI link during package upgrades
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user