Commit 13edaf09 authored by intrigeri's avatar intrigeri

Imported Upstream version 1.0~rc1

parent d5a65fc0
Makefile.in
aclocal.m4
autom4te.cache/
configure
etc/Makefile.in
examples/Makefile.in
handlers/Makefile.in
install-sh
lib/Makefile.in
man/Makefile.in
missing
src/Makefile.in
Makefile
backupninja.spec
config.log
config.status
etc/Makefile
etc/backupninja.conf
etc/cron.d/backupninja
etc/logrotate.d/backupninja
examples/Makefile
handlers/Makefile
handlers/dup
handlers/dup.helper
handlers/ldap
handlers/ldap.helper
handlers/maildir
handlers/makecd
handlers/makecd.helper
handlers/mysql
handlers/mysql.helper
handlers/pgsql
handlers/pgsql.helper
handlers/rdiff
handlers/rdiff.helper
handlers/rsync
handlers/sh
handlers/svn
handlers/sys
handlers/sys.helper
handlers/tar
handlers/tar.helper
handlers/trac
lib/Makefile
lib/easydialog
lib/parseini
lib/tools
lib/vserver
man/Makefile
src/Makefile
src/backupninja
src/ninjahelper
This diff is collapsed.
This diff is collapsed.
%define name backupninja
%define version 1.0-rc1
Summary: Backupninja backup tool
Name: %{name}
Version: %{version}
Release: 1
License: GPL
Group: Applications/System
URL: https://labs.riseup.net/code/projects/show/backupninja
Source: %{name}-%{version}.tar.gz
Requires: bash, gawk, rdiff-backup, gzip
Provides: %{name}
Packager: Petr Klima <Petr.Klima@madeta-group.cz>
BuildRoot: %{_tmppath}/%{name}-%{version}
Prefix: %{_prefix}
%description
Modular rdiff.backup tool
%prep
%setup -q
%build
%configure
make
%install
rm -rf ${buildroot}
%makeinstall
mkdir -p "%{buildroot}%{_sysconfdir}/backup.d"
mkdir -p "%{buildroot}%{_localstatedir}/backups"
mkdir -p "%{buildroot}%{_localstatedir}/log"
touch "%{buildroot}%{_localstatedir}/log/backupninja.log"
%clean
rm -fr %{buildroot}
%files
%defattr(-,root,root,-)
%{_sbindir}/*
%{_datadir}/backupninja/*
%{_libdir}/backupninja/*
%config %{_sysconfdir}/cron.d/backupninja
%config %{_sysconfdir}/logrotate.d/backupninja
%config(noreplace) %{_sysconfdir}/backupninja.conf
%dir %{_localstatedir}/backups
%ghost %{_localstatedir}/log/backupninja.log
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README
%{_mandir}/man1/*
%{_mandir}/man5/*
%defattr(0640,root,root,0750)
%dir %{_sysconfdir}/backup.d
%changelog
* Sun Oct 14 2007 Adam Monsen <haircut@gmail.com> 0.9.5-1
- use cleanup steps during %install and %clean
* Mon Apr 29 2002 Petr Klima <Petr.Klima@madeta-group.cz> 0.7.0
- first RPM release
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
##
## configuration file for openldap backups
##
## If the method is set to "slapcat", the LDIFs generated are
## suitable for use with slapadd. As the entries are in database
## order, not superior first order, they cannot be loaded with
## ldapadd without being reordered.
##
## backupdir (default /var/backups/ldap): the destination for the backups
# backupdir = /var/backups/ldap
## conf (default /etc/ldap/slapd.conf): the location of the slapd.conf file.
# conf = /etc/ldap/slapd.conf
## databases (default all): either a space separated list of database
## numbers or prefixes, or the keyword 'all'.
# databases = all
## compress (default yes): if set to yes, ldif exports are gzipped.
# compress = yes
## restart (default no): if set to yes, slapd is stopped before backups are
## performed, and then started again after they have finished, this is necessary
## if your backend is ldbm and your method is slapcat, but unnecessary otherwise.
# restart = no
## method (default ldapsearch): either 'ldapsearch' or 'slapcat'
## ldapsearch is the safer method to do backups, but is slow, slapcat
## is much faster, but should not be done on an ldbm backend unless you have
## restart set to yes
## NOTE: with the ldapsearch method passwordfile and binddn need to be set
# method = ldapsearch
## passwordfile (no default): this should be set to the file that contains
## your ldap password, this is required for ldapsearch and not needed for slapcat
## this file should have no newlines in it, echo -n "password" > passfile works.
## NOTE: be sure to set the permissions on your password file appropriately
## (hint: world readable is not appropriate)
# passwordfile =
## binddn (no default): set this to the DN of the user that the ldapsearch binds
## to, not needed for slapcat
# binddn =
## ldaphost (no default): set this to your ldap host if it is not local
# ldaphost =
## ssl (default yes): if set to 'yes' then SSL connection will be
## attempted to your ldaphost by using ldaps://
# ssl = yes
## tls (default no): if set to 'yes' then TLS connection will be
## attempted to your ldaphost by using TLS extended operations (RFC2246,
## RFC2830)
# tls = no
This diff is collapsed.
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
HELPERS="$HELPERS ldap:ldap_database_backup"
ldap_create_file() {
while true; do
checkBox "ldap action wizard" "check options (slapcat OR ldapsearch)" \
"slapcat" "export ldif using slapcat" yes \
"ldapsearch" "export ldif using ldapsearch" no \
"compress" "compress the ldif output files" yes \
"ssl" "use SSL (deprecated)" no \
"tls" "use TLS extended operations (RFC2246, RFC2830)" yes
status=$?
compress="compress = no"
method="method = <unset>"
restart="restart = no"
binddn=""
passwordfile=""
ssl="ssl = no"
tls="tls = no"
[ $status = 1 ] && return;
result="$REPLY"
for opt in $result; do
case $opt in
'"compress"') compress="compress = yes";;
'"slapcat"')
method="method = slapcat"
[ "$_RESTART" == "yes" ] && restart="restart = yes"
;;
'"ldapsearch"')
method="method = ldapsearch"
inputBox "ldap action wizard" "ldapsearch requires authentication. Specify here what password file to use. It must have the password with no trailing return and it should not be world readable."
[ $? = 1 ] && return
passwordfile="passwordfile = $REPLY"
inputBox "ldap action wizard" "ldapsearch requires authentication. Specify here what DN to bind as:"
[ $? = 1 ] && return
binddn="binddn = $REPLY"
require_packages ldap-utils
;;
'"ssl"') ssl="ssl = yes";;
'"tls"') tls="tls = yes";;
esac
done
get_next_filename $configdirectory/30.ldap
cat > $next_filename <<EOF
$method
$compress
$restart
$binddn
$passwordfile
$ssl
$tls
# backupdir = /var/backups/ldap
# conf = /etc/ldap/slapd.conf
# databases = all
EOF
chmod 600 $next_filename
return
done
}
ldap_wizard() {
bdb=no
hdb=no
ldbm=no
for backend in `grep -e "^backend" /etc/ldap/slapd.conf | @AWK@ '{print $2}'`; do
if [ "$backend" == "bdb" ]; then
bdb=yes
elif [ "$backend" == "hdb" ]; then
hdb=yes
elif [ "$backend" == "ldbm" ]; then
ldbm=yes
fi
done
if [ "$bdb" == "yes" -o "$hdb" == "yes" ]; then
if [ "$ldbm" == "no" ]; then
msgBox "ldap action wizard" "It looks like the backend in your slapd.conf is set to BDB or HDB. If this is not the case, exit this wizard! From this point on, we will assume BDB or HDB backend, which might have disasterious consequences if this is incorrect."
_RESTART=no
ldap_create_file
fi
elif [ "$ldbm" == "yes" ]; then
msgBox "ldap action wizard" "It looks like the backend in your slapd.conf is set to LDBM. Because of this, you will have less options (because it is not safe to use slapcat while slapd is running LDBM)."
_RESTART=yes
ldap_create_file
else
msgBox "ldap action wizard" "I couldn't find any supported backend in your slapd.conf. Bailing out."
return
fi
}
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
#
# openldap backup handler script for backupninja
#
getconf backupdir /var/backups/ldap
getconf conf /etc/ldap/slapd.conf
getconf databases all
getconf compress yes
getconf ldif yes
getconf restart no
getconf method ldapsearch
getconf passwordfile
getconf binddn
getconf ldaphost
getconf ssl yes
getconf tls no
if [ $ssl = 'yes' ]; then
URLBASE="ldaps"
else
URLBASE="ldap"
fi
status="ok"
[ -f $conf ] || fatal "slapd config file ($conf) not found"
[ -d $backupdir ] || mkdir -p $backupdir
[ -d $backupdir ] || fatal "Backup directory '$backupdir'"
dbsuffixes=(`@AWK@ 'BEGIN {OFS=":"} /[:space:]*^database[:space:]*\w*/ {db=$2}; /^[:space:]*suffix[:space:]*\w*/ {if (db=="bdb"||db=="hdb"||db="ldbm") print db,$2}' $conf|@SED@ -e 's/[" ]//g'`)
## LDIF DUMP
if [ "$ldif" == "yes" ]; then
dumpdir="$backupdir"
[ -d $dumpdir ] || mkdir -p $dumpdir
if [ "$databases" == 'all' ]; then
dbcount=`grep '^database' $conf | wc -l`
let "dbcount = dbcount - 1"
databases=`seq 0 $dbcount`;
fi
for db in $databases; do
if [ `expr index "$db" "="` == "0" ]; then
# db is a number, get the suffix.
dbsuffix=${dbsuffixes[$db]/*:/}
else
dbsuffix=$db
fi
# some databases don't have suffix (like monitor), skip these
if [ "$dbsuffix" == "" ]; then
continue;
fi
if [ "$method" == "slapcat" ]; then
execstr="$SLAPCAT -f $conf -b $dbsuffix"
else
LDAPARGS=""
if [ "$tls" == "yes" ]; then
LDAPARGS="-ZZ"
fi
if [ -n "$ldaphost" ]; then
execstr="$LDAPSEARCH $LDAPARGS -H $URLBASE://$ldaphost -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile"
else
execstr="$LDAPSEARCH -H $URLBASE://$ldaphost -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile"
fi
[ -f "$passwordfile" ] || fatal "Password file $passwordfile not found. When method is set to ldapsearch, you must also specify a password file."
debug "$execstr"
fi
if [ ! $test ]; then
if [ "$restart" == "yes" ]; then
debug "Shutting down ldap server..."
/etc/init.d/slapd stop
fi
ext=
if [ "$compress" == "yes" ]; then
ext=".gz"
fi
touch $dumpdir/$dbsuffix.ldif$ext
if [ ! -f $dumpdir/$dbsuffix.ldif$ext ]; then
fatal "Couldn't create ldif dump file: $dumpdir/$dbsuffix.ldif$ext"
fi
if [ "$compress" == "yes" ]; then
execstr="$execstr | $GZIP $GZIP_OPTS > $dumpdir/$dbsuffix.ldif.gz"
else
execstr="$execstr > $dumpdir/$dbsuffix.ldif"
fi
debug "$execstr"
output=`su root -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1`
code=$?
if [ "$code" == "0" ]; then
debug $output
info "Successfully finished ldif export of $dbsuffix"
else
warning $output
warning "Failed ldif export of $dbsuffix"
fi
if [ "$restart" == "yes" ]; then
debug "Starting ldap server..."
/etc/init.d/slapd start
fi
fi
done
fi
return 0
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment