[X2Go-Commits] [x2goserver] 03/03: x2goserver/Makefile: build up sed argument line as an array and use one substitution run.

git-admin at x2go.org git-admin at x2go.org
Mon Jun 24 08:56:53 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 ebeec2182dd0b7199cdd5104a77ac9e8a004fcb2
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Jun 24 08:56:17 2019 +0200

    x2goserver/Makefile: build up sed argument line as an array and use one substitution run.
    
    Multiple runs with the template file as input will lead to only the last
    replacement to stick in the resulting generated script, which is not
    what we want to have.
    
    Correctly doing that with multiple runs would require the usage of
    temporary files, which is needlessly complicated in this context.
---
 debian/changelog    | 6 ++++++
 x2goserver/Makefile | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 4ab2668..e38b80f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -124,6 +124,12 @@ x2goserver (4.1.0.4-0x2go1.1) UNRELEASED; urgency=medium
       in comment lines.
     - x2goserver/Makefile: export common variables for direct use in shell
       script sections.
+    - x2goserver/Makefile: build up sed argument line as an array and use one
+      substitution run. Multiple runs with the template file as input will
+      lead to only the last replacement to stick in the resulting generated
+      script, which is not what we want to have. Correctly doing that with
+      multiple runs would require the usage of temporary files, which is
+      needlessly complicated in this context.
   * debian/control:
     + Build-depend upon lsb-release for distro version detection.
   * debian/x2goserver.manpages:
diff --git a/x2goserver/Makefile b/x2goserver/Makefile
index 064a7e7..26781dd 100755
--- a/x2goserver/Makefile
+++ b/x2goserver/Makefile
@@ -49,9 +49,12 @@ build-indep: build_pod2man build_man2html
 				cp -a "$${gen_file}" "$${file}"; \
 				\
 				$$(: "Run actual substitutions."); \
+				typeset -a sed_args; \
+				sed_args=(); \
 				for subst in 'PREFIX' 'ETCDIR' 'BINDIR' 'SBINDIR' 'LIBDIR' 'NXLIBDIR' 'MANDIR' 'SHAREDIR'; do \
-					sed -e "s#@@$${subst}@@#$${!subst}#g" "$${gen_file}" > "$${file}"; \
+					sed_args+=( '-e' "s#@@$${subst}@@#$${!subst}#g" ); \
 				done; \
+				sed "$${sed_args[@]}" "$${gen_file}" > "$${file}"; \
 			fi; \
 		done; \
 	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