-#!/bin/bash
+#!@BASH@
+# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
####################################################
## Functions
## 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
done
fi
+# bootstrap
conffile="@CFGDIR@/backupninja.conf"
if [ ! -r "$conffile" ]; then
echo "Configuration file $conffile not found."
exit 1
fi
-scriptdir=`grep scriptdirectory $conffile | awk '{print $3}'`
-if [ ! -n "$scriptdir" ]; then
- echo "Cound not find entry 'scriptdirectory' in $conffile"
- exit 1
-fi
-if [ ! -d "$scriptdir" ]; then
- echo "Script directory $scriptdir not found."
- exit 1
-fi
-libdir=`grep libdirectory $conffile | awk '{print $3}'`
-if [ ! -n "$libdir" ]; then
- echo "Cound not find entry 'libdirectory' in $conffile"
- exit 1
-fi
-if [ ! -d "$libdir" ]; then
- echo "Script directory $libdir not found."
- exit 1
-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
+
+# find $libdirectory
+libdirectory=`grep '^libdirectory' $conffile | awk '{print $3}'`
+if [ -z "$libdirectory" ]; then
+ if [ -d "@libdir@" ]; then
+ libdirectory="@libdir@"
+ else
+ echo "Could not find entry 'libdirectory' in $conffile."
+ exit 1
+ fi
+else
+ if [ ! -d "$libdirectory" ]; then
+ echo "Lib directory $libdirectory not found."
+ exit 1
+ fi
fi
-. $libdir/easydialog.sh
+# 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