Skip to content

Commit

Permalink
[server] create a bootable usb drive
Browse files Browse the repository at this point in the history
  • Loading branch information
asmasma21 committed Apr 10, 2013
1 parent 84fa190 commit 99c839a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/server/command/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
def bootDistribution(dist):
usb = [f for f in os.listdir("/dev/disk/by-id/") if f.find("usb")!= -1 ]
if(len(usb)!=0):
homedir = os.environ['HOME']
base=homedir+"/.the-gnu-distro/distribution/"+dist
result= os.popen("udisks --show-info /dev/disk/by-id/usb*|grep -i 'device-file'").read()
target=result[result.find("/"):len(result)-1]
os.popen("dd if="+base+" of="+target+" ibs=4b obs=1b conv=notrunc,noerror").read()
return True
else:
return False

0 comments on commit 99c839a

Please sign in to comment.