mirror of
https://github.com/Unimatrix0/update_ombi.git
synced 2025-08-19 04:50:44 -07:00
Add config argument
Add config to arguments using --config= or -c=, also qoutes can be used for paths with spaces. Add config path to log level debug.
This commit is contained in:
parent
2be16cb034
commit
0cd7bc2a5d
1 changed files with 17 additions and 2 deletions
|
@ -45,6 +45,7 @@ defaultport="5000"
|
||||||
## By default, none ##
|
## By default, none ##
|
||||||
|
|
||||||
declare -i verbosity=-1
|
declare -i verbosity=-1
|
||||||
|
configfile=''
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
## Do not modify anything below this line ##
|
## Do not modify anything below this line ##
|
||||||
|
@ -67,6 +68,16 @@ while [ $# -gt 0 ]; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--config|-c=*)
|
||||||
|
if [[ ${1#*=} =~ ^\"?.*\.conf\"?$ ]]; then
|
||||||
|
configfile="${1#*=}"
|
||||||
|
else
|
||||||
|
printf "******************************\n"
|
||||||
|
printf "* Error: Invalid config path.*\n"
|
||||||
|
printf "******************************\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "****************************\n"
|
printf "****************************\n"
|
||||||
printf "* Error: Invalid argument. *\n"
|
printf "* Error: Invalid argument. *\n"
|
||||||
|
@ -103,10 +114,14 @@ unzip-strip() (
|
||||||
)
|
)
|
||||||
|
|
||||||
# Import any custom config to override the defaults, if necessary
|
# Import any custom config to override the defaults, if necessary
|
||||||
configfile="$(dirname $0)/update_ombi.conf"
|
if [ -z "$configfile" ]; then
|
||||||
|
configfile="$(dirname $0)/update_ombi.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -e $configfile ]; then
|
if [ -e $configfile ]; then
|
||||||
source $configfile > /dev/null 2>&1
|
source $configfile > /dev/null 2>&1
|
||||||
.log 6 "Script config file found...parsing..."
|
.log 6 "Script config file found...parsing..."
|
||||||
|
.log 7 "Config path is: $configfile"
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
.log 3 "Unable to use config file...using defaults..."
|
.log 3 "Unable to use config file...using defaults..."
|
||||||
else
|
else
|
||||||
|
@ -334,4 +349,4 @@ elif [ $seconds -eq 1 ]; then
|
||||||
fi
|
fi
|
||||||
durationmsg="Update complete...elapsed time $duration..."
|
durationmsg="Update complete...elapsed time $duration..."
|
||||||
durationmsg="${durationmsg// / }"
|
durationmsg="${durationmsg// / }"
|
||||||
.log 6 "$durationmsg"
|
.log 6 "$durationmsg"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue