mirror of
https://github.com/deajan/osync
synced 2024-11-15 12:12:56 +00:00
Made bootstrap and merge program agnostic
This commit is contained in:
parent
e07cb136c4
commit
2038a2ecb9
@ -1,23 +1,45 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
## dev pre-processor bootstrap rev 2017061801
|
## dev pre-processor bootstrap rev 2017061901
|
||||||
## Yeah !!! A really tech sounding name... In fact it's just include emulation in bash
|
## Yeah !!! A really tech sounding name... In fact it's just include emulation in bash
|
||||||
|
|
||||||
|
function Usage {
|
||||||
|
echo "$0 - Quick and dirty preprocessor for including ofunctions into programs"
|
||||||
|
echo "Creates and executes $0.tmp.sh"
|
||||||
|
echo "Usage:"
|
||||||
|
echo ""
|
||||||
|
echo "$0 --program=osync|osync_target_helper|obackup|pmocr [options to pass to program]"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f "./merge.sh" ]; then
|
if [ ! -f "./merge.sh" ]; then
|
||||||
echo "Plrase run bootstrap.sh from osync/dev directory."
|
echo "Plrase run bootstrap.sh from osync/dev directory."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
bootstrapProgram=""
|
||||||
|
opts=""
|
||||||
outputFileName="$0"
|
outputFileName="$0"
|
||||||
if [ "$1" == "" ]; then
|
|
||||||
PRG=osync
|
for i in "$@"; do
|
||||||
else
|
case $i in
|
||||||
PRG="$1"
|
--program=*)
|
||||||
|
bootstrapProgram="${i##*=}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
opts=$opts" $i"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$bootstrapProgram" == "" ]; then
|
||||||
|
Usage
|
||||||
|
exit 128
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "merge.sh"
|
source "merge.sh"
|
||||||
|
|
||||||
__PREPROCESSOR_PROGRAM=$PRG
|
__PREPROCESSOR_PROGRAM=$bootstrapProgram
|
||||||
__PREPROCESSOR_Constants
|
__PREPROCESSOR_Constants
|
||||||
|
|
||||||
cp "n_$__PREPROCESSOR_PROGRAM.sh" "$outputFileName.tmp.sh"
|
cp "n_$__PREPROCESSOR_PROGRAM.sh" "$outputFileName.tmp.sh"
|
||||||
@ -39,4 +61,4 @@ if type termux-fix-shebang > /dev/null 2>&1; then
|
|||||||
termux-fix-shebang "$outputFileName.tmp.sh"
|
termux-fix-shebang "$outputFileName.tmp.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$outputFileName.tmp.sh" "$@"
|
"$outputFileName.tmp.sh" $opts
|
||||||
|
25
dev/merge.sh
25
dev/merge.sh
@ -1,10 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
## MERGE 2017061801
|
## MERGE 2017061901
|
||||||
|
|
||||||
## Merges ofunctions.sh and n_program.sh into program.sh
|
## Merges ofunctions.sh and n_program.sh into program.sh
|
||||||
## Adds installer
|
## Adds installer
|
||||||
|
|
||||||
|
function Usage {
|
||||||
|
echo "Merges ofunctions.sh and n_program.sh into debug_program.sh and ../program.sh"
|
||||||
|
echo "Usage"
|
||||||
|
echo "$0 osync|obackup|pmocr"
|
||||||
|
}
|
||||||
|
|
||||||
function __PREPROCESSOR_Merge {
|
function __PREPROCESSOR_Merge {
|
||||||
local PROGRAM="$1"
|
local PROGRAM="$1"
|
||||||
|
|
||||||
@ -175,8 +181,19 @@ function __PREPROCESSOR_CopyCommons {
|
|||||||
|
|
||||||
# If sourced don't do anything
|
# If sourced don't do anything
|
||||||
if [ "$(basename $0)" == "merge.sh" ]; then
|
if [ "$(basename $0)" == "merge.sh" ]; then
|
||||||
__PREPROCESSOR_Merge osync
|
if [ "$1" == "osync" ]; then
|
||||||
__PREPROCESSOR_Merge osync_target_helper
|
|
||||||
__PREPROCESSOR_CopyCommons osync
|
|
||||||
|
|
||||||
|
__PREPROCESSOR_Merge osync
|
||||||
|
__PREPROCESSOR_Merge osync_target_helper
|
||||||
|
__PREPROCESSOR_CopyCommons osync
|
||||||
|
elif [ "$1" == "obackup" ]; then
|
||||||
|
__PREPROCESSOR_Merge obackup
|
||||||
|
__PREPROCESSOR_CopyCommons obackup
|
||||||
|
elif [ "$1" == "pmocr" ]; then
|
||||||
|
__PREPROCESSOR_Merge pmocr
|
||||||
|
__PREPROCESSOR_CopyCommons pmocr
|
||||||
|
else
|
||||||
|
echo "No valid program given."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user