From 4f76bb4ad26b5788d70adc646d392271617f7fc2 Mon Sep 17 00:00:00 2001 From: deajan Date: Tue, 2 Oct 2018 10:49:28 +0200 Subject: [PATCH] Simpler merge process --- dev/merge.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/dev/merge.sh b/dev/merge.sh index 45c1343..ad69ead 100755 --- a/dev/merge.sh +++ b/dev/merge.sh @@ -5,6 +5,9 @@ ## Merges ofunctions.sh and n_program.sh into program.sh ## Adds installer +PROGRAM=merge +INSTANCE_ID=dev + function Usage { echo "Merges ofunctions.sh and n_program.sh into debug_program.sh and ../program.sh" echo "Usage" @@ -46,6 +49,7 @@ function __PREPROCESSOR_Constants { __PREPROCESSOR_SUBSETS=( '#### OFUNCTIONS FULL SUBSET ####' '#### OFUNCTIONS MINI SUBSET ####' + '#### OFUNCTIONS MICRO SUBSET ####' '#### PoorMansRandomGenerator SUBSET ####' '#### _OFUNCTIONS_BOOTSTRAP SUBSET ####' '#### DEBUG SUBSET ####' @@ -113,7 +117,7 @@ function __PREPROCESSOR_MergeSubset { function __PREPROCESSOR_CleanDebug { local source="${1}" - local destination="${2:-$PROGRAM.merge}" + local destination="${2:-$source}" sed '/'$PARANOIA_DEBUG_BEGIN'/,/'$PARANOIA_DEBUG_END'/d' "$source" | grep -v "$PARANOIA_DEBUG_LINE" > "$destination.tmp" if [ $? != 0 ]; then @@ -135,12 +139,15 @@ function __PREPROCESSOR_CleanDebug { Logger "Prepared [$source]." "SIMPLE" fi - chmod +x "$destination" - if [ $? != 0 ]; then - Logger "Cannot chmod [$destination]." "SIMPLE" - exit 1 - else - Logger "Prepared [$destination]." "SIMPLE" + if [ "$source" != "$destination" ]; then + + chmod +x "$destination" + if [ $? != 0 ]; then + Logger "Cannot chmod [$destination]." "SIMPLE" + exit 1 + else + Logger "Prepared [$destination]." "SIMPLE" + fi fi }