Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 11293-partition_table_backup
  • borg-custom-init-options
  • borg-sftp-support
  • borg-ssh-keygen
  • bugfix-borg-handler-create-options
  • debian
  • mariaback_full-intial
  • master
  • move-mail-deps
  • nap-initial
  • no_vservers
  • pristine-tar
  • stretch-backports
  • systemd_integration
  • tests
  • upstream
  • backupninja-0.3.4
  • backupninja-0.4.0
  • backupninja-0.4.1
  • backupninja-0.4.2
  • backupninja-0.4.4
  • backupninja-0.5
  • backupninja-0.7
  • backupninja-0.8
  • backupninja-0.9
  • backupninja-0.9.1
  • backupninja-0.9.10
  • backupninja-0.9.2
  • backupninja-0.9.3
  • backupninja-0.9.4
  • backupninja-0.9.5
  • backupninja-0.9.6
  • backupninja-0.9.7
  • backupninja-0.9.8
  • backupninja-0.9.8.1
  • backupninja-0.9.9
  • backupninja-1.0
  • backupninja-1.0-rc1
  • backupninja-1.0.1
  • backupninja-1.0.2
  • backupninja-1.1.0
  • backupninja_debian/0.9.10-1
  • backupninja_debian/0.9.10-2
  • backupninja_debian/0.9.9-1
  • backupninja_debian/1.0-1
  • backupninja_debian/1.0.1-1
  • backupninja_debian/1.0.1-2
  • backupninja_debian/1.0.2-1
  • backupninja_debian/1.0_rc1-1
  • backupninja_debian/1.1.0-1
  • backupninja_upstream/0.9.10
  • backupninja_upstream/1.0
  • backupninja_upstream/1.0.1
  • backupninja_upstream/1.0.2
  • backupninja_upstream/1.0_rc1
  • backupninja_upstream/1.1.0
56 results

Target

Select target project
No results found
Select Git revision
  • backupninja.conf.d
  • borg-custom-init-options
  • borg-sftp-support
  • borg-ssh-keygen
  • debian
  • expand_pruning_options
  • gitlab-ci
  • maethor-master-patch-46063
  • maethor-master-patch-70558
  • mariaback_full-intial
  • master
  • nap-initial
  • pristine-tar
  • stretch-backports
  • systemd_integration
  • upstream
  • when-override
  • backupninja-0.3.4
  • backupninja-0.4.0
  • backupninja-0.4.1
  • backupninja-0.4.2
  • backupninja-0.4.4
  • backupninja-0.5
  • backupninja-0.7
  • backupninja-0.8
  • backupninja-0.9
  • backupninja-0.9.1
  • backupninja-0.9.10
  • backupninja-0.9.2
  • backupninja-0.9.3
  • backupninja-0.9.4
  • backupninja-0.9.5
  • backupninja-0.9.6
  • backupninja-0.9.7
  • backupninja-0.9.8
  • backupninja-0.9.8.1
  • backupninja-0.9.9
  • backupninja-1.0
  • backupninja-1.0-rc1
  • backupninja-1.0.1
  • backupninja-1.0.2
  • backupninja-1.1.0
  • backupninja-1.2.0
  • backupninja-1.2.0-rc1
  • backupninja-1.2.1
  • backupninja-1.2.2
  • backupninja_debian/0.9.10-1
  • backupninja_debian/0.9.10-2
  • backupninja_debian/0.9.9-1
  • backupninja_debian/1.0-1
  • backupninja_debian/1.0.1-1
  • backupninja_debian/1.0.1-2
  • backupninja_debian/1.0.2-1
  • backupninja_debian/1.0_rc1-1
  • backupninja_debian/1.1.0-1
  • backupninja_debian/1.2.0-1
  • backupninja_debian/1.2.1-1
  • backupninja_debian/1.2.2-1
  • backupninja_upstream/0.9.10
  • backupninja_upstream/1.0
  • backupninja_upstream/1.0.1
  • backupninja_upstream/1.0.2
  • backupninja_upstream/1.0_rc1
  • backupninja_upstream/1.1.0
  • backupninja_upstream/1.2.0
  • backupninja_upstream/1.2.1
  • backupninja_upstream/1.2.2
67 results
Show changes

Commits on Source 1

29 files
+ 89
1026
Compare changes
  • Side-by-side
  • Inline

Files

