File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,12 +118,14 @@ P="$BASEDIR/buildscripts/packaging/$PKG"
118118if [ " $BUILDPREFIX " != /var/cfengine ]; then
119119 log_debug " Custom prefix detected: $BUILDPREFIX "
120120 safe_prefix=" $( echo " $BUILDPREFIX " | sed -e ' s:/::g' ) "
121- file_to_patch=$P /../common/script-templates/$PACKAGING -script-common.sh
122- if [ -f " $file_to_patch " ]; then
123- # Update installation scripts to use custom prefix
124- log_debug " Patching script template: $file_to_patch "
125- sed " s:/var/cfengine:$BUILDPREFIX :" " $file_to_patch " > " $file_to_patch " .new
126- mv " $file_to_patch " .new " $file_to_patch "
121+ source_script=$P /../common/script-templates/$PACKAGING -script-common.sh
122+ patched_script=$P /../common/script-templates/patched-$PACKAGING -script-common.sh
123+ if [ -f " $source_script " ]; then
124+ # Patch installation scripts for custom prefix, create patched-$PACKAGING-script-common.sh which is not version tracked
125+ log_debug " Patching from source: $source_script to patched script: $patched_script "
126+ sed " s:/var/cfengine:$BUILDPREFIX :" " $source_script " > " $patched_script "
127+ else
128+ log_error " Source $PACKAGING -script-common.sh not available at $source_script "
127129 fi
128130else
129131 log_debug " Using default prefix: /var/cfengine"
Original file line number Diff line number Diff line change 77# action = <install|remove>
88#
99# script-header.sh
10- # <type>-script-common.sh
10+ # patched-<type>-script-common.sh
11+ # note: patched- prefix files are not to be committed to the repository and are generated by build-scripts/package script
1112# <type>-script-common-<action>.sh
1213# script-common.sh
1314# script-common-<action>.sh
@@ -35,7 +36,7 @@ include_script()
3536}
3637
3738include_script " $TEMPLATEDIR /script-header.sh"
38- include_script " $TEMPLATEDIR /$PKG_TYPE -script-common.sh"
39+ include_script " $TEMPLATEDIR /patched- $PKG_TYPE -script-common.sh"
3940
4041case " $PKG_TYPE " in
4142 deb|rpm)
@@ -57,13 +58,13 @@ echo "LMDB_VERSION=$LMDB_VERSION"
5758
5859case " $SCRIPT_TYPE " in
5960 * install)
60- include_script " $TEMPLATEDIR /$PKG_TYPE -script-common-install.sh"
61+ include_script " $TEMPLATEDIR /patched- $PKG_TYPE -script-common-install.sh"
6162 include_script " $TEMPLATEDIR /script-common.sh"
6263 include_script " $TEMPLATEDIR /script-common-install.sh"
6364 include_script " $TEMPLATEDIR /script-common-$SCRIPT_TYPE .sh"
6465 ;;
6566 * remove)
66- include_script " $TEMPLATEDIR /$PKG_TYPE -script-common-remove.sh"
67+ include_script " $TEMPLATEDIR /patched- $PKG_TYPE -script-common-remove.sh"
6768 include_script " $TEMPLATEDIR /script-common.sh"
6869 include_script " $TEMPLATEDIR /script-common-remove.sh"
6970 include_script " $TEMPLATEDIR /script-common-$SCRIPT_TYPE .sh"
You can’t perform that action at this time.
0 commit comments