From 4d1f5644771c3ec4c84d50e67b57da4cb7b401cd Mon Sep 17 00:00:00 2001 From: micah Date: Fri, 16 Dec 2005 16:15:13 +0000 Subject: [PATCH 01/16] Fixed broken toint function, causes backups to not run from cron when told to run "everyday" (debian bug: #341881) git-svn-id: http://code.autistici.org/svn/backupninja/trunk@258 758a04ac-41e6-0310-8a23-8373a73cc35d --- src/backupninja.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backupninja.in b/src/backupninja.in index 68c7c43..249a748 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -148,7 +148,7 @@ function tolower() { # simple to integer function function toint() { - echo "$1" | tr [:alpha:] -d + echo "$1" | tr -d [:alpha:] } # -- 2.30.2 From 5cef77c06590f851b5ae5db026a22ded4ef6621f Mon Sep 17 00:00:00 2001 From: micah Date: Fri, 23 Dec 2005 14:41:43 +0000 Subject: [PATCH 02/16] Changed configure.in to list the 0.9.2 release and change the contact email to the mailing list git-svn-id: http://code.autistici.org/svn/backupninja/trunk@259 758a04ac-41e6-0310-8a23-8373a73cc35d --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 9f0ee60..4839d56 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([backupninja],[0.9.0],[micah@riseup.net]) +AC_INIT([backupninja],[0.9.1],[backupninja@lists.riseup.net]) AC_CONFIG_SRCDIR([src/backupninja.in]) #AC_CONFIG_HEADERS([config.sh]) AM_INIT_AUTOMAKE -- 2.30.2 From 73eacf595f28194382fd24970b27e52acb193d68 Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:25:46 +0000 Subject: [PATCH 03/16] r192@um: micah | 2005-12-24 21:03:03 -0500 Changed configure.in revision number for next release git-svn-id: http://code.autistici.org/svn/backupninja/trunk@261 758a04ac-41e6-0310-8a23-8373a73cc35d --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 4839d56..6f2a11e 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([backupninja],[0.9.1],[backupninja@lists.riseup.net]) +AC_INIT([backupninja],[0.9.2],[backupninja@lists.riseup.net]) AC_CONFIG_SRCDIR([src/backupninja.in]) #AC_CONFIG_HEADERS([config.sh]) AM_INIT_AUTOMAKE -- 2.30.2 From a1eeaa5061132ac145c9f9131ad0c4192397bd09 Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:26:02 +0000 Subject: [PATCH 04/16] r193@um: micah | 2005-12-24 21:05:47 -0500 Added trac patch to fix subdir mkdir problem git-svn-id: http://code.autistici.org/svn/backupninja/trunk@262 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/trac | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/handlers/trac b/handlers/trac index d344082..1c1b464 100644 --- a/handlers/trac +++ b/handlers/trac @@ -14,14 +14,15 @@ for repo in `find . -name VERSION` do repo=`dirname $repo` - # Just make the $tmp dir, not $tmp/$repo - ret=`mkdir -p $tmp 2>&1` + # Just make the parent directory for $tmp/$repo + parentdir=`dirname $tmp/$repo` + ret=`mkdir -p $parentdir 2>&1` code=$? if [ "$ret" ]; then debug "$ret" fi if [ $code != 0 ]; then - error "command failed mkdir -p $tmp" + error "command failed mkdir -p $parentdir" fi ret=`trac-admin $src/$repo hotcopy $tmp/$repo 2>&1` -- 2.30.2 From b97fb07517ccb52b42cf4acd6851ca05c88c5f8c Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:27:07 +0000 Subject: [PATCH 05/16] r194@um: micah | 2005-12-24 21:17:55 -0500 Added missing changelog entries including trac handler toint() function, backupninja.conf.5 additions of "when" and "vservers", and trac handler subdir mkdir fix git-svn-id: http://code.autistici.org/svn/backupninja/trunk@263 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8abc200..b8d9b3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ version 0.9.2 -- unreleased + trac handler mkdir subdirectory problem fixed + fixed broken toint() causing backups not to run when set to "everyday" + update backupninja.conf.5 man page to include "when" and "vservers" fixed missing makecd.helper in Makefile.am/.in rdiff ninjahelper bugfixes: used to expand '*' in default source directories -- 2.30.2 From 58051cffcbab378389c3cda804330a841a210e95 Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:30:26 +0000 Subject: [PATCH 06/16] r195@um: micah | 2005-12-24 21:24:43 -0500 Added trac handler patch author to AUTHORS and added RPM support to Petr's entry git-svn-id: http://code.autistici.org/svn/backupninja/trunk@264 758a04ac-41e6-0310-8a23-8373a73cc35d --- AUTHORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index bbcbb0e..bcc2801 100644 --- a/AUTHORS +++ b/AUTHORS @@ -7,9 +7,10 @@ micah@riseup.net -- debian package, vserver support, bug fixes stefani@riseup.net -- makecd handler, man pages intrigeri@boum.org -- dup handler, pgsql handler, vserver support, bug fixes Charles Lepple -- trac handler -Petr Klíma -- autotools support +Petr Klíma -- autotools and RPM support Patches: cmccallum@thecsl.org Daniel.Bonniot@inria.fr +Brad Fritz -- trac patch -- 2.30.2 From d11d0f5b306ab65e0df21f462e9169e047a79d8a Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:31:36 +0000 Subject: [PATCH 07/16] r196@um: micah | 2005-12-24 21:46:52 -0500 Minor README cleanups git-svn-id: http://code.autistici.org/svn/backupninja/trunk@265 758a04ac-41e6-0310-8a23-8373a73cc35d --- README | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README b/README index 849fe3a..33ca1fd 100644 --- a/README +++ b/README @@ -218,13 +218,15 @@ VSERVERS ======== If you are using Linux-Vservers (http://linux-vserver.org/) there are some -special capabilities that different handlers have to make vserver backups easier. +special capabilities that different handlers have to make vserver +backups easier. + Set the variable "vservers" to be "yes" in /etc/backupninja.conf and see the example configuration files for each handler to configure the vserver specific variables. -Additional vserver variables that can be configured in /etc/backupninja.conf. but -probably don't need to be changed: +Additional vserver variables that can be configured in /etc/backupninja.conf, +but they probably don't need to be changed: VSERVERINFO (default: /usr/sbin/vserver-info) VSERVER (default: /usr/sbin/vserver) -- 2.30.2 From 402220b467a6dc48e68812ac91c49d175a0764fc Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:31:51 +0000 Subject: [PATCH 08/16] r197@um: micah | 2005-12-24 22:06:47 -0500 Added ninjahelper man page... git-svn-id: http://code.autistici.org/svn/backupninja/trunk@266 758a04ac-41e6-0310-8a23-8373a73cc35d --- man/ninjahelper.1 | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 man/ninjahelper.1 diff --git a/man/ninjahelper.1 b/man/ninjahelper.1 new file mode 100644 index 0000000..fdc10b7 --- /dev/null +++ b/man/ninjahelper.1 @@ -0,0 +1,62 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH NINJAHELPER 1 "December 24, 2005" "riseup" "backupninja package" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +NINJAHELPER \- A menu driven curses-based interface to walk you through +backupninja configuration. +.br +.SH SYNOPSIS +.B "ninjahelper" +.br +.SH DESCRIPTION +.B Ninjahelper +is an helper script to walk you through configuration of the backup +tasks for backupninja. It is a curses based "wizard" with an intuitive +menu-driven interface. +.PP +.SH ADDING NEW HELPERS +.br +To add an additional 'wizard' to ninjahelper, follow these steps: +.IP (1) +create a file in the handlers directory (eg. /usr/share/backupninja) using +the .helper extention. For example, if you wish to create a helper for the +handler "blue", create the file /usr/share/backupninja/blue.helper. +.IP (2) +next, add your helper to the global HELPERS variable and define the main +function for your helper (the function name is always _wizard). To +use the blue.helper as an example: +HELPERS="$HELPERS blue:description_of_this_helper" + blue_wizard() { + ... do work here ... + } +.IP (3) +look at the existing helpers to see how they are written. Try to re-use +functions, such as the dialog functions that are defined in easydialog.sh, +or the vserver functions defined in lib/vserver +.IP (4) +test, re-test, and test again. Try to break the helper by going backwards, +try to think like someone who has no idea how to configure your handler +would think, try to make your helper as simple as possible. Walk like a cat, +become your shadow, don't let your senses betray you. + +.SH SEE ALSO +.BR backupninja (1), +.BR backupninja.conf (5), +.BR backup.d (5), +.br +.SH AUTHOR +BACKUPNINJA was written by the riseup.net collective. -- 2.30.2 From 5399d469bfa492d75aa57795ed6610b2c5fadf02 Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:32:05 +0000 Subject: [PATCH 09/16] r198@um: micah | 2005-12-24 22:15:35 -0500 Added changelog entry about duplicity globbing support fix git-svn-id: http://code.autistici.org/svn/backupninja/trunk@267 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index b8d9b3b..ec17ef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ version 0.9.2 -- unreleased + fixed duplicity globbing support in include and exclude options trac handler mkdir subdirectory problem fixed fixed broken toint() causing backups not to run when set to "everyday" update backupninja.conf.5 man page to include "when" and "vservers" -- 2.30.2 From 7854b3159e456add8ff526965cf92fb4b031d21c Mon Sep 17 00:00:00 2001 From: micah Date: Sun, 25 Dec 2005 03:32:37 +0000 Subject: [PATCH 10/16] r199@um: micah | 2005-12-24 22:20:17 -0500 Add entry to changelog for ninjahelper.1 addition git-svn-id: http://code.autistici.org/svn/backupninja/trunk@268 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index ec17ef1..860a0a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ version 0.9.2 -- unreleased added duplicity ninjahelper, including: a nice menu to choose the Vservers to backup (thanks to lib/vserver) + added man/ninjahelper.1 man page version 0.9.1 -- November 05 2005 rearranged source so that it is relocatable with autotools -- 2.30.2 From d1632bb0f5d12c734344d5f90221d75200f17dd0 Mon Sep 17 00:00:00 2001 From: micah Date: Tue, 27 Dec 2005 17:04:33 +0000 Subject: [PATCH 11/16] r208@um: micah | 2005-12-26 22:43:36 -0500 Fixed mysql check to see if vserver is running git-svn-id: http://code.autistici.org/svn/backupninja/trunk@269 758a04ac-41e6-0310-8a23-8373a73cc35d --- ChangeLog | 1 + handlers/mysql | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 860a0a2..d8b57c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ version 0.9.2 -- unreleased + fixed mysql check to see if vserver is running fixed duplicity globbing support in include and exclude options trac handler mkdir subdirectory problem fixed fixed broken toint() causing backups not to run when set to "everyday" diff --git a/handlers/mysql b/handlers/mysql index 8d59fa4..55bfb25 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -56,8 +56,11 @@ then vroot="$VROOTDIR/$vsname" [ -d $vroot ] || fatal "vserver '$vsname' does not exist at '$vroot'" # is it running ? - running=`$VSERVERINFO $vsname RUNNING` - [ "$running" = "1" ] || fatal "vserver $vsname is not running." + $VSERVERINFO $vsname RUNNING + if [ $? -ne 0 ] + then + fatal "vserver $vsname is not running." + fi fi # create backup dirs, the vroot variable will be empty if no vsname was specified -- 2.30.2 From 4321291593cdc8eccb1db7804f8f53f571e8bd93 Mon Sep 17 00:00:00 2001 From: micah Date: Tue, 27 Dec 2005 17:35:25 +0000 Subject: [PATCH 12/16] r209@um: micah | 2005-12-27 08:26:31 -0500 Fixed some formatting that caused some ugly wrapping git-svn-id: http://code.autistici.org/svn/backupninja/trunk@270 758a04ac-41e6-0310-8a23-8373a73cc35d --- examples/example.mysql | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/example.mysql b/examples/example.mysql index 51c2247..25750ad 100644 --- a/examples/example.mysql +++ b/examples/example.mysql @@ -54,8 +54,8 @@ compress = yes # space separated list of database names. # # backupdir = < path/to/destination > (default = /var/backups/mysql) -# where to dump the backups. hotcopy backups will be in a subdirectory 'hotcopy' and -# sqldump backups will be in a subdirectory 'sqldump' +# where to dump the backups. hotcopy backups will be in a subdirectory +# 'hotcopy' and sqldump backups will be in a subdirectory 'sqldump' # # hotcopy = < yes | no > (default = no) # make a backup of the actual database binary files using mysqlhotcopy. @@ -68,8 +68,9 @@ compress = yes # if yes, compress the sqldump output. # # vsname = (no default) -# 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 +# 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 # -# NB: databases = all doesn't seem to work with hotcopy = yes when vsname is specified -# I would like to know how to fix this. +# NB: databases = all doesn't seem to work with hotcopy = yes +# when vsname is specified, I would like to know how to fix this. -- 2.30.2 From 0912bf6000029865500f0fe5428d846520ae8a4d Mon Sep 17 00:00:00 2001 From: micah Date: Tue, 27 Dec 2005 17:35:42 +0000 Subject: [PATCH 13/16] r210@um: micah | 2005-12-27 08:38:07 -0500 Added -q to vserver-info test in mysql handler to quiet the test to see if it is running git-svn-id: http://code.autistici.org/svn/backupninja/trunk@271 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/mysql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/mysql b/handlers/mysql index 55bfb25..cd2d491 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -51,12 +51,12 @@ fi # If needed, make sure that the specified vserver exists and is running. if [ $usevserver ] then - info "examining vserver '$vsname'" + info "Examining vserver '$vsname'" # does it exist ? vroot="$VROOTDIR/$vsname" [ -d $vroot ] || fatal "vserver '$vsname' does not exist at '$vroot'" # is it running ? - $VSERVERINFO $vsname RUNNING + $VSERVERINFO -q $vsname RUNNING if [ $? -ne 0 ] then fatal "vserver $vsname is not running." -- 2.30.2 From 036db2ee35b7d9afa4d3a06bd2c80382b7d1443b Mon Sep 17 00:00:00 2001 From: micah Date: Tue, 27 Dec 2005 17:35:54 +0000 Subject: [PATCH 14/16] r211@um: micah | 2005-12-27 09:09:54 -0500 Added some vserver handling to determine correct home directory, also enhanced error handling git-svn-id: http://code.autistici.org/svn/backupninja/trunk@272 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/mysql | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/handlers/mysql b/handlers/mysql index cd2d491..965b05e 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -63,7 +63,7 @@ then fi fi -# create backup dirs, the vroot variable will be empty if no vsname was specified +# create backup dirs, vroot variable will be empty if no vsname was specified # and will proceed to operate on the host [ -d $vroot$backupdir ] || mkdir -p $vroot$backupdir [ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir'" @@ -97,19 +97,25 @@ fi # specify the password on the command line. defaultsfile="" -if [ "$dbusername" != "" -a "$dbpassword" != "" ]; then - home=`getent passwd "root" | awk -F: '{print $6}'` - [ -d $home ] || fatal "Can't find root's home directory ($home)." - mycnf="$home/.my.cnf" - if [ -f $mycnf ]; then - # rename temporarily - tmpcnf="$home/my.cnf.disable" - debug "mv $mycnf $tmpcnf" - mv $mycnf $tmpcnf - fi - oldmask=`umask` - umask 077 - cat > $mycnf < $mycnf < Date: Tue, 27 Dec 2005 17:36:07 +0000 Subject: [PATCH 15/16] r212@um: micah | 2005-12-27 09:12:22 -0500 trivial code change git-svn-id: http://code.autistici.org/svn/backupninja/trunk@273 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/mysql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handlers/mysql b/handlers/mysql index 965b05e..b54ae95 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -107,7 +107,8 @@ then fi [ -d $home ] || fatal "Can't find root's home directory ($home)." mycnf="$home/.my.cnf" - if [ -f $mycnf ]; then + if [ -f $mycnf ] + then # rename temporarily tmpcnf="$home/my.cnf.disable" debug "mv $mycnf $tmpcnf" -- 2.30.2 From facd3fa17db38b76976f6a45cf7e00896d56b6fe Mon Sep 17 00:00:00 2001 From: micah Date: Tue, 27 Dec 2005 17:36:21 +0000 Subject: [PATCH 16/16] r213@um: micah | 2005-12-27 09:14:18 -0500 Move vserver initialization higher up in the chain git-svn-id: http://code.autistici.org/svn/backupninja/trunk@274 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/mysql | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/handlers/mysql b/handlers/mysql index b54ae95..49f80a8 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -17,22 +17,6 @@ getconf dbusername getconf dbpassword getconf configfile /etc/mysql/debian.cnf -if [ "$user" == "" ]; then - userset=false; - user=root; -else - userset=true; - userhome=`getent passwd "$user" | awk -F: '{print $6}'` - [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" -fi - -## Prepare ignore part of the command -## This only works for mysqldump at the moment - -ignore='' -for i in $ignores; do - ignore="$ignore --ignore-table=$i" -done # If vservers are configured, decide if the handler should # use them or if it should just operate on the host @@ -62,6 +46,23 @@ then fatal "vserver $vsname is not running." fi fi + +if [ "$user" == "" ]; then + userset=false; + user=root; +else + userset=true; + userhome=`getent passwd "$user" | awk -F: '{print $6}'` + [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" +fi + +## Prepare ignore part of the command +## This only works for mysqldump at the moment + +ignore='' +for i in $ignores; do + ignore="$ignore --ignore-table=$i" +done # create backup dirs, vroot variable will be empty if no vsname was specified # and will proceed to operate on the host -- 2.30.2