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 ]
then
CheckSpaceRequirements CheckSpaceRequirements
fi
# Actual backup process # Actual backup process
if [ "$BACKUP_SQL" != "no" ] if [ "$BACKUP_SQL" != "no" ]
@ -1462,30 +1459,32 @@ 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
if [ "$DEBUG" == "yes" ]
then
verbose=1 verbose=1
else else
verbose=0 verbose=0
fi fi
dontgetsize=0 dontgetsize=0
stats=0 stats=0
PARTIAL=0 PARTIAL=0
# Alert flags # Alert flags
soft_alert_total=0 soft_alert_total=0
error_alert=0 error_alert=0
if [ $# -eq 0 ] if [ $# -eq 0 ]
then then
Usage Usage
fi fi
for i in "$@" for i in "$@"
do do
case $i in case $i in
--dry) --dry)
dryrun=1 dryrun=1
@ -1509,13 +1508,14 @@ do
DELETE_VANISHED_FILES="yes" DELETE_VANISHED_FILES="yes"
;; ;;
--dontgetsize) --dontgetsize)
dontgetsize=1 DISABLE_GET_BACKUP_FILE_SIZE="yes"
;; ;;
--help|-h|--version|-v) --help|-h|--version|-v)
Usage Usage
;; ;;
esac esac
done 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