2 # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
4 # This file contains functions shared between ninjahelper and backupninja.
6 #####################################################
10 # create a temporary file in a secure way.
15 local tempfile=`mktemp /tmp/$1.XXXXXXXX`
18 sectmp=`echo $DATE | @MD5SUM@ | cut -d- -f1`
19 local tempfile=/tmp/$1.$sectmp
24 #####################################################
25 ## CONFIG-FILE RELATED FUNCTIONS
31 function setsection() {
36 # sets a global var with name equal to $1
37 # to the value of the configuration parameter $1
42 ret=`@AWK@ -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE`
43 # if nothing is returned, set the default
44 if [ "$ret" == "" -a "$2" != "" ]; then
48 # replace * with %, so that it is not globbed.
49 ret="${ret//\\*/__star__}"
51 # this is weird, but single quotes are needed to
52 # allow for returned values with spaces. $ret is still expanded
53 # because it is in an 'eval' statement.