mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-11 03:15:33 +00:00
Merge pull request #8295 from keymanapp/fix/linux/cherry-pick/debian
fix(linux): Fix debian postinst script 🍒
This commit is contained in:
commit
289e2bf705
1 changed files with 13 additions and 10 deletions
|
|
@ -1,10 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
# Don't call `set -e`. Even if some commands should fail, it's still
|
||||
# worth running the rest of the commands.
|
||||
|
||||
case "$1" in
|
||||
|
||||
configure)
|
||||
# (Re-)Start IBus
|
||||
|
||||
# if don't have sudo and ps then don't attempt to restart ibus
|
||||
if which sudo > /dev/null && which ps > /dev/null; then
|
||||
|
||||
|
|
@ -37,20 +40,20 @@ case "$1" in
|
|||
fi
|
||||
|
||||
# Verify that it's running now
|
||||
if [ ! -z $SUDO_USER ] && id $SUDO_USER > /dev/null 2>/dev/null; then
|
||||
! ibusdaemon=$(ps --user $SUDO_USER -o s= -o cmd | grep --regexp="^[^ZT] ibus-daemon .*--xim.*")
|
||||
if [ "x$ibusdaemon" = "x" ]; then
|
||||
if [ -n "$SUDO_USER" ] && id "$SUDO_USER" > /dev/null 2>/dev/null; then
|
||||
ibusdaemon=$(ps --user "$SUDO_USER" -o s= -o cmd | grep --regexp="^[^ZT] \(/usr/bin/\)\?ibus-daemon .*--xim.*")
|
||||
if [ "$ibusdaemon" = "" ]; then
|
||||
# otherwise try to start it for the user installing the package
|
||||
if [ "x$is_gnome_shell" = "x1" ]; then
|
||||
for session in $(loginctl show-user ${SUDO_USER} -p Sessions --value); do
|
||||
case $(loginctl show-session ${session} -p Type --value) in
|
||||
wayland) sudo -H -u "${SUDO_USER}" -i WAYLAND_DISPLAY=wayland-0 -- ibus-daemon -d -r --xim --panel disable;;
|
||||
x11) sudo -H -u "${SUDO_USER}" -- ibus-daemon -d -r --xim --panel disable;;
|
||||
if [ "$is_gnome_shell" = "1" ]; then
|
||||
for session in $(loginctl show-user "${SUDO_USER}" -p Sessions --value); do
|
||||
case $(loginctl show-session "${session}" -p Type --value) in
|
||||
wayland) sudo -H -u "${SUDO_USER}" -i WAYLAND_DISPLAY=wayland-0 -- /usr/bin/ibus-daemon -d -r --xim --panel disable;;
|
||||
x11) sudo -H -u "${SUDO_USER}" -- /usr/bin/ibus-daemon -d -r --xim --panel disable;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
sudo -H -u "${SUDO_USER}" -- ibus-daemon -d -r --xim
|
||||
sudo -H -u "${SUDO_USER}" -- /usr/bin/ibus-daemon -d -r --xim
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue