From 53105982c23cad98dbe82da80514ee086d4a185b Mon Sep 17 00:00:00 2001
From: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
Date: Thu, 13 Feb 2014 14:26:46 -0200
Subject: [PATCH] le-proinfodata: Fix ask INEP dialog not opening sometimes

Signed-off-by: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
---
 le-proinfodata/package/DEBIAN/control         |  2 +-
 .../package/usr/local/bin/exec_dialog.sh      | 21 ++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/le-proinfodata/package/DEBIAN/control b/le-proinfodata/package/DEBIAN/control
index 6f921e74..f79ca152 100644
--- a/le-proinfodata/package/DEBIAN/control
+++ b/le-proinfodata/package/DEBIAN/control
@@ -1,5 +1,5 @@
 Package: le-proinfodata
-Version: 1.2.36
+Version: 1.2.37
 Maintainer: <proinfodata@c3sl.ufpr.br>
 Architecture: i386
 Section: main
diff --git a/le-proinfodata/package/usr/local/bin/exec_dialog.sh b/le-proinfodata/package/usr/local/bin/exec_dialog.sh
index 6269f41f..374d1c91 100755
--- a/le-proinfodata/package/usr/local/bin/exec_dialog.sh
+++ b/le-proinfodata/package/usr/local/bin/exec_dialog.sh
@@ -52,17 +52,25 @@ function disable_gnome() {
     local P_EDUBAR_POS=""
     local P_GPANEL=""
 
-    while [[ -z "$P_EDUBAR" ]] || [[ -z "$P_GPANEL" ]] || [[ -z "$P_EDUBAR_POS" ]]; do
+    while true; do
         # Get PID
-        P_EDUBAR_POS=$(ps aux | grep "le-edubar_position.sh" | awk '{print $2}')
-        P_EDUBAR=$(pgrep le-edubar)
+        P_EDUBAR_POS="$(ps aux | grep "le-edubar_position.sh" | grep -v "grep" \
+                       | awk '{print $2}')"
         P_GPANEL=$(pgrep gnome-panel)
-        sleep 1
+        P_EDUBAR=$(pgrep -f "le-edubar -c")
+
+        if [[ -z "$P_GPANEL" ]] ||
+           [[ -z "$P_EDUBAR_POS" ]] ||
+           [[ -z "$P_EDUBAR" ]]; then
+            sleep 1
+        else
+            break
+        fi
     done
 
     # Disable Edubar and Panel
-    kill $P_EDUBAR
     kill -stop $P_EDUBAR_POS $P_GPANEL
+    kill $P_EDUBAR
 }
 
 # Enable user interaction with gnome panel
@@ -99,8 +107,7 @@ if dpkg --get-selections "ubiquity-le" | grep -q 'install$' ||
     exit 0
 fi
 # --------------------------------------------------------------------
-# Delay for not happen overlay window
-sleep 3
+
 # Check whether the computer is running on a the multiterminal
 if dpkg --get-selections "le-multiterminal" | grep -q 'install$'; then
     # In the first call (lightdm) in multiterminal this is script must leave, to be called again after.
-- 
GitLab