[packages/dbus] unfunction is_yes(), moved faster conditions to the front

gotar gotar at pld-linux.org
Fri Aug 5 18:03:24 CEST 2016


commit e9cc8b1a44ecd0349cb82be0121ac20fab32491a
Author: Tomasz Pala <gotar at pld-linux.org>
Date:   Fri Aug 5 18:01:47 2016 +0200

    unfunction is_yes(), moved faster conditions to the front

 dbus-daemon-1-profile.d-sh | 18 ++++++++----------
 dbus-xinitrc.sh            | 14 ++++++--------
 2 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/dbus-daemon-1-profile.d-sh b/dbus-daemon-1-profile.d-sh
index 5b572f0..45fec81 100644
--- a/dbus-daemon-1-profile.d-sh
+++ b/dbus-daemon-1-profile.d-sh
@@ -1,9 +1,11 @@
 #! /bin/sh
 
+[ -x /usr/bin/dbus-launch -a -f /var/run/dbus.pid ] || return
+
 # Get configuration
 . /etc/sysconfig/messagebus
 
-# Take from rc-scripts
+# Taken from rc-scripts
 is_yes()
 {
 	# Check value
@@ -19,12 +21,8 @@ is_yes()
 	esac
 }
 
-if is_yes "${SESSION_BUS_PROFILE_D}"; then
-    if [ -f /usr/bin/dbus-launch ]; then
-	if [ -f /var/run/dbus.pid ]; then
-	    if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
-		eval `dbus-launch --sh-syntax --exit-with-session`
-	    fi    
-	fi
-    fi
-fi
\ No newline at end of file
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && is_yes "${SESSION_BUS_PROFILE_D}"; then
+	eval `dbus-launch --sh-syntax --exit-with-session`
+fi
+
+unset -f is_yes
diff --git a/dbus-xinitrc.sh b/dbus-xinitrc.sh
index e1abd0f..a321dc0 100644
--- a/dbus-xinitrc.sh
+++ b/dbus-xinitrc.sh
@@ -1,5 +1,7 @@
 #! /bin/sh
 
+[ -x /usr/bin/dbus-launch -a -f /var/run/dbus.pid ] || return
+
 # Get configuration
 . /etc/sysconfig/messagebus
 
@@ -19,12 +21,8 @@ is_yes()
 	esac
 }
 
-if is_yes "${SESSION_BUS_X_SESSION}"; then
-    if  [ -f /usr/bin/dbus-launch ]; then
-	if [ -f /var/run/dbus.pid ]; then
-	    if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
-		eval `dbus-launch --sh-syntax --exit-with-session`
-	    fi    
-	fi
-    fi
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && is_yes "${SESSION_BUS_X_SESSION}"; then
+	eval `dbus-launch --sh-syntax --exit-with-session`
 fi
+
+unset -f is_yes
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dbus.git/commitdiff/e9cc8b1a44ecd0349cb82be0121ac20fab32491a



More information about the pld-cvs-commit mailing list