Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # DEBUG [OFF]
- #DEBUG_N1="> /dev/null"
- #DEBUG_N2="&> /dev/null"
- #SHOWCOMMAND=""
- # DEBUG [ON]
- DEBUG_N1=""
- DEBUG_N2=""
- SHOWCOMMAND="set -x"
- #$SHOWCOMMAND
- echo -n "Device: "
- read DEVICE
- echo "Creating partitions..."
- sleep 1
- fdisk /dev/$DEVICE << EOF $DEBUG_N2
- o
- n
- p
- 1
- 2048
- +100M
- n
- p
- 2
- # Do not delete these blank spaces!!!
- # Do not delete these blank space!!!
- w
- EOF
- echo "Done!!!"
- sleep 1
- echo "Creating file systems..."
- sleep 1
- mkfs.ext2 -L BOOT /dev/$DEVICE"1" $DEBUG_N2
- mkfs.btrfs -L ROOT /dev/$DEVICE"2" $DEBUG_N2
- echo "Done!!!"
- sleep 1
- echo "Mounting ROOT..."
- sleep 1
- mkdir /mnt/root
- mount -o defaults,compress-force=zlib,noatime -L ROOT /mnt/root
- cp INSIDE.sh /mnt/root
- mkdir /mnt/root/INSTALL
- # STAGING ONLY!!!
- # cp ubuntu-core-* /mnt/root/INSTALL
- # cp linux-image-* /mnt/root/INSTALL
- # STAGING ONLY!!!
- cd /mnt/root
- echo "Done!!!"
- sleep 1
- echo "Downloading rootfs..."
- # Ubuntu Core 14.4.1 (amd64)
- wget -P ./INSTALL http://cdimage.ubuntu.com/ubuntu-core/releases/14.04/release/ubuntu-core-14.04.1-core-amd64.tar.gz
- echo "Done!!!"
- sleep 1
- echo "Decompressig ROOT..."
- tar -xvzf ./INSTALL/ubuntu-core-* $DEBUG_N1
- echo "Done!!!"
- sleep 1
- echo "CHROOTING..."
- sleep 1
- cp /etc/resolv.conf etc
- touch etc/fstab
- echo "LABEL=BOOT /boot ext2 defaults 0 0" > etc/fstab
- echo "LABEL=ROOT / btrfs defaults,compress-force=zlib,noatime 1 1" >> etc/fstab
- mount -L BOOT boot
- mount -o bind /dev dev
- mount -o bind /proc proc
- mount -o bind /sys sys
- cd /
- chroot /mnt/root /bin/bash -c "su -c ./INSIDE.sh"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement