Skip to content

Commit

Permalink
Added backup phase for userfiles and weio configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Uros Petrevski committed Oct 28, 2015
1 parent efb518f commit 71e7e71
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion updateMaker/prepareForWeIOServer/updateRecipe
Expand Up @@ -47,7 +47,7 @@
# Drasko DRASKOVIC <drasko.draskovic@gmail.com>
#
###
import urllib2, urllib, subprocess, platform, json, hashlib
import urllib2, urllib, subprocess, platform, json, hashlib, os, shutil

def startDownload(fwUrl, targetFile):
print "download init"
Expand Down Expand Up @@ -91,6 +91,22 @@ else:
p = subprocess.Popen(["/etc/init.d/weio_run", "stop"])
print p.communicate()

# Now we can start update procedure

# SAFE HOUSE
# Backup config.weio and userProjects
# this will be backuped after flashing with run_weio script (first time)
if (platform.machine() == 'mips') :
bckpdir = "/weioUserBackup"
# kill all symlinks in user projects otherwise it's not possible to move them or copy
p = subprocess.Popen(["sh", "/weio/scripts/killUserProjectSymlinks.sh"])
print p.communicate()
# move user projects to the backup directory
shutil.move("/weioUser/flash", bckpdir)
# add config.weio to the safe house
shutil.copyfile("/weio/config.weio", bckpdir+"/config.weio")

This comment has been minimized.

Copy link
@ks156

ks156 Oct 29, 2015

Contributor

You copy config.weio on bckpdir. Where and when do you restore it ?
config.weio contains the version, so it will change with each release. Do you handle this case ?


# DOWNLOADING PROCEDURE
# get json to extract MD5 data
print "getting JSON configuration from WeIO server"
startDownload("http://we-io.net/downloads/update/updateWeio.json", targetPath+"/updateWeio.json")
Expand All @@ -102,6 +118,7 @@ startDownload(data["recovery"]["download_url"], targetPath+"/weio_recovery.bin")
recoveryMd5Distant = data["recovery"]["md5"]
recoveryMd5Local = getMd5sum(targetPath+"/weio_recovery.bin")

# SYSTEM UPGRADE
if (recoveryMd5Distant == recoveryMd5Local):
print "MD5 matches. Starting sysupgrade procedure"
if (platform.machine() == 'mips') :
Expand Down

0 comments on commit 71e7e71

Please sign in to comment.