[X2Go-Commits] [x2goserver] 30/33: x2goserver/bin/x2gostartagent: fix most other shellcheck warnings, more quotes, curly braces et. al.

git-admin at x2go.org git-admin at x2go.org
Wed Jan 10 00:19:25 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 c2e2bad6703d6a333ea0fc7fcdc7c463bfa36f69
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Tue Jan 9 03:56:12 2018 +0100

    x2goserver/bin/x2gostartagent: fix most other shellcheck warnings, more quotes, curly braces et. al.
---
 debian/changelog              |  2 ++
 x2goserver/bin/x2gostartagent | 28 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 553078a..1d3ab00 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -197,6 +197,8 @@ x2goserver (4.1.0.0-0x2go1.2) UNRELEASED; urgency=low
     - X2Go/Server/DB/SQLite3.pm: fix command name in error messages.
     - X2Go/Utils.pm: backport user name regex changes.
     - x2goserver-x2goagent/etc/x2goagent.options: reenable XFIXES extension.
+    - x2goserver/bin/x2gostartagent: fix most other shellcheck warnings, more
+      quotes, curly braces et. al.
   * x2goserver.spec:
     - Only create session DB in x2goserver's post install script. Do use
       proper Requires(post) statements to make sure perl-X2Go-Server-DB and
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index e9e89f4..bcf38be 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -80,7 +80,7 @@ if ! current_host_name="$(hostname)"; then
 	exit '6'
 fi
 
-X2GO_TELEKINESIS_ENABLED=`echo 'use X2Go::Config qw( get_config ); use X2Go::Utils qw( is_true ); my $Config = get_config(); print is_true($Config->param("telekinesis.enable"));' | perl`
+X2GO_TELEKINESIS_ENABLED="$(perl -e 'use X2Go::Config qw( get_config ); use X2Go::Utils qw( is_true ); my $Config = get_config(); print is_true($Config->param("telekinesis.enable"));')"
 
 X2GO_ROOT="${HOME}/.x2go"
 export NX_ROOT="${X2GO_ROOT}"
@@ -181,7 +181,7 @@ if [[ "${X2GO_STYPE}" = 'S' ]]; then
 		exit '0'
 	fi
 else
-	X2GO_CLIPBOARD="$1"; shift
+	X2GO_CLIPBOARD="${1}"; shift
 fi
 
 LIMIT="$(x2gosessionlimit)"
@@ -224,7 +224,7 @@ for ((retry = 0; retry < max_retry; ++retry)); do
 	if free_port="$("${X2GO_LIB_PATH}/x2gogetfreeport" "${current_host_name}" "${ss}" 'display' "${X2GO_PORT}")"; then
 		X2GO_PORT="${free_port}"
 
-		if [ -n "${SHADREQ_USER}" ]; then
+		if [[ -n "${SHADREQ_USER}" ]]; then
 			SESSION_NAME="${SHADREQ_USER}-${X2GO_PORT}-$(date '+%s')"
 		else
 			SESSION_NAME="${USER}-${X2GO_PORT}-$(date '+%s')"
@@ -237,7 +237,7 @@ for ((retry = 0; retry < max_retry; ++retry)); do
 		# sanitize session name
 		SESSION_NAME="$(perl -pe 's/[^a-zA-Z0-9\.\_\-\@]//g' <<< "${SESSION_NAME}")"
 
-		if [ -n "${SHADREQ_USER}" ]; then
+		if [[ -n "${SHADREQ_USER}" ]]; then
 			"${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "initializing new shadow session with ID ${SESSION_NAME}"
 			output="$("${X2GO_LIB_PATH}/x2goinsertshadowsession" "${X2GO_PORT}" "${current_host_name}" "${SESSION_NAME}" "${SHADREQ_USER}")"
 		else
@@ -264,10 +264,10 @@ if [[ "${output}" != 'inserted' ]]; then
 	exit '11'
 fi
 
-if [ "x$X2GO_TELEKINESIS_ENABLED" == "x0" ] || [ "x$X2GO_STYPE" = "xS" ] || ! type -p telekinesis-server 1>/dev/null; then
-	TEKICTRL_PORT="-1"
-	TEKIDATA_PORT="-1"
-	X2GO_TELEKINESIS_ENABLED="0"
+if [[ "${X2GO_TELEKINESIS_ENABLED}" = '0' ]] || [[ "${X2GO_STYPE}" = 'S' ]] || ! type -p 'telekinesis-server' 1>'/dev/null'; then
+	TEKICTRL_PORT='-1'
+	TEKIDATA_PORT='-1'
+	X2GO_TELEKINESIS_ENABLED='0'
 fi
 
 while [[ -z "${GR_PORT}" ]] || [[ -z "${SOUND_PORT}" ]] || [[ -z "${FS_PORT}" ]] || [[ -z "${TEKICTRL_PORT}" ]] || [[ -z "${TEKIDATA_PORT}" ]]; do
@@ -302,11 +302,11 @@ while [[ -z "${GR_PORT}" ]] || [[ -z "${SOUND_PORT}" ]] || [[ -z "${FS_PORT}" ]]
 		GR_PORT="${SSH_PORT}"
 	elif [[ -z "${SOUND_PORT}" ]]; then
 		SOUND_PORT="${SSH_PORT}"
-	elif [ -z "${FS_PORT}" ]; then
+	elif [[ -z "${FS_PORT}" ]]; then
 		FS_PORT="${SSH_PORT}"
-	elif [ -z "${TEKICTRL_PORT}" ]; then
+	elif [[ -z "${TEKICTRL_PORT}" ]]; then
 		TEKICTRL_PORT="${SSH_PORT}"
-	elif [ -z "${TEKIDATA_PORT}" ]; then
+	elif [[ -z "${TEKIDATA_PORT}" ]]; then
 		TEKIDATA_PORT="${SSH_PORT}"
 	fi
 done
@@ -341,8 +341,8 @@ if [[ ! -d "${X2GO_TMP_ROOT}" ]]; then
 fi
 
 SESSION_DIR="${X2GO_TMP_ROOT}/C-${SESSION_NAME}"
-if [ "x$X2GO_TELEKINESIS_ENABLED" != "x0" ] && [ "x$X2GO_STYPE" != "xS" ]; then
-	mkdir -p "${SESSION_DIR}/telekinesis/remote/"
+if [[ "${X2GO_TELEKINESIS_ENABLED}" != '0' ]] && [[ "${X2GO_STYPE}" != 'S' ]]; then
+	mkdir -p -- "${SESSION_DIR}/telekinesis/remote/"
 fi
 
 STATE_FILE="${SESSION_DIR}/state"
@@ -492,7 +492,7 @@ echo "${SESSION_NAME}"
 echo "${GR_PORT}"
 echo "${SOUND_PORT}"
 echo "${FS_PORT}"
-if [ "x${X2GO_TELEKINESIS_ENABLED}" == "x1" ]; then
+if [[ "${X2GO_TELEKINESIS_ENABLED}" = '1' ]]; then
 	echo "${TEKICTRL_PORT}"
 	echo "${TEKIDATA_PORT}"
 fi

--
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