From 7eaff0c746eaa797b1c0e1eb8b56cb638955e8c5 Mon Sep 17 00:00:00 2001 From: glasseyes Date: Mon, 28 Jan 2019 09:52:26 -0600 Subject: d/postinst/rm more robust to ibus not running and running in gnome-shell --- debian/changelog | 7 +++++++ debian/postinst | 13 +++++++++++-- debian/postrm | 13 +++++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 5b78738..dee21ee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ibus-keyman (11.0.103-3) unstable; urgency=medium + + * postinst/rm be more robust to ibus not running + and running in gnome-shell + + -- Daniel Glassey Mon, 28 Jan 2019 09:50:07 -0600 + ibus-keyman (11.0.103-2) unstable; urgency=medium * d/control dep on procps for postinst/rm diff --git a/debian/postinst b/debian/postinst index 32a35b7..55a36b0 100644 --- a/debian/postinst +++ b/debian/postinst @@ -6,10 +6,19 @@ case "$1" in configure) # Restart IBus if it is running - ibuspid=`ps -C ibus-daemon -o pid=` + ! ibuspid=`ps -C ibus-daemon -o pid=|head -n 1` if [ "x$ibuspid" != "x" ]; then - ibus restart + # check for gnome-shell as it works differently + ! gspid=`ps -C gnome-shell -o pid=|head -n 1` + if [ "x$gspid" != "x" ]; then + # gnome-shell has multiple ibus-daemon processes and needs exit instead of restart + ibususer=`ps -C ibus-daemon -o user=|grep -v gdm|uniq` + sudo -H -u "$ibususer" ibus exit + else + ibususer=`ps -C ibus-daemon -o user=` + sudo -H -u "$ibususer" ibus restart + fi fi ;; diff --git a/debian/postrm b/debian/postrm index b0b37c4..dab0bec 100644 --- a/debian/postrm +++ b/debian/postrm @@ -6,10 +6,19 @@ case "$1" in remove) # Restart IBus if it is running - ibuspid=`ps -C ibus-daemon -o pid=` + ! ibuspid=`ps -C ibus-daemon -o pid=|head -n 1` if [ "x$ibuspid" != "x" ]; then - ibus restart + # check for gnome-shell as it works differently + ! gspid=`ps -C gnome-shell -o pid=|head -n 1` + if [ "x$gspid" != "x" ]; then + # gnome-shell has multiple ibus-daemon processes and needs exit instead of restart + ibususer=`ps -C ibus-daemon -o user=|grep -v gdm|uniq` + sudo -H -u "$ibususer" ibus exit + else + ibususer=`ps -C ibus-daemon -o user=` + sudo -H -u "$ibususer" ibus restart + fi fi ;; -- cgit v1.2.3