Use available configuration file if exists in the same directory as the template
This commit is contained in:
@@ -101,10 +101,10 @@ helpApi() {
|
|||||||
echo " [OPTION]"
|
echo " [OPTION]"
|
||||||
echo " -t : Source config also if created from template"
|
echo " -t : Source config also if created from template"
|
||||||
echo " Returns"
|
echo " Returns"
|
||||||
echo " 0 : Sourced configuration or"
|
echo " 0 : sourced configuration or"
|
||||||
echo " (-t) : Created and sourced configuration from template"
|
echo " (-t) : created and sourced configuration from template"
|
||||||
echo " 1 : Created configuration from template but not sourced"
|
echo " 1 : created configuration from template but not sourced"
|
||||||
echo " 2 : or created empty configuration"
|
echo " 2 : created empty configuration"
|
||||||
echo
|
echo
|
||||||
echo " addConf <OPTIONS> [SOURCE TYPE] <SOURCE> <DESTINATION FILE>"
|
echo " addConf <OPTIONS> [SOURCE TYPE] <SOURCE> <DESTINATION FILE>"
|
||||||
echo " Trying to write or append text or a file (<SOURCE>) to a destination file."
|
echo " Trying to write or append text or a file (<SOURCE>) to a destination file."
|
||||||
@@ -279,9 +279,9 @@ endReturn() {
|
|||||||
# -t : Source config also if created from template
|
# -t : Source config also if created from template
|
||||||
# Return
|
# Return
|
||||||
# 0 : Sourced configuration or
|
# 0 : Sourced configuration or
|
||||||
# (-t) : Created and sourced configuration from template
|
# (-t) : created and sourced configuration from template
|
||||||
# 1 : Created configuration from template but not sourced
|
# 1 : Created configuration from template but not sourced
|
||||||
# 2 : or created empty configuration
|
# 2 : Created empty configuration
|
||||||
initSeqConfig() {
|
initSeqConfig() {
|
||||||
local sourceAlways=0
|
local sourceAlways=0
|
||||||
for arg in "$@" ; do
|
for arg in "$@" ; do
|
||||||
@@ -311,6 +311,19 @@ initSeqConfig() {
|
|||||||
|
|
||||||
# Config does not exist, check for template
|
# Config does not exist, check for template
|
||||||
if [ -s "$configTemplate" ] ; then
|
if [ -s "$configTemplate" ] ; then
|
||||||
|
|
||||||
|
# Check first if there is an existing configuration at the templates position
|
||||||
|
local configExists="$(dirname $configTemplate)/$1"
|
||||||
|
if [ -s "$configExists" ] ; then
|
||||||
|
exe mv "$configExists" "$configLoc"
|
||||||
|
endReturn -o $? "Unable to use existing configuration: $configExists"
|
||||||
|
|
||||||
|
echoerr " [I] Using existing configuration: $configExists"
|
||||||
|
echoerr " (Moved to $SEQ_CONFIG_HOME)"
|
||||||
|
. "$configLoc"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
exe cp -ar "$configTemplate" "$configLoc"
|
exe cp -ar "$configTemplate" "$configLoc"
|
||||||
endReturn -o $? "Failed to create configuration"
|
endReturn -o $? "Failed to create configuration"
|
||||||
|
|
||||||
@@ -320,6 +333,7 @@ initSeqConfig() {
|
|||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
echo " [W] Using seq configuration from template $configTemplate"
|
echo " [W] Using seq configuration from template $configTemplate"
|
||||||
|
echo " (Copied to $SEQ_CONFIG_HOME)"
|
||||||
SEQ_CONFIG_FILE="$configLoc"
|
SEQ_CONFIG_FILE="$configLoc"
|
||||||
. "$configLoc"
|
. "$configLoc"
|
||||||
return 0
|
return 0
|
||||||
@@ -724,6 +738,7 @@ displayHelp() {
|
|||||||
echo " - step_${i}_info() missing"
|
echo " - step_${i}_info() missing"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user