Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax errors #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 3 additions & 37 deletions raspiwrite.py
Expand Up @@ -55,39 +55,6 @@

OS = os.uname() #gets OS vars

def checkforUpdate():
print 'Checking for updates...'
global version

try:
file = urllib2.urlopen('http://www.exaviorn.com/raspiwrite.xml', timeout = 1)

data = file.read()
file.close()

dom = parseString(data)

versionToDate = float(dom.getElementsByTagName('Version')[0].toxml().replace('<Version>','').replace('</Version>',''))
summary = dom.getElementsByTagName('Summary')[0].toxml().replace('<Summary>','').replace('</Summary>','')
dlURL = dom.getElementsByTagName('URL')[0].toxml().replace('<URL>','').replace('</URL>','')

if version < versionToDate:
print WARNING + '#####################################################################################################################'
print 'Your current version (%s) of RasPiWrite is not the latest, please go to the link below to update to version %s,' % (version, versionToDate)
print 'The Changes include: %s' % summary
print '''
Please download the latest version of RasPiWrite from %s''' % dlURL
print '''#####################################################################################################################
''' + end
else:
print '''Your version of RasPiWrite is up-to-date
'''

except urllib2.URLError, e:
print """There was an error in checking for an update: %r
""" % e


def grabRoot(distro): #Parses the raspberry pi downloads page for the links for the currently RasPiWrite supported distros
links = list()
htmlSource = urllib2.urlopen('http://www.raspberrypi.org/downloads').read()
Expand Down Expand Up @@ -174,7 +141,7 @@ def run ( self ):
global path
if OS[0] != 'Darwin':
copyString = 'dd bs=1M if=%s of=%s' % (path,SDsnip)
else
else:
copyString = 'dd bs=1m if=%s of=%s' % (path,SDsnip)
print 'Running ' + copyString + '...'

Expand Down Expand Up @@ -272,10 +239,10 @@ def transfer(file,archiveType,obtain,SD,URL): #unzips the disk image
SDsnip = "/dev/mmcblk" + SD[11]
else:
if OS[0] != 'Darwin':
SDsnip = SD.replace(' ', '')[:-1]
SDsnip = SD.replace(' ', '')[:-1]
else:
# remove weird partition notation in OS X partition names
SDsnip = SD.replace(' ', '')[:-2]
SDsnip = SD.replace(' ', '')[:-2]

print path
print '\n\n###################################################################'
Expand Down Expand Up @@ -437,7 +404,6 @@ def driveTest(SD):
if not os.geteuid()==0:
print WARNING + 'Please run the script using sudo e.g. sudo python raspiwrite.py, or sudo ./raspiwrite.py (need to chmod +x first)' + end
exit()
checkforUpdate()
print 'The following script is designed to copy a Raspberry Pi compatible disk image to an SD Card'
print boldStart + 'INCORRECTLY FOLLOWING THE WIZARD COULD RESULT IN THE CORRUPTION OF YOUR HARD DISK, PARTITIONS OR A BACKUP USB DRIVE (INCLUDING MOUNTED TIME MACHINE BACKUP DRIVES)' +end
print 'It is advisable to remove any other USB HDDs or memory sticks, the wizard might select that one, %s if you have multiple hard drives installed, please take a LOT of care selecting the right drive %s'% (boldStart, end)
Expand Down