[X2Go-Commits] [x2goserver] 06/17: x2goserver/bin/x2gopath.in: hardcode LIBDIR, PREFIX and SHAREDIR at build time, but also allow re-rooting afterwards - derived from the original values.

git-admin at x2go.org git-admin at x2go.org
Sun Jun 23 04:43:05 CEST 2019


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

x2go pushed a commit to branch master
in repository x2goserver.

commit 980077116d2a7015bc1d89e4ed83c7758f16aaa6
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Jun 22 05:40:11 2019 +0200

    x2goserver/bin/x2gopath.in: hardcode LIBDIR, PREFIX and SHAREDIR at build time, but also allow re-rooting afterwards - derived from the original values.
---
 debian/changelog           |  3 +++
 x2goserver/bin/x2gopath.in | 34 ++++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index cda9111..890748b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -94,6 +94,9 @@ x2goserver (4.1.0.4-0x2go1.1) UNRELEASED; urgency=medium
       reasons.
     - x2goserver/bin/x2gopath.in: rework quoting, variable usage, drop
       unnecessary semicolons etc.
+    - x2goserver/bin/x2gopath.in: hardcode LIBDIR, PREFIX and SHAREDIR at
+      build time, but also allow re-rooting afterwards - derived from the
+      original values.
   * debian/control:
     + Build-depend upon lsb-release for distro version detection.
   * debian/x2goserver.manpages:
diff --git a/x2goserver/bin/x2gopath.in b/x2goserver/bin/x2gopath.in
index c8d3b8d..4b07f95 100755
--- a/x2goserver/bin/x2gopath.in
+++ b/x2goserver/bin/x2gopath.in
@@ -5,6 +5,7 @@
 # Copyright (C) 2012-2018 Heinz-Markus Graesing <heinz-m.graesing at obviously-nice.de>
 # Copyright (C) 2012-2015 Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
 # Copyright (C) 2012-2015 Jan Engelhard <jengelh at inai.de>
+# Copyright (C) 2019 Mihai Moldovan <ionic at ionic.de>
 #
 # 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
@@ -21,6 +22,10 @@
 # Free Software Foundation, Inc.,
 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
+typeset installed_prefix='@@PREFIX@@'
+typeset installed_libdir='@@LIBDIR@@'
+typeset installed_sharedir='@@SHAREDIR@@'
+
 typeset base="${BASH_SOURCE[0]%/*}"
 if test "${base}" = "${BASH_SOURCE[0]}"; then
 	base='.'
@@ -28,14 +33,31 @@ fi
 
 base="$(readlink -f "${base}/..")"
 
-# The following section is subject to substitution by distro packaging tools.
+if [ "${base}" != "${installed_prefix}" ]; then
+	printf 'WARNING: X2Go Server was originally installed into %s, but seems to have been re-rooted to %s. There is potential for breakage.\n' "${installed_prefix}" "${base}" >&2
+fi
+
+typeset x2go_share_subdir="${installed_sharedir#${installed_prefix}}"
+typeset x2go_lib_subdir="${installed_libdir#${installed_prefix}}"
+
+if [ "${x2go_lib_subdir}" = "${installed_libdir}" ]; then
+	printf 'WARNING: X2Go Server was built with a LIBDIR (%s) not starting with PREFIX (%s). Such a setup will likely not work correctly.\n' "${installed_libdir}" "${installed_prefix}" >&2
+fi
+
+# Try to fetch the system library dir.
+# Drop leading slashes.
+typeset lib_subdir="$(sed -e 's#^/*##g' <<< "${x2go_lib_subdir}")"
+# Extract first element - should be the library directory.
+lib_subdir="${lib_subdir%%/*}"
+
+# Distributions should not modify the following section, but rather build the package with their custom PREFIX, LIBDIR, SHAREDIR etc. values.
 case "${1}" in
 	('base') printf '%s' "${base}";;
-	('lib') printf '%s' "${base}/lib/x2go";;
-	('libexec') printf '%s' "${base}/lib/x2go";;
-	('share') printf '%s' "${base}/share/x2go";;
-	('nx-x11') printf '%s' "${base}/lib/nx/X11";;
-	('xinerama') printf '%s' "${base}/lib/nx/X11/Xinerama";;
+	('lib'|'libexec') printf '%s' "${base}/${x2go_lib_subdir}";;
+	('share') printf '%s' "${base}/${x2go_share_subdir}";;
+	# Assume that X2Go Server and nx-libs share the same library subdir.
+	('nx-x11') printf '%s' "${base}/${lib_subdir}/nx/X11";;
+	('xinerama') printf '%s' "${base}/${lib_subdir}/nx/X11/Xinerama";;
 	(*) exit 1;;
 esac;
 

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