Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. #!/bin/bash
  2. # set the date to anything except 1/1/1970 since this causes issues
  3. # time is now also set after first boot by .bashrc script below
  4. date -s 1/1/2009
  5. # if /dev/sda is mounted then paritions get wiped by dd but sfdisk fails!
  6. swapoff /dev/sda1
  7. umount /mnt/debian
  8. # partition and mkfs hdd (all data is lost!)
  9. dd if=/dev/zero of=/dev/sda bs=512 count=1
  10. sfdisk /dev/sda << EOF
  11. ,124,S
  12. ,,L
  13. EOF
  14. dd if=/dev/zero of=/dev/sda2 bs=512 count=1
  15. mkfs.ext3 /dev/sda2
  16. mkswap /dev/sda1
  17. sync; sync; sync
  18. swapon /dev/sda1
  19. # setup paths
  20. mkdir /mnt/debian
  21. mount /dev/sda2 /mnt/debian
  22. cd /mnt/debian
  23. mkdir /mnt/debian/work
  24. cd /mnt/debian/work
  25. # download extract and run debootstrap
  26. wget http://ftp.fit.vutbr.cz/pub/systems/ubuntu/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.38_all.deb
  27. ar -xf debootstrap_1.0.38_all.deb
  28. cd /mnt/debian
  29. zcat < /mnt/debian/work/data.tar.gz | tar xv
  30. export DEBOOTSTRAP_DIR=/mnt/debian/usr/share/debootstrap
  31. export PATH=$PATH:/mnt/debian/usr/sbin
  32. debootstrap --arch powerpc squeeze /mnt/debian http://archive.debian.org/debian/
  33. # create needed files on hdd
  34. echo Xenon > /mnt/debian/etc/hostname
  35. cat > /mnt/debian/etc/fstab << EOF
  36. /dev/sda2 / ext3 defaults 0 0
  37. /dev/sda1 none swap sw 0 0
  38. proc /proc proc defaults 0 0
  39. EOF
  40. cat > /mnt/debian/etc/network/interfaces << EOF
  41. iface lo inet loopback
  42. auto lo
  43. auto eth0
  44. iface eth0 inet dhcp
  45. EOF
  46. cat > /mnt/debian/etc/apt/sources.list << EOF
  47. deb http://archive.debian.org/debian squeeze main contrib non-free
  48. EOF
  49. #Change root-pwd to "xbox" inside chroot
  50. chroot /mnt/debian echo "root:xbox" | chroot /mnt/debian /usr/sbin/chpasswd
  51. # Add user: xbox with password: xbox
  52. chroot /mnt/debian /usr/sbin/useradd -m -d /home/xbox -p paRRy2CC47LXY xbox
  53. # create .second_stage script on hdd
  54. cat >> /mnt/debian/root/.second_stage << EOF
  55. #!/bin/bash
  56. date -s 1/1/2009
  57. apt-get update
  58. apt-get install ntp wget openssh-server locales -y --force-yes
  59. dpkg-reconfigure locales
  60. apt-get install gnome -y
  61. echo "AVAHI_DAEMON_START=0" > /etc/default/avahi-daemon
  62. /etc/init.d/networking restart
  63. cd /usr/lib/xorg/modules/drivers/
  64. wget -O xenosfb_drv.so http://file.libxenon.org/free60/linux/xenosfb/xenosfb_drv.so_squeeze
  65. cd /etc/X11/
  66. wget http://file.libxenon.org/free60/linux/xenosfb/xorg.conf
  67. rm -r -f /work/
  68. echo "Installation completed."
  69. echo "To boot the system: Reboot and load the kernel with correct root= params."
  70. echo "You should be greeted by a fresh install of Debian 6 Squeeze"
  71. EOF
  72. chmod a+x /mnt/debian/root/.second_stage
  73. # Execute second part of installation in the chroot environment
  74. mount -t proc none /mnt/debian/proc
  75. mount --rbind /dev /mnt/debian/dev
  76. cp -L /etc/resolv.conf /mnt/debian/etc/resolv.conf
  77. chroot /mnt/debian /root/.second_stage
  78. umount /mnt/debian/dev /mnt/debian/proc /mnt/debian
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement