Ticket #916: ds-backup072509.py.patch

File ds-backup072509.py.patch, 1.6 KB (added by hamiltonchua, 15 years ago)
  • ds-backup.py

    old new  
    2727import glob
    2828import popen2
    2929import re
     30import gconf
    3031
    3132from sugar import env
    3233from sugar import profile
     
    8687    # Note: the dest dir on the XS is watched via
    8788    # inotify - so we avoid creating tempfiles there.
    8889    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' "
    9091             % (ssh, tmpfile[1], 'schoolserver:/var/lib/ds-backup/completion/'+user))
    9192    rsync_p = popen2.Popen3(rsync, True)
    9293    rsync_exit = os.WEXITSTATUS(rsync_p.wait())
     
    108109    fh.close()
    109110    return data
    110111
     112def 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
     119def 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
    111126# if run directly as script
    112127if __name__ == "__main__":
    113128
     
    116131    if have_ofw_tree():
    117132        sn = read_ofw('mfg-data/SN')
    118133    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()
    120139
    121140    ds_path = env.get_profile_path('datastore')
    122141    pk_path = os.path.join(env.get_profile_path(), 'owner.key')