Advertisement
Monarch73

Create minimal ubuntu installation from scratch

Jul 22nd, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Create minimal ubuntu installation from scratch.
  4. # Prerequisites: ubuntu precise installation, mounted empty fs at /target
  5. #
  6. debootstrap precise /target
  7. cp /etc/resolv.conf /target/etc/resolv.conf
  8. cp /etc/apt/sources.list /target/etc/apt/sources.list
  9. mount --bind /dev /target/dev
  10. cat > /target/chroot.sh  <<EOT
  11.     #!/bin/sh
  12.     mount none -t proc /proc
  13.         mount none -t sysfs /sys
  14.         mount none -t devpts /dev/pts
  15.         export HOME=/root
  16.         export LC_ALL=C
  17.     echo "Please set passwords for root and ubuntu"
  18.     echo "using the passwd command"
  19.     bash -i
  20.     apt-get update
  21.     apt-get install --yes --force-yes linux-image-generic grub2 pump
  22.     apt-get clean
  23.         rm -rf /tmp/*
  24.         rm /etc/resolv.conf
  25.         umount -lf /proc
  26.         umount -lf /sys
  27.         umount -lf /dev/pts
  28. EOT
  29. chmod 755 /target/chroot.sh
  30. chroot /target "/chroot.sh"
  31. umount -lf /target/dev
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement