Distributions have different directory layouts and names, so files may not necessarily be located in <base>/lib/x2go at all times. Do not hardcode such paths and have the programs instead use the new x2gopath helper (obsoletes x2gobasepath). --- Patch is also retrievable from
git://git.inai.de/x2goserver master .../share/x2gofeature.d/x2goserver-compat.features | 2 +- .../bin/x2goserver-run-extensions | 4 +-- .../man/man8/x2goserver-run-extensions.8 | 4 +-- .../x2gofeature.d/x2goserver-extensions.features | 2 +- .../x2gofeature.d/x2goserver-fmbindings.features | 2 +- .../x2gofeature.d/x2goserver-printing.features | 2 +- .../share/x2gofeature.d/x2goserver-pyhoca.features | 2 +- x2goserver-xsession/etc/Xsession | 4 ++- .../x2gofeature.d/x2goserver-xsession.features | 2 +- x2goserver/bin/x2gobasepath | 31 ++------------------ x2goserver/bin/x2gocmdexitmessage | 2 +- x2goserver/bin/x2gofeature | 4 +-- x2goserver/bin/x2gofeaturelist | 4 +-- x2goserver/bin/x2gopath | 19 ++++++++++++ x2goserver/bin/x2goresume-session | 2 +- x2goserver/bin/x2goruncommand | 2 +- x2goserver/bin/x2gosetkeyboard | 2 +- x2goserver/bin/x2gostartagent | 2 +- x2goserver/bin/x2gosuspend-session | 2 +- x2goserver/bin/x2goterminate-session | 2 +- x2goserver/bin/x2goversion | 2 +- x2goserver/man/man8/x2gopath.8 | 28 ++++++++++++++++++ x2goserver/sbin/x2gocleansessions | 2 +- x2goserver/sbin/x2golistsessions_root | 2 +- x2goserver/share/x2gofeature.d/x2goserver.features | 2 +- 25 files changed, 77 insertions(+), 55 deletions(-) create mode 100755 x2goserver/bin/x2gopath create mode 100644 x2goserver/man/man8/x2gopath.8 diff --git a/x2goserver-compat/share/x2gofeature.d/x2goserver-compat.features b/x2goserver-compat/share/x2gofeature.d/x2goserver-compat.features index d180d95..f4a9376 100755 --- a/x2goserver-compat/share/x2gofeature.d/x2goserver-compat.features +++ b/x2goserver-compat/share/x2gofeature.d/x2goserver-compat.features @@ -20,7 +20,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver-extensions/bin/x2goserver-run-extensions b/x2goserver-extensions/bin/x2goserver-run-extensions index 70636f6..f89515c 100755 --- a/x2goserver-extensions/bin/x2goserver-run-extensions +++ b/x2goserver-extensions/bin/x2goserver-run-extensions @@ -25,7 +25,7 @@ set -e test -z $2 && { echo "usage: $(basename $0) <X2GO_SESSION_ID> <MODALITY>"; exit -1; } -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" @@ -33,7 +33,7 @@ X2GO_SESSION="$1" X2GO_MODALITY="$2" # scan extensions and execute them -find /usr/lib/x2go/extensions/${X2GO_MODALITY}.d/ -maxdepth 1 -mindepth 1 | egrep "/[0-9]{3}_[[:alnum:]]+" | sort | while read x2go_extension; do +find "$X2GO_LIB_PATH/extensions/$X2GO_MODALITY.d/" -maxdepth 1 -mindepth 1 | egrep "/[0-9]{3}_[[:alnum:]]+" | sort | while read x2go_extension; do $X2GO_LIB_PATH/x2gosyslog "$0" "debug" "executing $x2go_extension with option $X2GO_SESSION" $x2go_extension "$X2GO_SESSION" &>/dev/null && { $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$x2go_extension ($(basename $0)) for session $X2GO_SESSION has finished sucessfully" diff --git a/x2goserver-extensions/man/man8/x2goserver-run-extensions.8 b/x2goserver-extensions/man/man8/x2goserver-run-extensions.8 index e2c0c34..3fe1e4f 100644 --- a/x2goserver-extensions/man/man8/x2goserver-run-extensions.8 +++ b/x2goserver-extensions/man/man8/x2goserver-run-extensions.8 @@ -36,9 +36,9 @@ Calling X2Go Server core scripts currently are: \fBx2gostartagent(8)\fR, \fBx2go .PP The modality names all refer to a sub-directory of the path: - \fI<INSTALL_PREFIX>/lib/x2go/extensions\fR, + \fI<libexecdir>/x2go/extensions\fR, -where <INSTALL_PREFIX> mostly is /usr on commonly-used GNU/Linux systems. +where <libexecdir> is /usr/libexec/x2go or /usr/lib/x2go on commonly-used GNU/Linux systems. .PP In any of these sub-directories third-party X2Go extension packages can place scripts or binaries that will then get executed by the core X2Go server commands, either before or after the essential functionality (e.g. x2goagent startup, x2goagent suspension, x2goagent resumption, etc.) or on failure of that diff --git a/x2goserver-extensions/share/x2gofeature.d/x2goserver-extensions.features b/x2goserver-extensions/share/x2gofeature.d/x2goserver-extensions.features index 2a21cad..7f89a5c 100755 --- a/x2goserver-extensions/share/x2gofeature.d/x2goserver-extensions.features +++ b/x2goserver-extensions/share/x2gofeature.d/x2goserver-extensions.features @@ -20,7 +20,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver-fmbindings/share/x2go/x2gofeature.d/x2goserver-fmbindings.features b/x2goserver-fmbindings/share/x2go/x2gofeature.d/x2goserver-fmbindings.features index c1d5827..52f6111 100755 --- a/x2goserver-fmbindings/share/x2go/x2gofeature.d/x2goserver-fmbindings.features +++ b/x2goserver-fmbindings/share/x2go/x2gofeature.d/x2goserver-fmbindings.features @@ -20,7 +20,7 @@ # Copyright (C) 2011 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver-printing/share/x2gofeature.d/x2goserver-printing.features b/x2goserver-printing/share/x2gofeature.d/x2goserver-printing.features index eb64533..bbe195c 100755 --- a/x2goserver-printing/share/x2gofeature.d/x2goserver-printing.features +++ b/x2goserver-printing/share/x2gofeature.d/x2goserver-printing.features @@ -20,7 +20,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver-pyhoca/share/x2gofeature.d/x2goserver-pyhoca.features b/x2goserver-pyhoca/share/x2gofeature.d/x2goserver-pyhoca.features index 2411c0e..8c3e4b5 100755 --- a/x2goserver-pyhoca/share/x2gofeature.d/x2goserver-pyhoca.features +++ b/x2goserver-pyhoca/share/x2gofeature.d/x2goserver-pyhoca.features @@ -20,7 +20,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver-xsession/etc/Xsession b/x2goserver-xsession/etc/Xsession index c241b41..9fd5104 100755 --- a/x2goserver-xsession/etc/Xsession +++ b/x2goserver-xsession/etc/Xsession @@ -8,6 +8,8 @@ set -e +X2GO_LIBEXEC_PATH="$(x2gopath libexec)"; + PROGNAME=XSession-x2go message () { @@ -110,7 +112,7 @@ if [ -n "$SESSIONFILES" ]; then set +e for SESSIONFILE in $SESSIONFILES; do - /usr/lib/x2go/x2gosyslog "$0" "info" "executing $SESSIONFILE" + "$X2GO_LIBEXEC_PATH/x2gosyslog" "$0" "info" "executing $SESSIONFILE" . $SESSIONFILE done set -e diff --git a/x2goserver-xsession/share/x2gofeature.d/x2goserver-xsession.features b/x2goserver-xsession/share/x2gofeature.d/x2goserver-xsession.features index cc20f85..f4eb3dc 100755 --- a/x2goserver-xsession/share/x2gofeature.d/x2goserver-xsession.features +++ b/x2goserver-xsession/share/x2gofeature.d/x2goserver-xsession.features @@ -20,7 +20,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2gobasepath b/x2goserver/bin/x2gobasepath index 35f18bd..f6d8abc 100755 --- a/x2goserver/bin/x2gobasepath +++ b/x2goserver/bin/x2gobasepath @@ -1,30 +1,3 @@ -#!/usr/bin/perl +#!/bin/sh -# Copyright (C) 2007-2012 X2Go Project - http://wiki.x2go.org -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Copyright (C) 2007-2012 Mike Gabriel <mike.gabr...@das-netzwerkteam.de> - -use strict; -use Cwd; -use Cwd q{abs_path}; -use File::Basename; - -my $dir = dirname($0); -my $base_path = abs_path("$dir/.."); - -print "$base_path"; +exec x2gopath base "$@"; diff --git a/x2goserver/bin/x2gocmdexitmessage b/x2goserver/bin/x2gocmdexitmessage index a17bb9f..1e6b022 100755 --- a/x2goserver/bin/x2gocmdexitmessage +++ b/x2goserver/bin/x2gocmdexitmessage @@ -20,7 +20,7 @@ # Copyright (C) 2007-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2007-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; X2GO_ROOT=${HOME}/.x2go MESSAGE_FILE=$X2GO_ROOT/C-$1/cmdoutput diff --git a/x2goserver/bin/x2gofeature b/x2goserver/bin/x2gofeature index f379070..c2c851b 100755 --- a/x2goserver/bin/x2gofeature +++ b/x2goserver/bin/x2gofeature @@ -22,8 +22,8 @@ [ -z $1 ] && { echo usage: "$(basename $0) <X2GO_FEATURE_NAME>"; exit -2; } -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` -X2GO_SHARE_PATH=`echo -n \$(x2gobasepath)/share/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; +X2GO_SHARE_PATH="$(x2gopath share)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2gofeaturelist b/x2goserver/bin/x2gofeaturelist index 1258a77..44b3bfc 100755 --- a/x2goserver/bin/x2gofeaturelist +++ b/x2goserver/bin/x2gofeaturelist @@ -19,8 +19,8 @@ # # Copyright (C) 2011-2012 Mike Gabriel <mike.gabr...@das-netzwerkteam.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` -X2GO_SHARE_PATH=`echo -n \$(x2gobasepath)/share/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; +X2GO_SHARE_PATH="$(x2gopath share)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2gopath b/x2goserver/bin/x2gopath new file mode 100755 index 0000000..6d43616 --- /dev/null +++ b/x2goserver/bin/x2gopath @@ -0,0 +1,19 @@ +#!/bin/sh + +base="${0%/*}"; +if test "$base" = "$0"; then + base="."; +fi; +base=$(readlink -f "$base/.."); +# The following section is subject to substitution by distro packaging tools. +case "$1" in +base) echo -n "$base";; +lib) echo -n "$base/lib/x2go";; +libexec) echo -n "$base/lib/x2go";; +share) echo -n "$base/share/x2go";; +xinerama) echo -n "/usr/lib/nx/X11/Xinerama";; +*) exit 1;; +esac; +if test -t 1; then + echo ""; +fi; diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session index cddbf05..f4b5624 100755 --- a/x2goserver/bin/x2goresume-session +++ b/x2goserver/bin/x2goresume-session @@ -28,7 +28,7 @@ X2GO_KBD_LAYOUT="$5" X2GO_KBD_TYPE="$6" X2GO_SET_KBD="$7" -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; X2GO_AGENT_PID=`$X2GO_LIB_PATH/x2gogetagent "$SESSION_NAME"` X2GO_ROOT="${HOME}/.x2go" diff --git a/x2goserver/bin/x2goruncommand b/x2goserver/bin/x2goruncommand index 27bb3b5..d8d24da 100755 --- a/x2goserver/bin/x2goruncommand +++ b/x2goserver/bin/x2goruncommand @@ -27,7 +27,7 @@ cmd=$5 sndsys=$6 X2GO_SESS_TYPE=$7 -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2gosetkeyboard b/x2goserver/bin/x2gosetkeyboard index 949af5e..cb99b40 100755 --- a/x2goserver/bin/x2gosetkeyboard +++ b/x2goserver/bin/x2gosetkeyboard @@ -21,7 +21,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent index 5499d15..fae66ab 100755 --- a/x2goserver/bin/x2gostartagent +++ b/x2goserver/bin/x2gostartagent @@ -20,7 +20,7 @@ # Copyright (C) 2007-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2007-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2gosuspend-session b/x2goserver/bin/x2gosuspend-session index f823c69..645c352 100755 --- a/x2goserver/bin/x2gosuspend-session +++ b/x2goserver/bin/x2gosuspend-session @@ -26,7 +26,7 @@ else SESSION_NAME="$X2GO_SESSION" fi -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2goterminate-session b/x2goserver/bin/x2goterminate-session index a661dfc..9819498 100755 --- a/x2goserver/bin/x2goterminate-session +++ b/x2goserver/bin/x2goterminate-session @@ -26,7 +26,7 @@ else SESSION_NAME="$X2GO_SESSION" fi -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/bin/x2goversion b/x2goserver/bin/x2goversion index a1fea45..eee00db 100755 --- a/x2goserver/bin/x2goversion +++ b/x2goserver/bin/x2goversion @@ -20,7 +20,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" diff --git a/x2goserver/man/man8/x2gopath.8 b/x2goserver/man/man8/x2gopath.8 new file mode 100644 index 0000000..a8d1cbb --- /dev/null +++ b/x2goserver/man/man8/x2gopath.8 @@ -0,0 +1,28 @@ +.TH x2gopath 8 "Feb 2012" "Version 3.1.0.x" "X2Go Server Tool" +.SH Name +.PP +x2gopath - Show X2Go Server installation paths +.SH Synopsis +.PP +\fBx2gopath\fP {\fBbase\fP|\fBlib\fP|\fBlibexec\fP|\fBshare\fP} +.SH Description +.PP +\fBx2gopath\fP displays the paths of the selected X2Go installation directory. +.TP +\fBbase\fP +The prefix under which X2Go was installed. This is generally \fB/usr\fP or +\fB/usr/local\fP. +.TP +\fBlib\fP +The location of X2Go architecture-dependent parts (e.g. libraries, +but also Perl modules). +.\" Possible examplares are /usr/lib64/x2go (traditional biarch) and +.\" /usr/lib/x86_64-gnu-linux/x2go (Debian-style multiarch) +.TP +\fBlibexec\fP +The location of private X2Go binaries. +.\" Possible examples are /usr/libexec/x2go and /usr/lib/x2go. +.TP +\fBshare\fP +The location of X2Go's data files. +.\" prefix + /share/x2go diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index 3eb8722..b160dc4 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -24,7 +24,7 @@ use strict; use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); -my $x2go_lib_path=`echo -n \$(x2gobasepath)/lib/x2go`; +my $x2go_lib_path = `x2gopath libexec`; use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); diff --git a/x2goserver/sbin/x2golistsessions_root b/x2goserver/sbin/x2golistsessions_root index c065777..0699d2d 100755 --- a/x2goserver/sbin/x2golistsessions_root +++ b/x2goserver/sbin/x2golistsessions_root @@ -41,7 +41,7 @@ sub check_stat return 1; } -my $x2go_lib_path=`echo -n \$(x2gobasepath)/lib/x2go`; +my $x2go_lib_path = `x2gopath libexec`; my $uname; diff --git a/x2goserver/share/x2gofeature.d/x2goserver.features b/x2goserver/share/x2gofeature.d/x2goserver.features index db4aaf2..1d23695 100755 --- a/x2goserver/share/x2gofeature.d/x2goserver.features +++ b/x2goserver/share/x2gofeature.d/x2goserver.features @@ -20,7 +20,7 @@ # Copyright (C) 2011-2012 Oleksandr Shneyder <oleksandr.shney...@obviously-nice.de> # Copyright (C) 2011-2012 Heinz-Markus Graesing <heinz-m.graes...@obviously-nice.de> -X2GO_LIB_PATH=`echo -n \$(x2gobasepath)/lib/x2go` +X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" -- 1.7.10.4 _______________________________________________ X2Go-Dev mailing list X2Go-Dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/x2go-dev