diff options
author | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2008-09-13 13:23:30 +0000 |
---|---|---|
committer | rhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4> | 2008-09-13 13:23:30 +0000 |
commit | 5bb2b7f85b57873b975205db13218bbf1f41d143 (patch) | |
tree | 625de3c3c61d7a4c8c6a72b6b06a41d3555f64ed /app | |
parent | e20108af2b129fd8d4265ff96b53b1a25e586e89 (diff) | |
download | slackbuilds-5bb2b7f85b57873b975205db13218bbf1f41d143.tar.gz slackbuilds-5bb2b7f85b57873b975205db13218bbf1f41d143.tar.bz2 |
backupninja: rebuilt from mkbuild
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@1907 370017ae-e619-0410-ac65-c121f96126d4
Diffstat (limited to 'app')
-rw-r--r-- | app/backup/backupninja/backupninja-0.9.6.diff | 436 | ||||
-rwxr-xr-x | app/backup/backupninja/backupninja.SlackBuild | 45 |
2 files changed, 468 insertions, 13 deletions
diff --git a/app/backup/backupninja/backupninja-0.9.6.diff b/app/backup/backupninja/backupninja-0.9.6.diff new file mode 100644 index 00000000..74ea8db3 --- /dev/null +++ b/app/backup/backupninja/backupninja-0.9.6.diff @@ -0,0 +1,436 @@ +diff -Naur backupninja-0.9.6.orig/handlers/mysql.in backupninja-0.9.6/handlers/mysql.in +--- backupninja-0.9.6.orig/handlers/mysql.in 2008-06-24 12:55:10.000000000 -0300 ++++ backupninja-0.9.6/handlers/mysql.in 2008-09-13 10:23:20.000000000 -0300 +@@ -88,8 +88,7 @@ + then + if [ $usevserver = yes ] + then +- vhome=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` +- home="$vroot$vhome" ++ home=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` + else + home=`getent passwd "root" | @AWK@ -F: '{print $6}'` + fi +@@ -97,18 +96,25 @@ + [ -d $home ] || fatal "Can't find root's home directory ($home)." + + mycnf="$home/.my.cnf" +- +- if [ -f $mycnf ] ++ ++ if [ $usevserver = yes ] ++ then ++ workcnf="$vroot$mycnf" ++ else ++ workcnf="$mycnf" ++ fi ++ ++ if [ -f $workcnf ] + then +- # rename temporarily +- tmpcnf="$home/my.cnf.disable" +- debug "mv $mycnf $tmpcnf" +- mv $mycnf $tmpcnf ++ # rename temporarily ++ tmpcnf="$workcnf.disable" ++ debug "mv $workcnf $tmpcnf" ++ mv $workcnf $tmpcnf + fi + + oldmask=`umask` + umask 077 +- cat > $mycnf <<EOF ++ cat > $workcnf <<EOF + # auto generated backupninja mysql conf + [mysql] + host=$dbhost +@@ -124,14 +130,14 @@ + host=$dbhost + user=$dbusername + password="$dbpassword" ++ ++[mysqladmin] ++host=$dbhost ++user=$dbusername ++password="$dbpassword" + EOF + umask $oldmask +- if [ $usevserver = yes ] +- then +- defaultsfile="--defaults-extra-file=$vhome/.my.cnf" +- else +- defaultsfile="--defaults-extra-file=$mycnf" +- fi ++ defaultsfile="--defaults-extra-file=$mycnf" + fi + + # if a user is not set, use $configfile, otherwise use $mycnf +@@ -142,22 +148,23 @@ + userset=true; + if [ $usevserver = yes ] + then +- vuserhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'` ++ userhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'` + if [ $? -eq 2 ] + then + fatal "User $user not found in /etc/passwd" + fi +- userhome="$vroot$vuserhome" ++ debug "User home set to: $vroot$userhome" ++ [ -f $vroot$userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" + else + userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'` + if [ $? -eq 2 ] + then + fatal "User $user not found in /etc/passwd" + fi +- fi ++ debug "User home set to: $userhome" ++ [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" ++ fi + +- debug "User home set to: $userhome" +- [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" + defaultsfile="--defaults-extra-file=$userhome/.my.cnf" + debug "using $defaultsfile" + fi +@@ -307,12 +314,12 @@ + if [ "$dbusername" != "" -a "$dbpassword" != "" ] + then + ## clean up tmp config file +- debug "rm $mycnf" +- rm $mycnf ++ debug "rm $workcnf" ++ rm $workcnf + if [ -f "$tmpcnf" ] + then +- debug "mv $tmpcnf $mycnf" +- mv $tmpcnf $mycnf ++ debug "mv $tmpcnf $workcnf" ++ mv $tmpcnf $workcnf + fi + fi + +diff -Naur backupninja-0.9.6.orig/handlers/mysql.in~ backupninja-0.9.6/handlers/mysql.in~ +--- backupninja-0.9.6.orig/handlers/mysql.in~ 1969-12-31 21:00:00.000000000 -0300 ++++ backupninja-0.9.6/handlers/mysql.in~ 2008-06-24 12:55:10.000000000 -0300 +@@ -0,0 +1,319 @@ ++# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- ++# ++# mysql handler script for backupninja ++# ++ ++getconf backupdir /var/backups/mysql ++getconf databases all ++getconf ignores ++getconf nodata ++getconf dbhost localhost ++getconf hotcopy no ++getconf sqldump no ++getconf compress yes ++getconf vsname ++ ++# authentication: ++getconf user ++getconf dbusername ++getconf dbpassword ++getconf configfile /etc/mysql/debian.cnf ++ ++ ++# Decide if the handler should operate on a vserver or on the host. ++# In the former case, check that $vsname exists and is running. ++local usevserver=no ++local vroot ++if [ $vservers_are_available = yes ]; then ++ if [ -n "$vsname" ]; then ++ # does it exist ? ++ if ! vservers_exist "$vsname" ; then ++ fatal "The vserver given in vsname ($vsname) does not exist." ++ fi ++ # is it running ? ++ vservers_running $vsname || fatal "The vserver $vsname is not running." ++ # everything ok ++ info "Using vserver '$vsname'." ++ usevserver=yes ++ vroot="$VROOTDIR/$vsname" ++ else ++ info "No vserver name specified, actions will be performed on the host." ++ fi ++fi ++ ++## Prepare ignore part of the command ++## This only works for mysqldump at the moment ++ ++ignore='' ++for i in $ignores $nodata; do ++ ignore="$ignore --ignore-table=$i" ++done ++ ++# create backup dirs, $vroot will be empty if no vsname was specified ++# and we will instead proceed to operate on the host ++[ -d $vroot$backupdir ] || mkdir -p $vroot$backupdir ++[ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir'" ++hotdir="$backupdir/hotcopy" ++dumpdir="$backupdir/sqldump" ++ ++if [ $usevserver = yes ] ++then ++ [ "$sqldump" == "no" -o -d $vroot$dumpdir ] || $VSERVER $vsname exec mkdir -p $dumpdir ++ [ "$hotcopy" == "no" -o -d $vroot$hotdir ] || $VSERVER $vsname exec mkdir -p $hotdir ++else ++ [ "$sqldump" == "no" -o -d $dumpdir ] || mkdir -p $dumpdir ++ [ "$hotcopy" == "no" -o -d $hotdir ] || mkdir -p $hotdir ++fi ++ ++####################################################################### ++## AUTHENTICATION ++ ++# ++# one of three authentication methods: ++# 1. setting the user, so that /home/user/.my.cnf is used. ++# 2. specifying the user and password in the handler config, ++# which generates a temporary .my.cnf in /root/.my.cnf ++# 3. specify the config file with --defaults-extra-file ++# (this option DOESN'T WORK WITH MYSQLHOTCOPY) ++# ++ ++# create .my.cnf ++# only if dbusername and dbpassword specified. ++# we create a tmp file because we don't want to ++# specify the password on the command line. ++ ++defaultsfile="" ++ ++if [ "$dbusername" != "" -a "$dbpassword" != "" ] ++then ++ if [ $usevserver = yes ] ++ then ++ vhome=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` ++ home="$vroot$vhome" ++ else ++ home=`getent passwd "root" | @AWK@ -F: '{print $6}'` ++ fi ++ ++ [ -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 <<EOF ++# auto generated backupninja mysql conf ++[mysql] ++host=$dbhost ++user=$dbusername ++password="$dbpassword" ++ ++[mysqldump] ++host=$dbhost ++user=$dbusername ++password="$dbpassword" ++ ++[mysqlhotcopy] ++host=$dbhost ++user=$dbusername ++password="$dbpassword" ++EOF ++ umask $oldmask ++ if [ $usevserver = yes ] ++ then ++ defaultsfile="--defaults-extra-file=$vhome/.my.cnf" ++ else ++ defaultsfile="--defaults-extra-file=$mycnf" ++ fi ++fi ++ ++# if a user is not set, use $configfile, otherwise use $mycnf ++if [ "$user" == "" ]; then ++ user=root; ++ defaultsfile="--defaults-extra-file=$configfile" ++else ++ userset=true; ++ if [ $usevserver = yes ] ++ then ++ vuserhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'` ++ if [ $? -eq 2 ] ++ then ++ fatal "User $user not found in /etc/passwd" ++ fi ++ userhome="$vroot$vuserhome" ++ else ++ userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'` ++ if [ $? -eq 2 ] ++ then ++ fatal "User $user not found in /etc/passwd" ++ fi ++ fi ++ ++ debug "User home set to: $userhome" ++ [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" ++ defaultsfile="--defaults-extra-file=$userhome/.my.cnf" ++ debug "using $defaultsfile" ++fi ++ ++####################################################################### ++## HOT COPY ++ ++if [ "$hotcopy" == "yes" ] ++then ++ info "Initializing hotcopy method" ++ if [ "$databases" == "all" ] ++ then ++ if [ $usevserver = yes ] ++ then ++ info "dbhost: $dbhost" ++ execstr="$VSERVER $vsname exec $MYSQLHOTCOPY -h $dbhost --quiet --allowold --regexp /.\*/./.\*/ $hotdir" ++ else ++ execstr="$MYSQLHOTCOPY --quiet --allowold --regexp /.\*/./.\*/ $hotdir" ++ fi ++ debug "su $user -c \"$execstr\"" ++ if [ ! $test ] ++ then ++ output=`su $user -c "$execstr" 2>&1` ++ code=$? ++ if [ "$code" == "0" ] ++ then ++ debug $output ++ info "Successfully finished hotcopy of all mysql databases" ++ else ++ warning $output ++ warning "Failed to hotcopy all mysql databases" ++ fi ++ fi ++ else ++ for db in $databases ++ do ++ if [ $usevserver = yes ] ++ then ++ execstr="$VSERVER $vsname exec $MYSQLHOTCOPY --allowold $db $hotdir" ++ else ++ execstr="$MYSQLHOTCOPY --allowold $db $hotdir" ++ fi ++ debug 'su $user -c \"$execstr\"' ++ if [ ! $test ] ++ then ++ output=`su $user -c "$execstr" 2>&1` ++ code=$? ++ if [ "$code" == "0" ] ++ then ++ debug $output ++ info "Successfully finished hotcopy of mysql database $db" ++ else ++ warning $output ++ warning "Failed to hotcopy mysql database $db" ++ fi ++ fi ++ done ++ fi ++fi ++ ++########################################################################## ++## SQL DUMP ++ ++if [ "$sqldump" == "yes" ] ++then ++ info "Initializing SQL dump method" ++ if [ "$databases" == "all" ] ++ then ++ if [ $usevserver = yes ] ++ then ++ debug 'echo show databases | $VSERVER $vsname exec su $user -c \"$MYSQL $defaultsfile\" | grep -v Database' ++ databases=`echo 'show databases' | $VSERVER $vsname exec su $user -c "$MYSQL $defaultsfile" | grep -v Database` ++ if [ $? -ne 0 ] ++ then ++ fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" ++ fi ++ else ++ databases=$(su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d') ++ if [ $? -ne 0 ] ++ then ++ fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" ++ fi ++ fi ++ fi ++ ++ for db in $databases ++ do ++ DUMP_BASE="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names" ++ ++ # Dumping structure and data ++ DUMP="$DUMP_BASE $ignore $db" ++ ++ # If requested, dump only the table structure for this database ++ if echo "$nodata" | grep -E '(^|[[:space:]])'"$db\." >/dev/null ++ then ++ # Get the structure of the tables, without data ++ DUMP_STRUCT="$DUMP_BASE --no-data $db" ++ for qualified_table in $nodata ++ do ++ table=$( expr match "$qualified_table" "$db\.\([^\w]*\)" ) ++ DUMP_STRUCT="$DUMP_STRUCT $table" ++ done ++ DUMP="( $DUMP; $DUMP_STRUCT )" ++ fi ++ if [ $usevserver = yes ] ++ then ++ # Test to make sure mysqld is running, if it is not sqldump will not work ++ $VSERVER $vsname exec su $user -c "$MYSQLADMIN $defaultsfile ping" ++ if [ $? -ne 0 ]; then ++ fatal "Either you have an authentication problem, or mysqld doesn't appear to be running!" ++ fi ++ if [ "$compress" == "yes" ]; then ++ execstr="$VSERVER $vsname exec $DUMP | $GZIP > $vroot$dumpdir/${db}.sql.gz" ++ else ++ execstr="$VSERVER $vsname exec $DUMP -r $vroot$dumpdir/${db}.sql" ++ fi ++ else ++ # Test to make sure mysqld is running, if it is not sqldump will not work ++ su $user -c "$MYSQLADMIN $defaultsfile ping" ++ if [ $? -ne 0 ]; then ++ fatal "Either you have an authentication problem, or mysqld doesn't appear to be running!" ++ fi ++ if [ "$compress" == "yes" ]; then ++ execstr="$DUMP | $GZIP > $dumpdir/${db}.sql.gz" ++ else ++ execstr="$DUMP -r $dumpdir/${db}.sql" ++ fi ++ fi ++ debug "su $user -c \"$execstr\"" ++ if [ ! $test ] ++ then ++ output=`su $user -c "$execstr" 2>&1` ++ code=$? ++ if [ "$code" == "0" ] ++ then ++ debug $output ++ info "Successfully finished dump of mysql database $db" ++ else ++ warning $output ++ warning "Failed to dump mysql databases $db" ++ fi ++ fi ++ done ++fi ++ ++# clean up tmp config file ++if [ "$dbusername" != "" -a "$dbpassword" != "" ] ++then ++ ## clean up tmp config file ++ debug "rm $mycnf" ++ rm $mycnf ++ if [ -f "$tmpcnf" ] ++ then ++ debug "mv $tmpcnf $mycnf" ++ mv $tmpcnf $mycnf ++ fi ++fi ++ ++return 0 diff --git a/app/backup/backupninja/backupninja.SlackBuild b/app/backup/backupninja/backupninja.SlackBuild index 3deb32cc..5d8717d6 100755 --- a/app/backup/backupninja/backupninja.SlackBuild +++ b/app/backup/backupninja/backupninja.SlackBuild @@ -10,13 +10,13 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # # slackbuild for backupninja, by Silvio Rhatto -# requires: -# tested: backupninja-0.9.5 +# requires: +# tested: backupninja-0.9.6 # # Look for slackbuildrc @@ -31,7 +31,7 @@ CWD="$(pwd)" SRC_NAME="backupninja" PKG_NAME="backupninja" ARCH="noarch" -SRC_VERSION=${VERSION:=0.9.5} +SRC_VERSION=${VERSION:=0.9.6} PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" BUILD=${BUILD:=1rha} SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME @@ -55,8 +55,9 @@ elif [ "$ARCH" = "i686" ]; then elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2" + SLKCFLAGS="-O2 -fPIC" LIBDIR="$PREFIX/lib64" + LDFLAGS="-L/lib64 -L/usr/lib64" fi # Set error codes (used by createpkg) @@ -83,15 +84,14 @@ if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET fi - # Untar cd "$PKG_WORK" tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR -PKG_SRC=`ls -l | awk '/^d/ { print $8 }'` +PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`" cd "$PKG_SRC" # Patch source -patches="[[PATCH FILES]] +patches=" $PKG_NAME.diff $PKG_NAME-$PKG_VERSION.diff $PKG_NAME-$PKG_VERSION-$ARCH.diff $PKG_NAME-$ARCH.diff" for patch in $patches; do @@ -99,9 +99,29 @@ for patch in $patches; do patch -Np1 < "$CWD/$patch" || exit $ERROR_PATCH elif [ -f "$CWD/patches/$patch" ]; then patch -Np1 < "$CWD/patches/$patch" || exit $ERROR_PATCH + elif [ -f "$CWD/$patch.gz" ]; then + gzip -dc "$CWD/$patch.gz" | patch -Np1 || exit $ERROR_PATCH + elif [ -f "$CWD/patches/$patch.gz" ]; then + gzip -dc "$CWD/patches/$patch.gz" | patch -Np1 || exit $ERROR_PATCH fi done +if echo [[PATCH URLS]] | grep -q -v "PATCH URLS"; then + for patch_url in [[PATCH URLS]]; do + patch="`basename $patch_url`" + if [ ! -s "$SRC_DIR/$patch" ]; then + wget "$patch_url" -O "$SRC_DIR/$patch" || exit $ERROR_WGET + fi + if [ "`basename $patch .gz`" != "$patch" ]; then + gzip -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + elif [ "`basename $patch .bz2`" != "$patch" ]; then + bzip2 -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH + else + patch -Np1 < "$SRC_DIR/$patch" || exit $ERROR_PATCH + fi + done +fi + # Configure ./autogen.sh || exit $ERROR_CONF CFLAGS="$SLKCFLAGS" \ @@ -135,7 +155,6 @@ rm $PKG/etc/backupninja.conf sed -e 's/\/usr\/var\/log/\/var\/log\/backup/g' $PKG/etc/logrotate.d/backupninja > $PKG/etc/logrotate.d/backupninja.new mv $PKG/etc/logrotate.d/backupninja.new $PKG/etc/logrotate.d/backupninja - # Install documentation DOCS="AUTHORS COPYING ChangeLog INSTALL NEWS README TODO" mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR @@ -149,9 +168,9 @@ done mkdir -p "$PKG/install" || exit $ERROR_MKDIR cat << EODESC > "$PKG/install/slack-desc" # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line +# The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must +# on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. |