1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-19 02:37:51 +03:00

add update-alternatives hooks for deb packages (#1883)

* add update-alternatives hooks for deb packages

Tested on ubuntu 20.04/21.10 and Linux Mint 20.3

* Apply suggestions from code review

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
This commit is contained in:
xpufx 2022-04-17 21:02:50 +03:00 committed by GitHub
parent e3bc607c51
commit cadc5f7d1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,6 +190,22 @@ Description: Wez's Terminal Emulator.
windows.
Provides: x-terminal-emulator
Source: https://wezfurlong.org/wezterm/
EOF
cat > pkg/debian/postinst <<EOF
#!/bin/sh
set -e
if [ "\$1" = "configure" ] ; then
update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/wezterm 20
fi
EOF
cat > pkg/debian/prerm <<EOF
#!/bin/sh
set -e
if [ "\$1" = "remove" ]; then
update-alternatives --remove x-terminal-emulator /usr/bin/wezterm
fi
EOF
install -Dsm755 -t pkg/debian/usr/bin target/release/wezterm-mux-server
@ -198,6 +214,10 @@ EOF
install -Dsm755 -t pkg/debian/usr/bin target/release/strip-ansi-escapes
deps=$(cd pkg && dpkg-shlibdeps -O -e debian/usr/bin/*)
mv pkg/debian/postinst pkg/debian/DEBIAN/postinst
chmod 0755 pkg/debian/DEBIAN/postinst
mv pkg/debian/prerm pkg/debian/DEBIAN/prerm
chmod 0755 pkg/debian/DEBIAN/prerm
mv pkg/debian/control pkg/debian/DEBIAN/control
echo $deps | sed -e 's/shlibs:Depends=/Depends: /' >> pkg/debian/DEBIAN/control
cat pkg/debian/DEBIAN/control