Ticket #916: ds-backup072509.py.patch
File ds-backup072509.py.patch, 1.6 KB (added by hamiltonchua, 14 years ago) |
---|
-
ds-backup.py
old new 27 27 import glob 28 28 import popen2 29 29 import re 30 import gconf 30 31 31 32 from sugar import env 32 33 from sugar import profile … … 86 87 # Note: the dest dir on the XS is watched via 87 88 # inotify - so we avoid creating tempfiles there. 88 89 tmpfile = tempfile.mkstemp() 89 rsync = ("/usr/bin/rsync - a-rlt --timeout 10 -T /tmp -e '%s' '%s' '%s' "90 rsync = ("/usr/bin/rsync -z -rlt --timeout 10 -T /tmp -e '%s' '%s' '%s' " 90 91 % (ssh, tmpfile[1], 'schoolserver:/var/lib/ds-backup/completion/'+user)) 91 92 rsync_p = popen2.Popen3(rsync, True) 92 93 rsync_exit = os.WEXITSTATUS(rsync_p.wait()) … … 108 109 fh.close() 109 110 return data 110 111 112 def get_soas_sn(): 113 soas_dir = '/home/liveuser/.sugar/soas/' 114 fh = open(os.path.join(soas_dir, 'sn'),'r') 115 data = fh.read().rstrip('\0\n') 116 fh.close() 117 return data 118 119 def get_soas_uuid(): 120 soas_dir = '/home/liveuser/.sugar/soas/' 121 fh = open(os.path.join(soas_dir, 'uuid'),'r') 122 data = fh.read().rstrip('\0\n') 123 fh.close() 124 return data 125 111 126 # if run directly as script 112 127 if __name__ == "__main__": 113 128 … … 116 131 if have_ofw_tree(): 117 132 sn = read_ofw('mfg-data/SN') 118 133 else: 119 sn = 'SHF00000000' 134 # HAM : SoaS 135 # sn = 'SHF00000000' 136 # client = gconf.client_get_default() 137 # sn = client.get_string('/desktop/sugar/soas_serial') 138 sn = get_soas_sn() 120 139 121 140 ds_path = env.get_profile_path('datastore') 122 141 pk_path = os.path.join(env.get_profile_path(), 'owner.key')