From: Carl Baldwin Date: Mon, 24 Oct 2005 00:27:42 +0000 (-0600) Subject: Regular commit X-Git-Tag: release-0.4~75 X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/static/images/%3C?a=commitdiff_plain;h=fc9ecb5d043146618676cd79fe0a6659f98a3970;p=backups%2F.git Regular commit --- diff --git a/main.cpp b/main.cpp index 945cc0d..b630ec8 100644 --- a/main.cpp +++ b/main.cpp @@ -10,7 +10,7 @@ using namespace std; static const unsigned int bytes_in_block = 0x800; -static const char * dbname = "/var/tmp/backups.db"; +static const char * dbname = "/var/lib/backups/backups.db"; unsigned long long current_time() { unsigned long long rc = 0; @@ -109,6 +109,17 @@ void sizes( ITER begin, const ITER &end, INT &numblocks, INT &numbytes ) { } } +template +void copy_filenames( I begin, const I &end, O out ) { + while( begin != end ) { + string output = (*begin)->getFileName(); + output.push_back( 0 ); + *out = output; + ++out; + ++begin; + } +} + int main() { // Parse the list of current files on stdin file_set current; @@ -201,7 +212,7 @@ int main() { copy( current.begin(), current.end(), ostream_iterator( dbout, "" ) ); // Write the 'final' list to stdout - copy( final.begin(), final.end(), ostream_iterator( cout, "" ) ); + copy_filenames( final.begin(), final.end(), ostream_iterator( cout, "" ) ); cerr << "Need backing up..." << endl; cerr << " Added Bytes: " << added_bytes << endl; diff --git a/scripts/drive.sh b/scripts/drive.sh index 9b3d02b..0918412 100755 --- a/scripts/drive.sh +++ b/scripts/drive.sh @@ -4,16 +4,32 @@ scriptsdir=$(dirname $0) bindir="$scriptsdir/../build" datadir="/var/lib/backups" -tmpdir="/var/tmp" +tmpdir="/dev/shm/backups" + +mkdir -p $tmpdir +chmod 700 $tmpdir export PATH=$scriptsdir:$bindir:$PATH -files=$tmpdir/files.db +files="$tmpdir/files.db" touch $files -chmod 700 $files +chmod 600 $files find-cmd.sh /home > $files -backups=$tmpdir/backup-list.db -statusfile=$tmpdir/backup-status.txt +db="$datadir/backups.db" +backups="$tmpdir/backup-list.db" +statusfile="$tmpdir/backup-status.txt" cat $files | lsbackups > $backups 2>$statusfile + +isomountdir="/backup/iso-mount" + +# Create filesystem on iso image here + +# chmod 600 iso-image + +# Mount iso image here + +# cat $backups | rsync-cmd.sh $isomountdir +# cp $statusfile $db $isomountdir + diff --git a/scripts/rsync-cmd.sh b/scripts/rsync-cmd.sh index 2ee3682..aa7e9f7 100755 --- a/scripts/rsync-cmd.sh +++ b/scripts/rsync-cmd.sh @@ -3,22 +3,13 @@ # This file just has some ideas about how to do the rsync command with the list # of file produced by lsbackups +[ $# == 1 ] || exit 1 +[ -d $1 ] || exit 1 + # -H ? -W ? rsync_opts='-W -H -l -p -t -g -o -0 --files-from=-' other_opts='--stats --progress' -# This would something like be /home -srcdir=~/test/a - -# This would be something like /mnt/dvdisoimage -dstdir=~/destdir - -# # For directories ( Do I even need this? I don't think so. ) -# find $srcdir -type d -print0 | # this just produces an example null-delimited list. -# rsync -d $rsync_opts $other_opts / $dstdir - # Should also include directories in there -find $srcdir \( -type f -o -type l -o -type d \) -print0 | # this just produces an example null-delimited list. - rsync $rsync_opts $other_opts / $dstdir - +rsync $rsync_opts $other_opts / $1