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

You can now have an already unpacked image file #6

Merged
merged 1 commit into from Jun 14, 2012
Merged
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
11 changes: 10 additions & 1 deletion raspiwrite.py
Expand Up @@ -178,6 +178,11 @@ def transfer(file,archiveType,obtain,SD,URL): #unzips the disk image
#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
extractCMD = 'unzip ' + file

if archiveType == 'img':
path = file;
extractCMD = 'echo No extracttion required for ' + file

if archiveType == 'gz':
path = file.replace(".gz", "") #<-- verify
extractCMD = 'gunzip ' + file
Expand Down Expand Up @@ -338,7 +343,11 @@ def getImage(SD): #gives the user a bunch of options to download an image, or se
matchZip = re.match('^.*\.zip$',userLocate)
matchGzip = re.match('^.*\.img.gz$',userLocate)
matchBzip = re.match('^.*\.tar.bz2$',userLocate)
matchImg = re.match('^.*\.img$',userLocate)

if matchImg is not None:
print 'Found Image file'
transfer(userLocate,'img','usr',SD,'none')
if matchZip is not None:
print 'Found Zip'
transfer(userLocate,'zip','usr',SD,'none')
Expand Down Expand Up @@ -426,4 +435,4 @@ def driveTest(SD):
driveTest(manualID)
else: #otherwise...
SD = matchSD(volumes).group(1) #selects the first SD/USB drive located
driveTest(SD) #action gets delegated to driveTest, which then leads on to the next step, I found this to be the easiest way
driveTest(SD) #action gets delegated to driveTest, which then leads on to the next step, I found this to be the easiest way