mirror of
https://github.com/libracoder/kiri.git
synced 2026-12-07 07:41:46 +09:00
* Linux packages install beside Docker's own Compose and buildx
The full kiri .deb/.rpm put docker-compose and docker-buildx straight into
/usr/lib/docker/cli-plugins, which docker-desktop, docker-compose-plugin and
docker-buildx-plugin own, so dpkg refused the install ("trying to overwrite
'/usr/lib/docker/cli-plugins/docker-buildx', which is also in package
docker-desktop").
The plugins now live in /usr/libexec/kiri/cli-plugins and are linked into
/usr/lib/docker/cli-plugins through update-alternatives only where the slot
is free, as /usr/bin/docker already was; otherwise Docker's plugins stay and
Kiri's docker uses them. The rpm does it in %posttrans, since an upgrade
erases the old package's real files there only after %post.
* Leave Docker's plugins in /usr/libexec alone, and re-check when they change
Docker's apt/dnf packages (docker-compose-plugin, docker-buildx-plugin) put
their plugins in /usr/libexec/docker/cli-plugins. The CLI searches
/usr/lib/docker/cli-plugins first, so a Kiri link there replaced Docker's
Compose and buildx. A plugin's slot now counts as taken when Docker's copy is
in any of the CLI's plugin folders (/usr/lib, /usr/libexec, /usr/local/lib,
/usr/local/libexec), and Kiri's link is removed if Docker's copy turns up.
A dpkg trigger (interest-noawait on those folders) and rpm
%filetriggerin/%filetriggerpostun run the check again when another package
adds or removes plugins there, so Docker's packages installed or removed
after Kiri are handled too.
30 lines
1.0 KiB
Bash
30 lines
1.0 KiB
Bash
#!/bin/sh
|
|
# kiri / kiri-lite .deb: before the files go. Stops the engine (containers it
|
|
# ran stop with it) and withdraws Kiri's docker CLI from PATH.
|
|
set -e
|
|
# Removing Kiri stops everything it runs: the engine (above, which stops its
|
|
# containers), and any window or kiri command still open from this package
|
|
# (`kiri share`, `kiri ui`), first asked to quit, then made to.
|
|
stop_everything() {
|
|
for sig in TERM KILL; do
|
|
pkill -"$sig" -f '^/usr/lib/kiri/kiri-window( |$)' 2>/dev/null || true
|
|
pkill -"$sig" -f '^(/usr)?/bin/kiri( |$)' 2>/dev/null || true
|
|
[ "$sig" = KILL ] || sleep 1
|
|
done
|
|
}
|
|
case "$1" in
|
|
remove|deconfigure)
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl disable --now kiri.service || true
|
|
fi
|
|
stop_everything
|
|
if [ -x /usr/libexec/kiri/docker ]; then
|
|
update-alternatives --remove docker /usr/libexec/kiri/docker || true
|
|
for p in docker-compose docker-buildx; do
|
|
update-alternatives --remove "$p" "/usr/libexec/kiri/cli-plugins/$p" || true
|
|
done
|
|
fi
|
|
;;
|
|
esac
|
|
exit 0
|