[X2Go-Commits] [x2goserver] 09/17: x2goserver-desktopsharing/bin/x2goterminate-desktopsharing: more curly braces, quotes etc.

git-admin at x2go.org git-admin at x2go.org
Fri Nov 16 03:47:05 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 621f47df44a7296dcbe1ba4cd268a382594ced84
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Nov 16 03:11:05 2018 +0100

    x2goserver-desktopsharing/bin/x2goterminate-desktopsharing: more curly braces, quotes etc.
---
 debian/changelog                                   |  2 +
 .../bin/x2goterminate-desktopsharing               | 46 +++++++++++-----------
 2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3e522be..5da383f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -55,6 +55,8 @@ x2goserver (4.1.0.3-0x2go1) UNRELEASED; urgency=medium
       historical "egrep" with "grep -E".
     - x2goserver-desktopsharing/bin/x2goterminate-desktopsharing: don't use
       negative exit codes.
+    - x2goserver-desktopsharing/bin/x2goterminate-desktopsharing: more curly
+      braces, quotes etc.
   * x2goserver.spec:
     + Pull in openSUSE-release manually on OpenSuSE Tumbleweed to work around
       a bug.
diff --git a/x2goserver-desktopsharing/bin/x2goterminate-desktopsharing b/x2goserver-desktopsharing/bin/x2goterminate-desktopsharing
index 43455a0..51b5b1a 100755
--- a/x2goserver-desktopsharing/bin/x2goterminate-desktopsharing
+++ b/x2goserver-desktopsharing/bin/x2goterminate-desktopsharing
@@ -21,39 +21,39 @@
 # Copyright (C) 2011-2015 Heinz-Markus Graesing <heinz-m.graesing at obviously-nice.de>
 # Copyright (C) 2011-2015 Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
 
-if [ $# -eq 1   ]; then
-	SESSION_NAME=$1
+if [ "${#}" -eq '1' ]; then
+	SESSION_NAME="${1}"
 else
-	SESSION_NAME=$X2GO_SESSION
+	SESSION_NAME="${X2GO_SESSION}"
 fi
 
-X2GO_LIB_PATH=`x2gopath libexec`
+X2GO_LIB_PATH="$(x2gopath 'libexec')"
 
-if type -p pidof 1>/dev/null 2>/dev/null; then
-    PIDOF=pidof
-elif [ -x /usr/local/sbin/pidof ]; then
-    PIDOF=/usr/local/sbin/pidof
-elif [ -x /usr/sbin/pidof ]; then
-    PIDOF=/usr/sbin/pidof
-elif [ -x /sbin/pidof ]; then
-    PIDOF=/sbin/pidof
+if type -p 'pidof' 1>'/dev/null' 2>'/dev/null'; then
+	PIDOF='pidof'
+elif [ -x '/usr/local/sbin/pidof' ]; then
+	PIDOF='/usr/local/sbin/pidof'
+elif [ -x '/usr/sbin/pidof' ]; then
+	PIDOF='/usr/sbin/pidof'
+elif [ -x '/sbin/pidof' ]; then
+	PIDOF='/sbin/pidof'
 else
 	# no pidof utility found, get out the big hammer!!!
-	killall x2godesktopsharing
-	exit 0
+	killall 'x2godesktopsharing'
+	exit '0'
 fi
 
-$X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@"
+"${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${@}"
 
 
-X2GO_DISPLAY=$(echo $SESSION_NAME | cut -d"-" -f2)
-for process_id in `$PIDOF x2godesktopsharing`; do
-	env_of_process=$(cat -A /proc/$process_id/environ)
-	env_of_process=${env_of_process//^@/\\n}
-	display=$(echo -e $env_of_process | grep -E "^DISPLAY=.*$" | cut -d"=" -f2)
-	if echo $display | grep ":$X2GO_DISPLAY" &>/dev/null; then
-		kill -SIGTERM $process_id
-		exit 0
+X2GO_DISPLAY="$(echo "${SESSION_NAME}" | cut -d '-' -f '2')"
+for process_id in $("${PIDOF}" 'x2godesktopsharing'); do
+	env_of_process="$(cat -A "/proc/${process_id}/environ")"
+	env_of_process="${env_of_process//^@/\\n}"
+	display="$(echo -e "${env_of_process}" | grep -E '^DISPLAY=.*$' | cut -d '=' -f '2')"
+	if echo "${display}" | grep ":${X2GO_DISPLAY}" &>'/dev/null'; then
+		kill -SIGTERM "${process_id}"
+		exit '0'
 	fi
 done
 

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list