Ticket #1124: ds-backup080109.py.patch
File ds-backup080109.py.patch, 2.0 KB (added by hamiltonchua, 14 years ago) |
---|
-
ds-backup.py
old new 64 64 65 65 ssh = '/usr/bin/ssh -F /dev/null -o "PasswordAuthentication no" -o "StrictHostKeyChecking no" -i "%s" -l "%s"' \ 66 66 % (keyfile, user) 67 rsync = "/usr/bin/rsync - z -rlt --partial --delete --timeout=160 -e '%s' '%s' '%s' " % \67 rsync = "/usr/bin/rsync -a -z -rlt --partial --delete --timeout=160 -e '%s' '%s' '%s' " % \ 68 68 (ssh, from_path, to_path) 69 69 print rsync 70 70 rsync_p = popen2.Popen3(rsync, True) … … 87 87 # Note: the dest dir on the XS is watched via 88 88 # inotify - so we avoid creating tempfiles there. 89 89 tmpfile = tempfile.mkstemp() 90 rsync = ("/usr/bin/rsync - z -rlt --timeout 10 -T /tmp -e '%s' '%s' '%s' "90 rsync = ("/usr/bin/rsync -a -z -rlt --timeout 10 -T /tmp -e '%s' '%s' '%s' " 91 91 % (ssh, tmpfile[1], BACKUP_SERVER+':/var/lib/ds-backup/completion/'+user)) 92 92 rsync_p = popen2.Popen3(rsync, True) 93 93 rsync_exit = os.WEXITSTATUS(rsync_p.wait()) … … 109 109 fh.close() 110 110 return data 111 111 112 def get_soas_info(info): 113 soas_dir = '/home/liveuser/.sugar/soas/' 114 fh = open(os.path.join(soas_dir, info),'r') 112 # SoaS : def to retreive sugar info from registering an SoaS 113 def get_identifier_info(info): 114 identifier_dir = os.path.expanduser('~') + '/.sugar/default/identifiers/' 115 fh = open(os.path.join(identifier_dir, info),'r') 115 116 data = fh.read().rstrip('\0\n') 116 117 fh.close() 117 118 return data … … 123 124 sn = read_ofw('mfg-data/SN') 124 125 BACKUP_SERVER = 'schoolserver' 125 126 else: 126 # HAM : SoaS 127 # sn = 'SHF00000000' 128 # client = gconf.client_get_default() 129 # sn = client.get_string('/desktop/sugar/soas_serial') 130 sn = get_soas_info('sn') 131 BACKUP_SERVER = get_soas_info('backup_url') 127 # retrieve the serial and backup_url 128 sn = get_identifier_info('sn') 129 BACKUP_SERVER = get_identifier_info('backup_url') 132 130 133 131 backup_url = 'http://'+BACKUP_SERVER+'/backup/1' 134 132