[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
re[7]: [rdiff-backup-users] Still thinking about windows
From: |
Greg Freemyer |
Subject: |
re[7]: [rdiff-backup-users] Still thinking about windows |
Date: |
Thu, 13 Mar 2003 15:34:10 -0500 |
>> Maybe this would take too much work, but I just realized another
>> possibility is for rdiff-backup to do various tests on the destination
>> and/or source directory (e.g. seeing if it supports acls, eas, case
>> sensitive filenames, colons in the filenames, etc.). This would only
>> need to be done the first time since the information could be recorded
>> in a file in the rdiff-backup-data and just read from that for later
>> backups.
Ben,
I asked on the SuSE programmers list for some help, and I wrote the below
set_windows_mode() myself.
I ended up with the below pseudo python code. It does not run, but maybe you
could turn it into something useful.
The switch statement in particular is AC like. I assume python has an
equivalent.
Obviously it can be expanded.
-------- Cut Here ---------
import os, stat
def set_windows_mode(force_windows, force_unix, target_dir):
"""
force_windows and force_unix correspond to command-line args
target_dir is where the backup is being saved.
"""
if (force_windows):
windows_mode = true
else if (force_unix):
windows_mode = false
else if sys.platform == Linux2:
fstype = getFSType(target_dir)
switch(fstype) :
case ntfs
case fat
windows_mode=true
case xfs
case reiserfs
case ext2
case ext3
default
windows_mode=true
return
def getFSType(filename):
"""
Returns the fstype of the volume containg 'filename', which should be the
full path to the file
"""
# Build dict of filesystems and use the device number as the key
devices = {}
f = open('/proc/mounts')
for line in f.readlines():
info = line.split()
devnum = os.stat(info[1])[stat.ST_DEV]
devices[devnum] = info[2]
f.close()
# Find out which one contains 'filename' and return the fstype
return devices[os.stat(filename)[stat.ST_DEV]]
-------- Cut Here ---------
Greg
--
Greg Freemyer
- Re: [rdiff-backup-users] Still thinking about windows, (continued)
- re[2]: [rdiff-backup-users] Still thinking about windows, Greg Freemyer, 2003/03/12
- re[3]: [rdiff-backup-users] Still thinking about windows, Greg Freemyer, 2003/03/12
- RE: re[2]: [rdiff-backup-users] Still thinking about windows, Törrönen, Paul-Erik, 2003/03/13
- RE: [rdiff-backup-users] Still thinking about windows, Törrönen, Paul-Erik, 2003/03/13
- re[5]: [rdiff-backup-users] Still thinking about windows, Greg Freemyer, 2003/03/13
- re[4]: [rdiff-backup-users] Still thinking about windows, Greg Freemyer, 2003/03/13
- re[7]: [rdiff-backup-users] Still thinking about windows,
Greg Freemyer <=
- RE: re[4]: [rdiff-backup-users] Still thinking about windows, Törrönen, Paul-Erik, 2003/03/21