Advertisement
FDIV-Bug

Ubuntu Core Maker (OUTSIDE) - Alpha 4

Nov 26th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.56 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # DEBUG [OFF]
  4. #DEBUG_N1="> /dev/null"
  5. #DEBUG_N2="&> /dev/null"
  6. #SHOWCOMMAND=""
  7.  
  8. # DEBUG [ON]
  9. DEBUG_N1=""
  10. DEBUG_N2=""
  11. SHOWCOMMAND="set -x"
  12.  
  13. #$SHOWCOMMAND
  14.  
  15. echo -n "Device: "
  16. read DEVICE
  17.  
  18. echo "Creating partitions..."
  19. sleep 1
  20.  
  21. fdisk /dev/$DEVICE <<  EOF $DEBUG_N2
  22. o
  23. n
  24. p
  25. 1
  26. 2048
  27. +100M
  28. n
  29. p
  30. 2
  31. # Do not delete these blank spaces!!!
  32.  
  33.  
  34. # Do not delete these blank space!!!
  35. w
  36. EOF
  37.  
  38. echo "Done!!!"
  39. sleep 1
  40.  
  41. echo "Creating file systems..."
  42. sleep 1
  43.  
  44. mkfs.ext2 -L BOOT /dev/$DEVICE"1" $DEBUG_N2
  45. mkfs.btrfs -L ROOT /dev/$DEVICE"2" $DEBUG_N2
  46.  
  47. echo "Done!!!"
  48. sleep 1
  49.  
  50. echo "Mounting ROOT..."
  51. sleep 1
  52. mkdir /mnt/root
  53. mount -o defaults,compress-force=zlib,noatime -L ROOT /mnt/root
  54. cp INSIDE.sh /mnt/root
  55. mkdir /mnt/root/INSTALL
  56. # STAGING ONLY!!!
  57. # cp ubuntu-core-* /mnt/root/INSTALL
  58. # cp linux-image-* /mnt/root/INSTALL
  59. # STAGING ONLY!!!
  60. cd /mnt/root
  61.  
  62. echo "Done!!!"
  63. sleep 1
  64.  
  65. echo "Downloading rootfs..."
  66. # Ubuntu Core 14.4.1 (amd64)
  67. wget -P ./INSTALL http://cdimage.ubuntu.com/ubuntu-core/releases/14.04/release/ubuntu-core-14.04.1-core-amd64.tar.gz
  68.  
  69. echo "Done!!!"
  70. sleep 1
  71.  
  72. echo "Decompressig ROOT..."
  73. tar -xvzf ./INSTALL/ubuntu-core-* $DEBUG_N1
  74.  
  75. echo "Done!!!"
  76. sleep 1
  77.  
  78. echo "CHROOTING..."
  79. sleep 1
  80. cp /etc/resolv.conf etc
  81. touch etc/fstab
  82. echo "LABEL=BOOT    /boot   ext2    defaults    0 0" > etc/fstab
  83. echo "LABEL=ROOT    /   btrfs   defaults,compress-force=zlib,noatime    1 1" >> etc/fstab
  84. mount -L BOOT boot
  85. mount -o bind /dev dev
  86. mount -o bind /proc proc
  87. mount -o bind /sys sys
  88. cd /
  89. chroot /mnt/root /bin/bash -c "su -c ./INSIDE.sh"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement