exaviorn / RasPiWrite

A Python Script that prepairs and installs a Raspberry Pi compatiable distro to an SD Card
exaviorn.com/raspiwrite
GNU General Public License v3.0
209 stars 130 forks source link

Tries to write wrong file on OSX. #38

Open Timmmm opened 12 years ago

Timmmm commented 12 years ago

Hi, this script needs work! On OSX it tries to run this:

Running dd bs=1m if=2012-09-18-wheezy-raspbian/2012-09-18-wheezy-raspbian.img of=/dev/disk1... Waitingdd: 2012-09-18-wheezy-raspbian/2012-09-18-wheezy-raspbian.img: No such file or directory

It can't find the file because ...raspbian.img is unzipped into the same level as ...raspbian.zip, not into a subdirectory. This may be something OSX does weird or maybe raspbian have changed the layout of their zip. In any case you should list the contents of the zip file and look for the largest .img file in it, then use that.

bryanlb commented 12 years ago

This can be fixed by making the following change on line 189.

Replace:

path = file.replace(".zip", "") + '/' + os.path.basename(file).replace(".zip", ".img") #Thanks to Lewis Boon

With:

path = os.path.basename(file).replace(".zip", ".img") 

Looks like unzipping utility handles things slightly differently, depending on the OS.