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.
13 local tempfile=`mktemp /tmp/$1.XXXXXXXX`
17 #####################################################
18 ## CONFIG-FILE RELATED FUNCTIONS
24 function setsection() {
29 # sets a global var with name equal to $1
30 # to the value of the configuration parameter $1
35 ret=`@AWK@ -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE`
36 # if nothing is returned, set the default
37 if [ "$ret" == "" -a "$2" != "" ]; then
41 # replace * with %, so that it is not globbed.
42 ret="${ret//\\*/__star__}"
44 # this is weird, but single quotes are needed to
45 # allow for returned values with spaces. $ret is still expanded
46 # because it is in an 'eval' statement.