diff options
author | Micah Anderson <micah@riseup.net> | 2010-01-17 23:54:09 +1300 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2010-01-17 23:54:09 +1300 |
commit | fe3620c6529cc449cd152ed58667e39d4a80257e (patch) | |
tree | ec83be42237855979a31f38cdce51f45cdbd7312 /lib/tools.in | |
parent | 18f28c2cb00286cc0ff790ef6b6914f3f22ec4ac (diff) | |
parent | 46eccf2fd0c894790405b2e3aae8dfb99f5a5d98 (diff) | |
download | backupninja-fe3620c6529cc449cd152ed58667e39d4a80257e.tar.gz backupninja-fe3620c6529cc449cd152ed58667e39d4a80257e.tar.bz2 |
Merge branch 'master' into debian
Conflicts:
AUTHORS
ChangeLog
handlers/maildir.in
handlers/mysql.in
handlers/rsync.in
handlers/sys.helper.in
handlers/sys.in
src/backupninja.in
Diffstat (limited to 'lib/tools.in')
-rw-r--r-- | lib/tools.in | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/tools.in b/lib/tools.in index 0005be9..929826b 100644 --- a/lib/tools.in +++ b/lib/tools.in @@ -1,5 +1,6 @@ #!@BASH@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # This file contains functions shared between ninjahelper and backupninja. @@ -10,39 +11,39 @@ # create a temporary file in a secure way. # function maketemp() { - local tempfile=`mktemp /tmp/$1.XXXXXXXX` - echo $tempfile + local tempfile=`mktemp /tmp/$1.XXXXXXXX` + echo $tempfile } ##################################################### ## CONFIG-FILE RELATED FUNCTIONS function setfile() { - CURRENT_CONF_FILE=$1 + CURRENT_CONF_FILE=$1 } function setsection() { - CURRENT_SECTION=$1 + CURRENT_SECTION=$1 } # # sets a global var with name equal to $1 # to the value of the configuration parameter $1 # $2 is the default. -# +# function getconf() { - CURRENT_PARAM=$1 - ret=`@AWK@ -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE` - # if nothing is returned, set the default - if [ "$ret" == "" -a "$2" != "" ]; then - ret="$2" - fi - - # replace * with %, so that it is not globbed. - ret="${ret//\\*/__star__}" - - # this is weird, but single quotes are needed to - # allow for returned values with spaces. $ret is still expanded - # because it is in an 'eval' statement. - eval $1='$ret' + CURRENT_PARAM=$1 + ret=`@AWK@ -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE` + # if nothing is returned, set the default + if [ "$ret" == "" -a "$2" != "" ]; then + ret="$2" + fi + + # replace * with %, so that it is not globbed. + ret="${ret//\\*/__star__}" + + # this is weird, but single quotes are needed to + # allow for returned values with spaces. $ret is still expanded + # because it is in an 'eval' statement. + eval $1='$ret' } |