# HG changeset patch # User Sascha Wilde # Date 1410967223 -7200 # Node ID 45de97d43e133d9e233375c34cdb1e448ad569f7 # Parent cf154e1f687a903de85748873e3814fe35adbf40 Implemented generic include mechanism. diff -r cf154e1f687a -r 45de97d43e13 packaging/linux-createpackage.sh.in --- a/packaging/linux-createpackage.sh.in Wed Sep 17 15:06:03 2014 +0200 +++ b/packaging/linux-createpackage.sh.in Wed Sep 17 17:20:23 2014 +0200 @@ -6,6 +6,26 @@ # and comes with ABSOLUTELY NO WARRANTY! # See LICENSE.txt for details. +process_includes() +{ + # Process include statements of the form: + # ###INCLUDE:filename + # in the file given as $1 + # the path given as $2, it is used as base path for the included files. + + local file="$1" + local include_base="$2" + + local inc_directive + while [ "${inc_directive:=`grep '^###INCLUDE:' "$file" | head -1`}" ] ; do + local include_file="${inc_directive#'###INCLUDE:'}" + sed -i "/${inc_directive}/r ${include_base}/${include_file}" "$file" + sed -i "/${inc_directive}/d" "$file" + inc_directive="" + done +} + + TMPDIR=$(mktemp -d) TMPSHAR=$(mktemp "@CMAKE_BINARY_DIR@/shar.XXXXXXXXXX") @@ -35,8 +55,6 @@ HELPFILES_SOURCES=$(find @CMAKE_BINARY_DIR@/manuals/help-manual/html/_sources \ -maxdepth 1 -type f -printf "%p \n") -L10N_DE_FILE="@CMAKE_BINARY_DIR@/packaging/linux-installer.l10n-de" - # Make installation in TMPDIR, this is what we will put into the # shar-archive. echo "Using $TMPDIR for temporary installation to build installer..." @@ -51,6 +69,8 @@ echo "Building $INSTALLER..." cp "@CMAKE_BINARY_DIR@/packaging/linux-installer.inc" "$INSTALLER" +process_includes "$INSTALLER" "@CMAKE_BINARY_DIR@/packaging" + binnames="" for file in "${EXEFILES[@]}" ; do binnames="`basename $file` $binnames" @@ -79,7 +99,6 @@ sed -i "s/###BINNAMES###/${binnames}/" "$INSTALLER" sed -i "s/###ICONNAME###/trustbridge.png/" "$INSTALLER" sed -i "/###SHAR###/r $TMPSHAR" "$INSTALLER" -sed -i "/###L10N_DE###/r $L10N_DE_FILE" "$INSTALLER" sed -i "s/###HELPNAMES###/${helpnames}/" "$INSTALLER" sed -i "s/###HELPNAMES_SOURCES###/${helpnames_sources}/" "$INSTALLER" sed -i "s/###HELPNAMES_STATIC###/${helpnames_static}/" "$INSTALLER"