From 033b278f59d1303a75bfbd31da56a9e5394327e9 Mon Sep 17 00:00:00 2001 From: Guillaume Boudreau Date: Fri, 7 Dec 2012 07:18:06 -0500 Subject: [PATCH 1/2] Fixing typos that prevent the script from running --- raspiwrite.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/raspiwrite.py b/raspiwrite.py index 054f93a..bf1a630 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 518ae8219ad534742ed254f29e1bff0bcfc0086e Mon Sep 17 00:00:00 2001 From: Guillaume Boudreau Date: Fri, 7 Dec 2012 09:58:44 -0500 Subject: [PATCH 2/2] Fix for self-downloaded .zip in another folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the user downloads a .zip, and place it in another folder than the one from which he runs raspiwrite.py, the .img will be extracted in the current folder, but dd will try to use an img in the folder where the .zip is. Example:   cd ~   Downloads/raspiwrite.py     image location: ~/Documents/something.zip     unzip ~/Documents/something.zip # result is ~/Downloads/something.img     dd ... in=~/Documents/something.img # fails --- raspiwrite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raspiwrite.py b/raspiwrite.py index bf1a630..a6af18d 100755 --- a/raspiwrite.py +++ b/raspiwrite.py @@ -186,7 +186,7 @@ def transfer(file,archiveType,obtain,SD,URL): #unzips the disk image global path if archiveType == 'zip': #path = file.replace(".zip", "") + '/' + file.replace(".zip", ".img") <- my old code - path = file.replace(".zip", "") + '/' + os.path.basename(file).replace(".zip", ".img") #Thanks to Lewis Boon + path = './' + os.path.basename(file).replace(".zip", ".img") #Thanks to Lewis Boon extractCMD = 'unzip ' + file if archiveType == 'img':