X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=src%2Fninjahelper.in;h=e191f60ce9528274ab4e84632519e68e7a3330f9;hb=cfc47e5571e61f4323b9f64f9cbb64dfbc4bf1b4;hp=451f38978e91b56a959d89491e1bcd199b9c199a;hpb=13893e6d255a0b3ff1ac2ffb74cff0652d2b61f4;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/src/ninjahelper.in b/src/ninjahelper.in index 451f389..e191f60 100755 --- a/src/ninjahelper.in +++ b/src/ninjahelper.in @@ -1,4 +1,5 @@ #!@BASH@ +# -*- mode: sh; sh-basic-offset: 8; indent-tabs-mode: nil; -*- #################################################### ## Functions @@ -58,6 +59,9 @@ require_packages() { ## menu for the wizards ## donew() { + # (re-)initialize vservers support + init_vservers + # menu listBegin "new action menu" "select an action to create" listItem return "return to main menu" for data in $HELPERS; do @@ -182,64 +186,48 @@ if [ ! -x "`which dialog`" ]; then done fi +# bootstrap conffile="@CFGDIR@/backupninja.conf" if [ ! -r "$conffile" ]; then echo "Configuration file $conffile not found." exit 1 fi -# find $scriptdir -scriptdir=`grep scriptdirectory $conffile | awk '{print $3}'` -if [ -z "$scriptdir" ]; then - if [ -d "@datadir@" ]; then - scriptdir="@datadir@" - else - echo "Could not find entry 'scriptdirectory' in $conffile" - exit 1 - fi -else - if [ ! -d "$scriptdir" ]; then - echo "Script directory $scriptdir not found." - exit 1 - fi -fi - -# find $libdir -libdir=`grep libdirectory $conffile | awk '{print $3}'` -if [ -z "$libdir" ]; then +# find $libdirectory +libdirectory=`grep '^libdirectory' $conffile | awk '{print $3}'` +if [ -z "$libdirectory" ]; then if [ -d "@libdir@" ]; then - libdir="@libdir@" + libdirectory="@libdir@" else echo "Could not find entry 'libdirectory' in $conffile." exit 1 fi else - if [ ! -d "$libdir" ]; then - echo "Lib directory $libdir not found." + if [ ! -d "$libdirectory" ]; then + echo "Lib directory $libdirectory not found." exit 1 fi fi -configdirectory=`grep configdirectory $conffile | awk '{print $3}'` -if [ ! -n "$configdirectory" ]; then - echo "Cound not find entry 'configdirectory' in $conffile" - exit 1 -fi -if [ ! -d "$configdirectory" ]; then - echo "Configuration directory $configdirectory not found." - exit 1 -fi - -. $libdir/easydialog +# include shared functions +. $libdirectory/easydialog +. $libdirectory/tools +. $libdirectory/vserver +# am I running as root? if [ "$UID" != "0" ]; then - msgBox "warning" "ninjahelper must be run by root!" + msgBox "warning" "`basename $0` must be run by root!" exit 1 fi +# get global config options (second param is the default) +setfile $conffile +getconf configdirectory @CFGDIR@/backup.d +getconf scriptdirectory @datadir@ + # load all the helpers HELPERS="" -for file in `find $scriptdir -follow -name '*.helper'`; do +for file in `find $scriptdirectory -follow -name '*.helper'`; do check_perms $file . $file done