From 31629102a28bd7bc0f045685013bf0cbee46680f Mon Sep 17 00:00:00 2001 From: adam balsam Date: Tue, 23 Oct 2012 15:48:14 -0400 Subject: [PATCH 1/2] Fixed some syntax errors I got running this script on os x 10.8 --- raspiwrite.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/raspiwrite.py b/raspiwrite.py index 054f93a..03796e4 100755 --- a/raspiwrite.py +++ b/raspiwrite.py @@ -174,7 +174,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 + '...' @@ -272,10 +272,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###################################################################' From c977a34e042c192853154f572667957e8c659b7e Mon Sep 17 00:00:00 2001 From: Adam Balsam Date: Mon, 4 Feb 2013 15:28:26 -0500 Subject: [PATCH 2/2] Removed checkforUpdate() function and call to it. The URL that the function used to determine whether or not there is an update available is defunct. Running the function will cause the script to fail. --- raspiwrite.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/raspiwrite.py b/raspiwrite.py index 03796e4..6b0264f 100755 --- a/raspiwrite.py +++ b/raspiwrite.py @@ -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('','').replace('','')) - summary = dom.getElementsByTagName('Summary')[0].toxml().replace('','').replace('','') - dlURL = dom.getElementsByTagName('URL')[0].toxml().replace('','').replace('','') - - 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() @@ -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)