+0 −1
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ lib/Makefile
lib/easydialog
lib/parseini
lib/tools
lib/vserver
man/Makefile
src/Makefile
src/backupninja
+1 −22
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ The key features of backupninja are:
 - console-based wizard (ninjahelper) makes it easy to create
   backup action configuration files
 - passwords are never sent via the command line to helper programs
 - works with [Linux-Vservers](http://linux-vserver.org/)

The following backup types are supported:

@@ -82,8 +81,7 @@ To add an additional 'wizard' to ninjahelper, follow these steps:
           }

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`.
   functions, such as the dialog functions that are defined in `easydialog.sh`.

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
@@ -215,25 +213,6 @@ Since it performs incremental backups it minimizes the number of request per
operation therefore reducing the costs. The boto Python interface to Amazon
Web Services is needed to use duplicity with S3 (Debian package: `python-boto`).


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.

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 they probably don't need to be changed:

 - `VSERVERINFO` (default: `/usr/sbin/vserver-info`)
 - `VSERVER` (default: `/usr/sbin/vserver`)
 - `VROOTDIR` (default: `$VSERVERINFO info SYSINFO |grep vserver-Rootdir | awk '{print $2}'`)

.sh configuration files
-----------------------

Original line number Diff line number Diff line
@@ -72,9 +72,6 @@ usecolors = yes
# default value for 'when'
when = everyday at 01:00

# if running vservers, set to yes
vservers = no

# programs paths
# SLAPCAT=/usr/sbin/slapcat
# LDAPSEARCH=/usr/bin/ldapsearch
@@ -89,6 +86,3 @@ vservers = no
# GZIP=/bin/gzip
# GZIP_OPTS='--rsyncable'
# RSYNC=/usr/bin/rsync
# VSERVERINFO=/usr/sbin/vserver-info
# VSERVER=/usr/sbin/vserver
# VROOTDIR=/var/lib/vservers
Original line number Diff line number Diff line
@@ -127,21 +127,6 @@ include = /usr/local/sbin
include = /var/lib/dpkg/status
include = /var/lib/dpkg/status-old

## If vservers = yes in /etc/backupninja.conf then the following variables can
## be used:
## vsnames = all | <vserver1> <vserver2> ... (default = all)
## vsinclude = <path>
## vsinclude = <path>
## ...
## Any path specified in vsinclude is added to the include list for each vserver
## listed in vsnames (or all if vsnames = all, which is the default).
##
## For example, vsinclude = /home will backup the /home directory in every
## vserver listed in vsnames. If you have 'vsnames = foo bar baz', this
## vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home
## and /vservers/baz/home.
## Vservers paths are derived from $VROOTDIR.

# files to exclude from the backup
exclude = /home/*/.gnupg
exclude = /var/cache/backupninja/duplicity
Original line number Diff line number Diff line
@@ -79,11 +79,3 @@ compress = yes
#
# compress = < yes | no > (default = yes)
# if yes, compress the sqldump output. 
#
# vsname = <vserver> (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
# 
# NB: databases = all doesn't seem to work with hotcopy = yes 
# when vsname is specified, I would like to know how to fix this.
Original line number Diff line number Diff line
### backupninja PostgreSQL config file ###

# vsname = <vserver> (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
# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.

# backupdir = <dir> (default: /var/backups/postgres)
# where to dump the backups

Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ type = local
# keep = 60

## A few notes about includes and excludes:
## 1. include, exclude and vsinclude statements support globbing with '*'
## 1. include and exclude statements support globbing with '*'
## 2. Symlinks are not dereferenced. Moreover, an include line whose path
##    contains, at any level, a symlink to a directory, will only have the
##    symlink backed-up, not the target directory's content. Yes, you have to
@@ -119,21 +119,6 @@ include = /usr/local/sbin
include = /var/lib/dpkg/status
include = /var/lib/dpkg/status-old

## If vservers = yes in /etc/backupninja.conf then the following variables can
## be used:
## vsnames = all | <vserver1> <vserver2> ... (default = all)
## vsinclude = <path>
## vsinclude = <path>
## ...
## Any path specified in vsinclude is added to the include list for each vserver
## listed in vsnames (or all if vsnames = all, which is the default).
##
## For example, vsinclude = /home will backup the /home directory in every
## vserver listed in vsnames. If you have 'vsnames = foo bar baz', this
## vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home
## and /vservers/baz/home.
## Vservers paths are derived from $VROOTDIR.

## files to exclude from the backup
exclude = /home/*/.gnupg
exclude = /var/cache/backupninja/duplicity
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@
# Mandatory options are uncommented with sugested values
# Other options are commented out with their default values
#
# Note: You dont need to manually specify vservers using "include = /vservers".
#       They're automatically backuped if vserver is set to "yes" on you backupninja.conf.

[general]

@@ -111,11 +109,6 @@ include = /var
exclude = exclude_folder1
exclude = exclude_folder2

# exlude some vserver from backup
# this is used only if vservers = yes on backupninja.conf
exclude_vserver = excluded_vserver1
exclude_vserver = excluded_vserver2

# ssh command line (remote only)
#ssh = ssh

Original line number Diff line number Diff line
@@ -21,6 +21,3 @@
## in /usr/share/doc/subversion/examples now if you wish to use
## it instead
# HOTBACKUP = /usr/lib/subversion/hot-backup.py

## the name of the vserver containing svn, if using vservers
# vsname =
Original line number Diff line number Diff line
@@ -79,7 +79,3 @@
# note: to backup your BIOS, you need the program 'flashrom' installed, and your
# mainboard needs to be supported, see http://flashrom.org/Supported_hardware#Supported_mainboards
# bios = no

# If vservers = yes in /etc/backupninja.conf then the following variables can
# be used:
# vsnames = all | <vserver1> <vserver2> ... (default = all)
Original line number Diff line number Diff line
@@ -30,35 +30,6 @@ do_dup_host_includes() {
   set +o noglob
}

do_dup_vserver() {
   # choose the vservers to backup (into $selected_vservers)
   choose_one_or_more_vservers "$dup_title"
   [ $? = 0 ] || return 1

   set -o noglob
   # choose the files to backup
   REPLY=
   while [ -z "$REPLY" ]; do
      formBegin "$dup_title - vservers: vsincludes (backup these directories from every selected vserver)"
         [ -z "$dup_vsincludes" ] && dup_vsincludes="$dup_default_includes"
         for i in $dup_vsincludes; do
            formItem include "$i"
         done
         formItem include ""
         formItem include ""
         formItem include ""
         formItem include ""
         formItem include ""
         formItem include ""
         formItem include ""
         formItem include ""
      formDisplay
      [ $? = 0 ] || return 1
      dup_vsincludes="$REPLY"
   done
   set +o noglob
}

do_dup_excludes() {
   set -o noglob
   formBegin "$dup_title: excludes"
@@ -80,35 +51,6 @@ do_dup_excludes() {
   set +o noglob
}

do_dup_src() {
   choose_host_or_vservers_or_both "$dup_title"
   [ $? = 0 ] || return 1
   case $host_or_vservers in
      'host')
         do_dup_host_includes
         [ $? = 0 ] || return 1
         ;;
      'vservers')
         do_dup_vserver
         [ $? = 0 ] || return 1
         ;;
      'both')
         do_dup_host_includes
         [ $? = 0 ] || return 1
         do_dup_vserver
         [ $? = 0 ] || return 1
         ;;
      *)
         return 1
         ;;
   esac
   do_dup_excludes
   [ $? = 0 ] || return 1

   _src_done="(DONE)"
   setDefault dest
}

do_dup_dest() {

   local replyconverted
@@ -362,7 +304,7 @@ signpassword = $dup_gpg_signpassword
[source]

# A few notes about includes and excludes:
# 1. include, exclude and vsinclude statements support globbing with '*'
# 1. include and exclude statements support globbing with '*'
# 2. Symlinks are not dereferenced. Moreover, an include line whose path
#    contains, at any level, a symlink to a directory, will only have the
#    symlink backed-up, not the target directory's content. Yes, you have to
@@ -380,43 +322,12 @@ signpassword = $dup_gpg_signpassword
# files to include in the backup
EOF

   if [ "$host_or_vservers" == host -o "$host_or_vservers" == both ]; then
   set -o noglob
   for i in $dup_includes; do
      echo "include = $i" >> $next_filename
   done
   set +o noglob
   fi

   cat >> $next_filename <<EOF

# If vservers = yes in /etc/backupninja.conf then the following variables can
# be used:
# vsnames = all | <vserver1> <vserver2> ... (default = all)
# vsinclude = <path>
# vsinclude = <path>
# ...
# Any path specified in vsinclude is added to the include list for each vserver
# listed in vsnames (or all if vsnames = all, which is the default).
#
# For example, vsinclude = /home will backup the /home directory in every
# vserver listed in vsnames. If you have 'vsnames = foo bar baz', this
# vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home
# and /vservers/baz/home.
# Vservers paths are derived from $VROOTDIR.

EOF

   if [ "$host_or_vservers" == vservers -o "$host_or_vservers" == both ]; then
      set -o noglob
      echo -e "vsnames = $selected_vservers\n" >> $next_filename
      for i in $dup_vsincludes; do
         echo "vsinclude = $i" >> $next_filename
      done
      set +o noglob
   fi

   # excludes
   cat >> $next_filename <<EOF

# files to exclude from the backup
@@ -601,7 +512,6 @@ dup_wizard() {
   _adv_done=
   dup_includes=
   dup_excludes=
   dup_vsincludes=
   dup_incremental=yes
   dup_increments=30
   dup_keep=60
+1 −36
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ getconf signkey

setsection source
getconf include
getconf vsnames all
getconf vsinclude
getconf exclude

setsection dest
@@ -48,7 +46,7 @@ destdir=${destdir%/}
### SANITY CHECKS ##############################################################

[ -n "$desturl" -o -n "$destdir" ]  || fatal "The destination directory (destdir) must be set when desturl is not used."
[ -n "$include" -o -n "$vsinclude" ]  || fatal "No source includes specified"
[ -n "$include" ]  || fatal "No source includes specified"
[ -n "$password" ] || fatal "The password option must be set."
if [ -n "$signkey" -a -n "$encryptkey" -a "$signkey" != "$encryptkey" ]; then
   [ -n "$signpassword" ] || fatal "The signpassword option must be set because signkey is different from encryptkey."
@@ -80,25 +78,6 @@ if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "file" ]; then
   fi
fi

### VServers
# If vservers are configured, check that the ones listed in $vsnames do exist.
usevserver=no
if [ $vservers_are_available = yes ]; then
   if [ "$vsnames" = all ]; then
      vsnames="$found_vservers"
   else
      if ! vservers_exist "$vsnames" ; then
            fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist."
      fi
   fi
   if [ -n "$vsinclude" ]; then
      info "Using vservers '$vsnames'"
      usevserver=yes
   fi
else
   [ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored'
fi

### See if we can login on $desthost
if [ "$testconnect" == "yes" ]; then
   if [ -n "$desturl" ]; then
@@ -259,20 +238,6 @@ for i in $include; do
done
IFS=$SAVEIFS

# vsincludes
if [ $usevserver = yes ]; then
   for vserver in $vsnames; do
      SAVEIFS=$IFS
      IFS=$(echo -en "\n\b")
      for vi in $vsinclude; do
         str="${vi//__star__/*}"
         str="$VROOTDIR/$vserver$str"
         execstr_source="${execstr_source} --include '$str'"
      done
      IFS=$SAVEIFS
   done
fi

set +o noglob

### EXECUTE ####################################################################
Original line number Diff line number Diff line
@@ -3,12 +3,6 @@

HELPERS="$HELPERS mysql:mysql_database_backup"

do_mysql_vserver() {
   choose_one_vserver "$mysql_title"
   [ $? = 0 ] || return 1
   mysql_vsname="vsname = $REPLY"
}

do_mysql_databases() {
   REPLY=
   while [ -z "$REPLY" ]; do
@@ -121,20 +115,6 @@ $mysql_databases

EOF

if [ $host_or_vservers == vservers ]
   then
      cat >> $next_filename <<EOF
#
# vsname = <vserver> (no default)
# vsname indicates which vserver to operate on, this is only used if
# vserver is set to yes in /etc/backupninja.conf
# NOTE: if you do not specify a vsname the host will be operated on
# alsoNOTE: if operating on a vserver, $VROOTDIR will be
# prepended to backupdir.
EOF
   echo -e "$mysql_vsname\n" >> $next_filename
fi

   echo -e $@ >> $next_filename

   chmod 600 $next_filename
@@ -145,22 +125,8 @@ mysql_wizard() {
   # Global variables
   mysql_title="MySQL action wizard"

   # backup the host system or a Vserver?
   choose_host_or_one_vserver "$mysql_title"
   [ $? = 0 ] || return 1
   if [ $host_or_vservers == vservers ]
   then
      do_mysql_vserver
      [ $? = 0 ] || return 1
   fi

   # backupdir
   if [ $host_or_vservers == vservers ]
   then
      inputBox "$mysql_title" "Directory where to store the backups:`echo \"\n(Relative to chosen vserver's root directory)\"`" "/var/backups/mysql"
   else
   inputBox "$mysql_title" "Directory where to store the backups" "/var/backups/mysql"
   fi
   [ $? = 1 ] && return
   mysql_backupdir="backupdir = $REPLY"