Skip to content

Instantly share code, notes, and snippets.

@ruzickap
Last active December 27, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ruzickap/7395635 to your computer and use it in GitHub Desktop.
Save ruzickap/7395635 to your computer and use it in GitHub Desktop.
Create iso containing VirtIO drivers and autostart script.
#!/bin/bash -x
URL="http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-65.iso"
ISO=`basename $URL`
sudo rm autostart.iso
wget --continue $URL
sudo mount -o loop ./$ISO /mnt/iso
mkdir -v cd
#32 bit
cp -v /mnt/iso/win7/x86/* $PWD/cd/
#64 bit
#cp -v -r /mnt/iso/win7/amd64/* $PWD/cd/
cat > $PWD/cd/autorun.bat << \EOF
:: Tested on Windows Win7
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile(\"https://gist.github.com/ruzickap/7395426/raw/win7-admin.bat\", \"c:\win7-admin.bat\")"
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile(\"https://gist.github.com/ruzickap/7395075/raw/win7-user.bat\", \"c:\win7-user.bat\")"
c:\win7-user.bat
EOF
chmod 644 $PWD/cd/*
genisoimage -v -V AUTOSTART -J -r -o autostart.iso cd/*
sudo umount /mnt/iso
rm -rvf $PWD/cd
rm $ISO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment