rpms/bontmia/FC-6 bontmia-0.14-mktemp.patch, NONE, 1.1 bontmia.spec, NONE, 1.1 sources, 1.1, 1.2

Terje Røsten (terjeros) fedora-extras-commits at redhat.com
Tue Jul 31 17:34:00 UTC 2007


Author: terjeros

Update of /cvs/extras/rpms/bontmia/FC-6
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1983

Modified Files:
	sources 
Added Files:
	bontmia-0.14-mktemp.patch bontmia.spec 
Log Message:
Importing bontmia: FC6 branch.



bontmia-0.14-mktemp.patch:

--- NEW FILE bontmia-0.14-mktemp.patch ---
--- bontmia-0.14/bontmia~	2004-07-26 00:16:10.000000000 +0200
+++ bontmia-0.14/bontmia	2007-06-13 13:33:18.000000000 +0200
@@ -182,12 +182,23 @@
     rm -f "${tmpdir}/is_running.lock"
 }
 
+create_private_tmpdir()
+{
+    tmpdir=$(mktemp -d /tmp/bontmia-tmpdir.XXXXXX) || exit 1
+    echo $tmpdir
+}
+
+clean_private_tmpdir()
+{
+    rm -rf $private_tmpdir
+}
 
 lock_destination()
 {
+    local TMPFILE
     # Ensure that there is no other bontmia running against the same destination
-    touch /tmp/bontmia_lock_file.$$
-    echo "no" | mv -i /tmp/bontmia_lock_file.$$ "${tmpdir}"/is_running.lock 2>&1 | \
+    TMPFILE=$(mktemp $private_tmpdir/bontmia_lock_file.XXXXXX) || exit 1
+    echo "no" | mv -i $TMPFILE "${tmpdir}"/is_running.lock 2>&1 | \
 	grep "overwrite" >/dev/null 2>&1 && {
 	echo "Bontmia is already doing a backup on this tmpdir:"
 	echo "    ${tmpdir}"
@@ -321,6 +332,7 @@
 
 make_backup()
 {
+    local TMPFILE TMPFILE2
     this_backup=$(date +%Y)/$(date +%m)/$(date +%d)/$(date +%H\:%M)
 
     do_the_backup_exist "$this_backup"
@@ -349,21 +361,23 @@
 
 	if test "x$dryrun" == "xno"; then
 	    mkdir -p "$tmpdir/unfinished_backup/$this_backup/$hostname"
+            TMPFILE=$(mktemp $private_tmpdir/bontmia_rsync_output.XXXXXX) || exit 1
+            TMPFILE2=$(mktemp $private_tmpdir/bontmia_rsync_output.2.XXXXXX) || exit 1
 
-	    rsync ${rsync_options} -e "ssh -p $port" "${dir}" "${tmpdir}/unfinished_backup/$this_backup/${hostname}" 2>&1 >/tmp/bontmia_rsync_output.$$ || {
+	    rsync ${rsync_options} -e "ssh -p $port" "${dir}" "${tmpdir}/unfinished_backup/$this_backup/${hostname}" 2>&1 >$TMPFILE || {
 		echo
 		echo "  Caught an error doing rsync (return code $?)"
 		echo "  The last 10 lines of output from rsync:"
-		tail -10 /tmp/bontmia_rsync_output.$$
+		tail -10 $TMPFILE
 		echo
 		echo "  Retrying rsync..."
-		rsync ${rsync_options} -e "ssh -p $port" "${dir}" "${tmpdir}/unfinished_backup/$this_backup/${hostname}" 2>&1 >/tmp/bontmia_rsync_output.$$ || {
+		rsync ${rsync_options} -e "ssh -p $port" "${dir}" "${tmpdir}/unfinished_backup/$this_backup/${hostname}" 2>&1 >$TMPFILE2 || {
 		    echo
 		    echo "  Still no luck.  Rsync failed with returncode $?"
 		    echo "  $dir"
 		    echo "  Please check that there is room for all the data"
 		    echo "  The last 10 lines of output from rsync:"
-		    tail -10 /tmp/bontmia_rsync_output.$$.2
+		    tail -10 $TMPFILE2
 		    echo
 		    echo
 		    echo "  Continuing with the next backup source"
@@ -562,27 +576,32 @@
 	exit 1
     }
     check_program cp
-    touch /tmp/bontmia_test_cp_file.$$ || {
-	echo "Could not create a temporary file on /tmp"
-	echo "Please make sure that /tmp is writable"
+    
+    TESTTMP=$(mktemp $private_tmpdir/bontmia.test.tmp.XXXXXX) || {
+	echo "Could not create a temporary file on /tmp/$private_tmpdir"
+	echo "Please make sure that /tmp and /tmp/$private_tmpdir is writable"
 	echo "Aborting"
 	unlock_destination
 	exit 1
     }
-    cp -l /tmp/bontmia_test_cp_file.$$ /tmp/bontmia_test_cp_file.$$.2 >/dev/null 2>&1 || {
+    
+    TMPFILE=$(mktemp $private_tmpdir/bontmia_test_cp_file.XXXXXX) || exit 1
+    cp -l $TMPFILE $TMPFILE.hardlink >/dev/null 2>&1 || {
 	echo "cp on your system does not support the -l option"
 	echo "You might not have the GNU version of 'cp'"
 	echo "Aborting"
 	unlock_destination
 	exit 1
     }
-    rm -f /tmp/bontmia_test_cp_file.$$ /tmp/bontmia_test_cp_file.$$.2
+    rm -f $TESTTMP $TMPFILE $TMPFILE.hardlink 
 }
 
 
 #################################################################
 
 
+LC_ALL=C
+
 if test "x$*" == x; then
     print_usage
 fi
@@ -693,6 +712,8 @@
     esac
 done
 
+private_tmpdir=$(create_private_tmpdir)
+
 check_for_programs
 
 tmpdir=${tmpdir:-"$backup_destination"}
@@ -737,4 +758,7 @@
 fi
 
 unlock_destination
+clean_private_tmpdir
+
 exit $exit_status
+


--- NEW FILE bontmia.spec ---
Summary:   Backup over network to multiple incremental archives
Name:      bontmia
Version:   0.14
Release:   1%{?dist}
License:   GPL
Group:     Applications/Archiving
URL:       http://folk.uio.no/johnen/bontmia/
Source0:   http://folk.uio.no/johnen/%{name}/%{name}-%{version}.tar.gz
Patch0:    bontmia-0.14-mktemp.patch
Requires:  bind-utils coreutils findutils grep mktemp 
Requires:  net-tools openssh-clients perl rsync sed
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
A disk based backup system which provides a complete snapshot of
backed up directories. Using a clever hardlink and rsync trick,
the backup is fast and space efficient.

%prep
%setup -q
%patch -p1
%build

%install
%{__rm} -rf %{buildroot}

%{__install} -d %{buildroot}%{_bindir}/
%{__install} -p -m 0755 bontmia %{buildroot}%{_bindir}/%{name}

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root, -)
%doc COPYING README
%{_bindir}/%{name}

%changelog
* Tue Jun 12 2007 Terje Rosten <terjeros at phys.ntnu.no> - 0.14-1 
- initial build


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/bontmia/FC-6/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	31 Jul 2007 15:16:47 -0000	1.1
+++ sources	31 Jul 2007 17:33:28 -0000	1.2
@@ -0,0 +1 @@
+6b97833d6b897fe0120bd0c0964da0c2  bontmia-0.14.tar.gz




More information about the scm-commits mailing list