Ticket #1124: ds-backup080109.py.patch

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

    old new  
    6464
    6565    ssh = '/usr/bin/ssh -F /dev/null -o "PasswordAuthentication no" -o "StrictHostKeyChecking no" -i "%s" -l "%s"' \
    6666        % (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' " % \
    6868            (ssh, from_path, to_path)
    6969    print rsync
    7070    rsync_p = popen2.Popen3(rsync, True)
     
    8787    # Note: the dest dir on the XS is watched via
    8888    # inotify - so we avoid creating tempfiles there.
    8989    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' "
    9191             % (ssh, tmpfile[1], BACKUP_SERVER+':/var/lib/ds-backup/completion/'+user))
    9292    rsync_p = popen2.Popen3(rsync, True)
    9393    rsync_exit = os.WEXITSTATUS(rsync_p.wait())
     
    109109    fh.close()
    110110    return data
    111111
    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
     113def get_identifier_info(info):
     114  identifier_dir = os.path.expanduser('~') + '/.sugar/default/identifiers/'
     115  fh = open(os.path.join(identifier_dir, info),'r')
    115116  data = fh.read().rstrip('\0\n')
    116117  fh.close()
    117118  return data
     
    123124       sn = read_ofw('mfg-data/SN')
    124125       BACKUP_SERVER = 'schoolserver'
    125126    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')
    132130     
    133131    backup_url = 'http://'+BACKUP_SERVER+'/backup/1'
    134132