Sequencer new option to open sequence config file when initialised using initSeqConfig
Sequences with exit in step_config, changed to return to support opening config file on first run
This commit is contained in:
@@ -27,7 +27,7 @@ step_config() {
|
|||||||
CONFIG=1
|
CONFIG=1
|
||||||
else
|
else
|
||||||
# End if no configuration file exists
|
# End if no configuration file exists
|
||||||
[ $DRY -eq 0 ] && exit 1
|
[ $DRY -eq 0 ] && return 1
|
||||||
fi
|
fi
|
||||||
[ $QUIET -ne 0 ] && aptOpt="-y"
|
[ $QUIET -ne 0 ] && aptOpt="-y"
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ step_1() {
|
|||||||
toolDownUrl="$1"
|
toolDownUrl="$1"
|
||||||
else
|
else
|
||||||
echoerr " [E] No image file provided for download"
|
echoerr " [E] No image file provided for download"
|
||||||
exit -1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
toolDownFile="/tmp/${toolDownUrl//*\//}"
|
toolDownFile="/tmp/${toolDownUrl//*\//}"
|
||||||
@@ -129,7 +129,7 @@ step_10_alias() { ALIAS="setup"; }
|
|||||||
step_10() {
|
step_10() {
|
||||||
if [ -z "$(ls /etc/default | grep raspi)" ] ; then
|
if [ -z "$(ls /etc/default | grep raspi)" ] ; then
|
||||||
echoerr " [E] Not on a Raspberry pi"
|
echoerr " [E] Not on a Raspberry pi"
|
||||||
return -1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exe apt update
|
exe apt update
|
||||||
@@ -143,7 +143,7 @@ step_11() {
|
|||||||
local localUsDefault="$localUs UTF-8"
|
local localUsDefault="$localUs UTF-8"
|
||||||
if [ ! -f "$localesConfigLoc" ] ; then
|
if [ ! -f "$localesConfigLoc" ] ; then
|
||||||
echoerr " [E] Install packages locales first"
|
echoerr " [E] Install packages locales first"
|
||||||
exit -1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exe sed -i "s/#[[:space:]]*\($localUsDefault\)/\1/" "$localesConfigLoc"
|
exe sed -i "s/#[[:space:]]*\($localUsDefault\)/\1/" "$localesConfigLoc"
|
||||||
|
@@ -20,7 +20,7 @@ step_config() {
|
|||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
CONFIG=1
|
CONFIG=1
|
||||||
else
|
else
|
||||||
exit 1
|
[ $DRY -eq 0 ] && return 1
|
||||||
fi
|
fi
|
||||||
toolSyslogTag="${SCRIPT_NAME}-$SEQ_PROFILE_NAME"
|
toolSyslogTag="${SCRIPT_NAME}-$SEQ_PROFILE_NAME"
|
||||||
}
|
}
|
||||||
@@ -56,14 +56,14 @@ step_1() {
|
|||||||
|
|
||||||
if [ -z $EBU_TARGET ] || [ -z $EBU_SOURCE ] ; then
|
if [ -z $EBU_TARGET ] || [ -z $EBU_SOURCE ] ; then
|
||||||
echo " [I] Nothing to do. Check $SEQ_CONFIG_FILE"
|
echo " [I] Nothing to do. Check $SEQ_CONFIG_FILE"
|
||||||
return -1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$1" ] && ( [ "$1" == "full" ] || [ "$1" == "incremental" ] ) ; then
|
if [ ! -z "$1" ] && ( [ "$1" == "full" ] || [ "$1" == "incremental" ] ) ; then
|
||||||
dupArgs+=("$1")
|
dupArgs+=("$1")
|
||||||
elif [ ! -z "$1" ] ; then
|
elif [ ! -z "$1" ] ; then
|
||||||
echo " [W] $toolName command \"$1\" not recognized"
|
echo " [W] $toolName command \"$1\" not recognized"
|
||||||
return -1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " [I] Running backup profile [$SEQ_PROFILE_NAME]"
|
echo " [I] Running backup profile [$SEQ_PROFILE_NAME]"
|
||||||
@@ -95,7 +95,7 @@ step_3() {
|
|||||||
|
|
||||||
if [ -z $EBU_TARGET ] || [ -z $EBU_SOURCE ] ; then
|
if [ -z $EBU_TARGET ] || [ -z $EBU_SOURCE ] ; then
|
||||||
echo " [I] Nothing to do. Check $SEQ_CONFIG_FILE"
|
echo " [I] Nothing to do. Check $SEQ_CONFIG_FILE"
|
||||||
return -1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
checkInstalled
|
checkInstalled
|
||||||
@@ -135,7 +135,7 @@ step_5() {
|
|||||||
|
|
||||||
if [ -z "$1" ] ; then
|
if [ -z "$1" ] ; then
|
||||||
echoerr " [E] No target provided"
|
echoerr " [E] No target provided"
|
||||||
return -1
|
return 1
|
||||||
fi
|
fi
|
||||||
local ebuLocalTarget="$1"
|
local ebuLocalTarget="$1"
|
||||||
local ebuTarget="$EBU_TARGET"
|
local ebuTarget="$EBU_TARGET"
|
||||||
@@ -167,7 +167,7 @@ step_7() {
|
|||||||
dupCommand+="remove-all-inc-of-but-n-full $EBU_MAX_FULLS_WITH_INCRS "
|
dupCommand+="remove-all-inc-of-but-n-full $EBU_MAX_FULLS_WITH_INCRS "
|
||||||
else
|
else
|
||||||
if [ $QUIET -eq 0 ] ; then echoerr " [W] No purge option configured" ; fi
|
if [ $QUIET -eq 0 ] ; then echoerr " [W] No purge option configured" ; fi
|
||||||
return -1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
checkInstalled
|
checkInstalled
|
||||||
@@ -264,12 +264,6 @@ step_72() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
step_74_info() { echo "Open configuration file"; }
|
|
||||||
step_74_alias() { ALIAS='config'; }
|
|
||||||
step_74() {
|
|
||||||
exe vi "$SEQ_CONFIG_FILE"
|
|
||||||
}
|
|
||||||
|
|
||||||
step_100_info() { echo "Install $toolName $toolPpa"; }
|
step_100_info() { echo "Install $toolName $toolPpa"; }
|
||||||
step_100_alias() { ALIAS="install"; }
|
step_100_alias() { ALIAS="install"; }
|
||||||
step_100() {
|
step_100() {
|
||||||
@@ -296,7 +290,7 @@ checkFileHead() {
|
|||||||
local readChar
|
local readChar
|
||||||
if [ ! -e "$1" ] ; then
|
if [ ! -e "$1" ] ; then
|
||||||
echoerr " [E] File $1 not found"
|
echoerr " [E] File $1 not found"
|
||||||
return -1
|
return 1
|
||||||
fi
|
fi
|
||||||
read -r -n ${#2} readChar < "$1"
|
read -r -n ${#2} readChar < "$1"
|
||||||
if [ "$readChar" == "$2" ] ; then
|
if [ "$readChar" == "$2" ] ; then
|
||||||
|
@@ -142,7 +142,7 @@ done"
|
|||||||
|
|
||||||
step_11_info() { echo "Create systemd service for logging to syslog"; }
|
step_11_info() { echo "Create systemd service for logging to syslog"; }
|
||||||
step_11() {
|
step_11() {
|
||||||
[ ! -f "$kodiSyslogLoc" ] && return -1
|
[ ! -f "$kodiSyslogLoc" ] && return 1
|
||||||
|
|
||||||
addConf -s "$kodiSyslogService" "$kodiSyslogServiceLoc"
|
addConf -s "$kodiSyslogService" "$kodiSyslogServiceLoc"
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ step_config() {
|
|||||||
echoseq " Install: $LNMS_DIR"
|
echoseq " Install: $LNMS_DIR"
|
||||||
echoseq " Backup: $LNMS_BU_DIR"
|
echoseq " Backup: $LNMS_BU_DIR"
|
||||||
else
|
else
|
||||||
[ $DRY -eq 0 ] && exit 1
|
[ $DRY -eq 0 ] && return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ step_config() {
|
|||||||
echo " Domain: $MAS_DOMAIN"
|
echo " Domain: $MAS_DOMAIN"
|
||||||
elif [ $? -eq 1 ] ; then
|
elif [ $? -eq 1 ] ; then
|
||||||
# Config $CONFIG_FILE_NAME created. Needs modification first
|
# Config $CONFIG_FILE_NAME created. Needs modification first
|
||||||
exit 1
|
[ $DRY -eq 0 ] && return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -542,8 +542,8 @@ toolScript() {
|
|||||||
adminTokenCheck() {
|
adminTokenCheck() {
|
||||||
if [ -z "$MATRIX_ACCESS" ] ; then
|
if [ -z "$MATRIX_ACCESS" ] ; then
|
||||||
[ $QUIET -eq 0 ] && read -s -p "Please enter admin access tocken: " MATRIX_ACCESS
|
[ $QUIET -eq 0 ] && read -s -p "Please enter admin access tocken: " MATRIX_ACCESS
|
||||||
# return -1 if it is still empty
|
# return 1 if it is still empty
|
||||||
[ -z "$MATRIX_ACCESS" ] && return -1
|
[ -z "$MATRIX_ACCESS" ] && return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ step_config() {
|
|||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
CONFIG=1
|
CONFIG=1
|
||||||
else
|
else
|
||||||
exit 1
|
[ $DRY -eq 0 ] && return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ step_config() {
|
|||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
CONFIG=1
|
CONFIG=1
|
||||||
else
|
else
|
||||||
exit 1
|
[ $DRY -eq 0 ] && return 1
|
||||||
fi
|
fi
|
||||||
toolConfigLoc=`eval echo "$TWXA_CONFIG_LOC"`
|
toolConfigLoc=`eval echo "$TWXA_CONFIG_LOC"`
|
||||||
toolConfig="$toolConfigLoc/config_cache/$toolConfigName"
|
toolConfig="$toolConfigLoc/config_cache/$toolConfigName"
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
## Version information
|
## Version information
|
||||||
|
|
||||||
VERSION_REV=12
|
VERSION_REV=12
|
||||||
VERSION_MAJOR=1
|
VERSION_MAJOR=2
|
||||||
VERSION_MINOR=0
|
VERSION_MINOR=0
|
||||||
|
|
||||||
## Start of generic script part
|
## Start of generic script part
|
||||||
@@ -24,6 +24,7 @@ STEP_RETURN=255
|
|||||||
MAX_STEP=512
|
MAX_STEP=512
|
||||||
ALIAS=
|
ALIAS=
|
||||||
CONTEXT_HELP=0
|
CONTEXT_HELP=0
|
||||||
|
SEQ_CONFIG_EDIT=0
|
||||||
SEQ_CONFIG_NAME=".seqs"
|
SEQ_CONFIG_NAME=".seqs"
|
||||||
SEQ_CONFIG_HOME="$HOME/$SEQ_CONFIG_NAME"
|
SEQ_CONFIG_HOME="$HOME/$SEQ_CONFIG_NAME"
|
||||||
SEQ_CONFIG_FILE=
|
SEQ_CONFIG_FILE=
|
||||||
@@ -56,6 +57,7 @@ helpSequencer() {
|
|||||||
Usage: ${0##*/} [OPTIONS] [STEP NUMBER(s) or ALIAS] [STEP ARGUMENTS]
|
Usage: ${0##*/} [OPTIONS] [STEP NUMBER(s) or ALIAS] [STEP ARGUMENTS]
|
||||||
|
|
||||||
[OPTIONS]
|
[OPTIONS]
|
||||||
|
--config, -c : Open sequence configuration file (also sets -qq)
|
||||||
--dry-run, -d : Only print to console what would be done
|
--dry-run, -d : Only print to console what would be done
|
||||||
! Attention - Sequence must support this
|
! Attention - Sequence must support this
|
||||||
--help, -h : Display help
|
--help, -h : Display help
|
||||||
@@ -449,8 +451,8 @@ initSeqConfig() {
|
|||||||
|
|
||||||
# Create config subdir in users home
|
# Create config subdir in users home
|
||||||
if [ ! -e "$configDir/" ] ; then
|
if [ ! -e "$configDir/" ] ; then
|
||||||
echo -n " [I] Creating $(realpath $configDir)..."
|
echoseq -n " [I] Creating $(realpath $configDir)..."
|
||||||
exe mkdir -p "$configDir" && echo "Ok" || echo "Nok"
|
exe mkdir -p "$configDir" && echoseq "Ok" || echoseq "Nok"
|
||||||
exe chmod 700 "$configDir"
|
exe chmod 700 "$configDir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -483,8 +485,11 @@ initSeqConfig() {
|
|||||||
exe chmod 600 "$configLoc"
|
exe chmod 600 "$configLoc"
|
||||||
|
|
||||||
if [ $sourceAlways -eq 0 ] ; then
|
if [ $sourceAlways -eq 0 ] ; then
|
||||||
|
if [ $SEQ_CONFIG_EDIT -eq 0 ] ; then
|
||||||
echoerr " [W] Seq configuration created from template but not used"
|
echoerr " [W] Seq configuration created from template but not used"
|
||||||
echoerr " Please modify "$configLoc" first and restart sequence"
|
echoerr " Please modify "$configLoc" first and restart sequence"
|
||||||
|
fi
|
||||||
|
SEQ_CONFIG_FILE="$configLoc"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
echo " [W] Using seq configuration from template $configTemplate"
|
echo " [W] Using seq configuration from template $configTemplate"
|
||||||
@@ -821,7 +826,7 @@ step_config() {
|
|||||||
# CONFIG=1
|
# CONFIG=1
|
||||||
#else
|
#else
|
||||||
# # End if no configuration file exists
|
# # End if no configuration file exists
|
||||||
# [ \$DRY -eq 0 ] && exit 1
|
# [ \$DRY -eq 0 ] && return -1
|
||||||
#fi
|
#fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1003,6 +1008,11 @@ main() {
|
|||||||
# options check
|
# options check
|
||||||
for arg in "$@" ; do
|
for arg in "$@" ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--config|-c) # open sequence configuration file
|
||||||
|
QUIET=2
|
||||||
|
SEQ_CONFIG_EDIT=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--dry-run|-d) # shows what would be done
|
--dry-run|-d) # shows what would be done
|
||||||
DRY=1
|
DRY=1
|
||||||
SEQUENCER_ARGS+=" $1"
|
SEQUENCER_ARGS+=" $1"
|
||||||
@@ -1091,10 +1101,17 @@ main() {
|
|||||||
# run configuration for seq only if available and if first step is valid
|
# run configuration for seq only if available and if first step is valid
|
||||||
existsFunction step_config
|
existsFunction step_config
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ $SEQ_CONFIG_EDIT -ne 0 ] ; then
|
||||||
|
step_config "${STEP_ARGS[@]}"
|
||||||
|
[ -w "$SEQ_CONFIG_FILE" ] && vi "$SEQ_CONFIG_FILE" \
|
||||||
|
|| echoerr " [E] No configuration file available"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
checkStep "${START[0]}"
|
checkStep "${START[0]}"
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
if [ $QUIET -ne 2 ] ; then echo " [I] Configuring sequence (step_config) ..." ; fi
|
if [ $QUIET -ne 2 ] ; then echo " [I] Configuring sequence (step_config) ..." ; fi
|
||||||
step_config "${STEP_ARGS[@]}"
|
step_config "${STEP_ARGS[@]}"
|
||||||
|
[ $? -ne 0 ] && exit 1
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user