summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglasseyes <dglassey@gmail.com>2019-01-28 09:52:26 -0600
committerglasseyes <dglassey@gmail.com>2019-01-28 09:52:26 -0600
commit7eaff0c746eaa797b1c0e1eb8b56cb638955e8c5 (patch)
treefa06e783be835e4125663a1ad64f67d2128cf979
parent8460cee35a04a341405bd82d5f5f527b28f0d828 (diff)
d/postinst/rm more robust to ibus not running
and running in gnome-shell
-rw-r--r--debian/changelog7
-rw-r--r--debian/postinst13
-rw-r--r--debian/postrm13
3 files changed, 29 insertions, 4 deletions
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 <wdg@debian.org> 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
;;