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;
}
}
+template<class I, class O>
+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;
copy( current.begin(), current.end(), ostream_iterator<FileData*>( dbout, "" ) );
// Write the 'final' list to stdout
- copy( final.begin(), final.end(), ostream_iterator<FileData*>( cout, "" ) );
+ copy_filenames( final.begin(), final.end(), ostream_iterator<string>( cout, "" ) );
cerr << "Need backing up..." << endl;
cerr << " Added Bytes: " << added_bytes << endl;
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
+
# 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