Moved command line args after config file for overriding

This commit is contained in:
deajan 2015-04-24 22:31:39 +02:00
parent 4ee08d0814
commit ac20502b3e
2 changed files with 60 additions and 58 deletions

View File

@ -22,6 +22,7 @@ UNDER WORK
CHANGELOG CHANGELOG
--------- ---------
- Moved command line arguments after config file load for allowing command line overrides
- Added a config file option equivalent to --dontgetsize - Added a config file option equivalent to --dontgetsize
- Added basic install script from osync project - Added basic install script from osync project
- Added obackup-batch.sh from osync project to rerun failed backups in row - Added obackup-batch.sh from osync project to rerun failed backups in row

View File

@ -5,7 +5,7 @@
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
PROGRAM_VERSION=1.9pre PROGRAM_VERSION=1.9pre
PROGRAM_BUILD=2404201502 PROGRAM_BUILD=2404201503
## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode ## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode
if ! type -p "$BASH" > /dev/null if ! type -p "$BASH" > /dev/null
@ -1396,7 +1396,7 @@ function Main
if [ "$BACKUP_FILES" != "no" ] if [ "$BACKUP_FILES" != "no" ]
then then
ListDirectories ListDirectories
if [ "$dontgetsize" -ne 1 ] || [ "$DONT_GET_BACKUP_FILE_SIZE" == "no" ] if [ "$DISABLE_GET_BACKUP_FILE_SIZE" != "yes" ]
then then
GetDirectoriesSize GetDirectoriesSize
fi fi
@ -1406,10 +1406,7 @@ function Main
CreateLocalStorageDirectories CreateLocalStorageDirectories
fi fi
if [ "$dontgetsize" -ne 1 ] CheckSpaceRequirements
then
CheckSpaceRequirements
fi
# Actual backup process # Actual backup process
if [ "$BACKUP_SQL" != "no" ] if [ "$BACKUP_SQL" != "no" ]
@ -1462,60 +1459,63 @@ function Usage
exit 128 exit 128
} }
# Command line argument flags function GetCommandlineArguments
dryrun=0 {
silent=0 # Command line argument flags
no_maxtime=0 dryrun=0
if [ "$DEBUG" == "yes" ] silent=0
then no_maxtime=0
verbose=1 if [ "$DEBUG" == "yes" ]
else then
verbose=0
fi
dontgetsize=0
stats=0
PARTIAL=0
# Alert flags
soft_alert_total=0
error_alert=0
if [ $# -eq 0 ]
then
Usage
fi
for i in "$@"
do
case $i in
--dry)
dryrun=1
;;
--silent)
silent=1
;;
--verbose)
verbose=1 verbose=1
;; else
--stats) verbose=0
stats=1 fi
;; dontgetsize=0
--partial) stats=0
PARTIAL="yes" PARTIAL=0
;; # Alert flags
--no-maxtime) soft_alert_total=0
no_maxtime=1 error_alert=0
;;
--delete) if [ $# -eq 0 ]
DELETE_VANISHED_FILES="yes" then
;;
--dontgetsize)
dontgetsize=1
;;
--help|-h|--version|-v)
Usage Usage
;; fi
esac
done for i in "$@"
do
case $i in
--dry)
dryrun=1
;;
--silent)
silent=1
;;
--verbose)
verbose=1
;;
--stats)
stats=1
;;
--partial)
PARTIAL="yes"
;;
--no-maxtime)
no_maxtime=1
;;
--delete)
DELETE_VANISHED_FILES="yes"
;;
--dontgetsize)
DISABLE_GET_BACKUP_FILE_SIZE="yes"
;;
--help|-h|--version|-v)
Usage
;;
esac
done
}
CheckEnvironment CheckEnvironment
if [ $? == 0 ] if [ $? == 0 ]
@ -1536,6 +1536,7 @@ then
else else
LOG_FILE="$LOGFILE" LOG_FILE="$LOGFILE"
fi fi
GetCommandlineArguments "$@"
GetLocalOS GetLocalOS
InitLocalOSSettings InitLocalOSSettings