3 # This file contains functions shared between ninjahelper and backupninja.
5 #####################################################
9 # create a temporary file in a secure way.
14 local tempfile=`mktemp /tmp/$1.XXXXXXXX`
17 sectmp=`echo $DATE | /usr/bin/md5sum | cut -d- -f1`
18 local tempfile=/tmp/$1.$sectmp
23 #####################################################
24 ## CONFIG-FILE RELATED FUNCTIONS
30 function setsection() {
35 # sets a global var with name equal to $1
36 # to the value of the configuration parameter $1
41 ret=`awk -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE`
42 # if nothing is returned, set the default
43 if [ "$ret" == "" -a "$2" != "" ]; then
47 # replace * with %, so that it is not globbed.
48 ret="${ret//\\*/__star__}"
50 # this is weird, but single quotes are needed to
51 # allow for returned values with spaces. $ret is still expanded
52 # because it is in an 'eval' statement.