Created
December 18, 2013 13:52
-
-
Save pefoley2/8022705 to your computer and use it in GitHub Desktop.
usb bootable script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIRROR="distfiles.gentoo.org" | |
ISO=`wget -q -O - http://$MIRROR/releases/amd64/autobuilds/latest-iso.txt | grep -v \# | sed "s#/.*##"` | |
wget -N http://$MIRROR/releases/amd64/autobuilds/$ISO/install-amd64-minimal-$ISO.iso | |
7z e -y install-amd64-minimal-$ISO.iso image.squashfs isolinux/gentoo isolinux/gentoo.igz | |
read -p "Enter block device to format (blank to skip): " DEV | |
if ! test -z $DEV; then | |
[ `id -u` != 0 ] && echo "must be root" && exit | |
dd if=/dev/zero of=/dev/$DEV bs=512 count=1 | |
parted /dev/$DEV mklabel msdos | |
parted /dev/$DEV mkpart primary 0% 100% | |
parted /dev/$DEV set 1 boot on | |
sfdisk -c /dev/$DEV 1 6 | |
mkdosfs -F 16 /dev/"$DEV"1 | |
dd if=/usr/share/syslinux/mbr.bin of=/dev/$DEV | |
mkdir -p usb | |
mount /dev/"$DEV"1 usb | |
cp image.squashfs gentoo gentoo.igz usb | |
echo ' | |
default gentoo | |
label gentoo | |
kernel gentoo | |
append root=/dev/ram0 initrd=gentoo.igz loop=image.squashfs cdroot | |
' > usb/syslinux.cfg | |
touch usb/livecd | |
umount usb | |
syslinux /dev/"$DEV"1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment