aboutsummaryrefslogtreecommitdiff
path: root/handlers
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2005-11-29 10:10:53 +0000
committerintrigeri <intrigeri@boum.org>2005-11-29 10:10:53 +0000
commitd56c0f0aeedc84560821bd3c57239476e12615ca (patch)
tree6d703020dbf3263c87d4a2f14223f47ea46a5975 /handlers
parent5b392f68baa6462fbb891a81ae05dcbbad91f91b (diff)
downloadbackupninja-d56c0f0aeedc84560821bd3c57239476e12615ca.tar.gz
backupninja-d56c0f0aeedc84560821bd3c57239476e12615ca.tar.bz2
r3566@krups: intrigeri | 2005-11-17 21:59:38 +0100
ninjahelper: moved (and enhanced) vservers-related functions to lib/vservers. dup.helper, pgsql.helper: use these functions
Diffstat (limited to 'handlers')
-rw-r--r--handlers/dup.helper14
-rw-r--r--handlers/pgsql.helper21
2 files changed, 21 insertions, 14 deletions
diff --git a/handlers/dup.helper b/handlers/dup.helper
index 102e063..7eca261 100644
--- a/handlers/dup.helper
+++ b/handlers/dup.helper
@@ -22,10 +22,9 @@ do_dup_host_includes() {
}
do_dup_vserver() {
- # choose the vservers to backup
- vservers_chooser "$dup_title"
+ # choose the vservers to backup (into $selected_vservers)
+ choose_one_or_more_vservers "$dup_title"
[ $? = 0 ] || return 1
- dup_vsnames="$vservers_chooser_vsnames"
set -o noglob
# choose the files to backup
@@ -61,7 +60,7 @@ do_dup_excludes() {
}
do_dup_src() {
- host_or_vservers_chooser "$dup_title"
+ choose_host_or_vservers_or_both "$dup_title"
[ $? = 0 ] || return 1
case $host_or_vservers in
'host')
@@ -259,7 +258,7 @@ encryptkey = $dup_gpg_encryptkey
# include = /mnt/crypt/home/user/Mail
EOF
- if [ "$host_or_vservers" == 'host' -o "$host_or_vservers" == 'both' ]; then
+ if [ "$host_or_vservers" == host -o "$host_or_vservers" == both ]; then
set -o noglob
for ((i=0; i < ${#dup_includes[@]} ; i++)); do
echo "include = ${dup_includes[$i]}" >> $next_filename
@@ -283,9 +282,9 @@ EOF
EOF
- if [ "$host_or_vservers" == 'vservers' -o "$host_or_vservers" == 'both' ]; then
+ if [ "$host_or_vservers" == vservers -o "$host_or_vservers" == both ]; then
set -o noglob
- echo "vsnames = \"$dup_vsnames\"\n" >> $next_filename
+ echo -e "vsnames = \"$selected_vservers\"\n" >> $next_filename
for ((i=0; i < ${#dup_vsincludes[@]} ; i++)); do
echo "vsinclude = ${dup_vsincludes[$i]}" >> $next_filename
done
@@ -408,7 +407,6 @@ dup_wizard() {
declare -a dup_includes
declare -a dup_excludes
declare -a dup_vsincludes
- dup_vsnames=
dup_incremental=yes
dup_keep=60
dup_bandwidth=
diff --git a/handlers/pgsql.helper b/handlers/pgsql.helper
index 8baa39f..1c8b4ef 100644
--- a/handlers/pgsql.helper
+++ b/handlers/pgsql.helper
@@ -1,8 +1,8 @@
HELPERS="$HELPERS pgsql:postgresql_database_backup"
do_pgsql_vserver() {
- inputBox "$pgsql_title" "Specify a vserver name:"
- [ $? = 1 ] && return;
+ choose_one_vserver "$pgsql_title"
+ [ $? = 0 ] || return 1
pgsql_vsname="vsname = $REPLY"
}
@@ -32,9 +32,13 @@ pgsql_wizard() {
# constants
pgsql_title="PostgreSQL action wizard"
- # vserver support
- booleanBox "$pgsql_title" "Do you want to operate on a vserver? If not, the host will be operated on."
- [ $? = 0 ] && do_pgsql_vserver
+ # backup the host system or a Vserver?
+ choose_host_or_one_vserver "$pgsql_title"
+ [ $? = 0 ] || return 1
+ if [ $host_or_vservers == vservers ]; then
+ do_pgsql_vserver
+ [ $? = 0 ] || return 1
+ fi
# backupdir
inputBox "$pgsql_title" "Directory where to store the backups:`[ -z \"$pgsql_vsname\" ] || echo \"\n(In respect to chosen vserver's root directory)\"`" "/var/backups/postgres"
@@ -47,6 +51,7 @@ pgsql_wizard() {
pgsql_databases="databases = all"
else
do_pgsql_databases
+ [ $? = 0 ] || return 1
fi
# compress
@@ -66,8 +71,12 @@ pgsql_wizard() {
# what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf
# if you do not specify a vsname the host will be operated on
# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.
-$pgsql_vsname
+EOF
+ if [ $host_or_vservers == vservers ]; then
+ echo -e "$pgsql_vsname\n" >> $next_filename
+ fi
+ cat >> $next_filename <<EOF
# backupdir = <dir> (default: /var/backups/postgres)
# where to dump the backups
$pgsql_backupdir