Monarch73

Cookbooking Ubuntu LiveCD

Jan 25th, 2013
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.51 KB | None | 0 0
  1. #!/bin/bash
  2. DIRNAME=client
  3. mkdir $DIRNAME
  4. # if you don't have your own apt-cacher instance, change the mirror url on the line below
  5. debootstrap precise $DIRNAME http://127.0.0.1:1234/apt-cacher/ubuntu
  6. cp /etc/resolv.conf $DIRNAME/etc/resolv.conf
  7. cp /etc/apt/sources.list $DIRNAME/etc/apt/sources.list
  8. mount --bind /dev $DIRNAME/dev
  9. cat > $DIRNAME/chroot.sh  <<'EOT'
  10.     #!/bin/sh
  11.     mount none -t proc /proc
  12.         mount none -t sysfs /sys
  13.         mount none -t devpts /dev/pts
  14.         export HOME=/root
  15.         export LC_ALL=C
  16.     apt-get update
  17.     apt-get install --yes dbus
  18.     dbus-uuidgen > /var/lib/dbus/machine-id
  19.     dpkg-divert --local --rename --add /sbin/initctl
  20.     ln -s /bin/true /sbin/initctl
  21.     apt-get upgrade --yes --force-yes
  22.     apt-get install --yes --force-yes linux-image-generic openvpn casper lupin-casper discover laptop-detect os-prober iptraf
  23.     apt-get install --yes --force-yes firefox xfdesktop4 open-vm-tools xserver-xorg xserver-xorg-video-all x11vnc rdesktop xinit xterm htop xfonts-100dpi xfonts-75dpi xfs python-software-properties vi
  24.     apt-get install --yes --force-yes --no-install-recommends network-manager
  25.     apt-get clean
  26.     rm  /usr/share/initramfs-tools/scripts/casper-bottom/25configure_init
  27.     rm  /usr/share/initramfs-tools/scripts/casper-bottom/15autologin
  28.     rm  /usr/share/initramfs-tools/scripts/casper-bottom/25adduser
  29.     echo "Please set passwords for root and ubuntu"
  30.     echo "using the passwd command"
  31.     bash -i
  32.     rm /var/lib/dbus/machine-id
  33.     rm /sbin/initctl
  34.     dpkg-divert --rename --remove /sbin/initctl
  35.         rm -rf /tmp/*
  36.         rm /etc/resolv.conf
  37.         umount -lf /proc
  38.         umount -lf /sys
  39.         umount -lf /dev/pts
  40. EOT
  41. chmod 755 $DIRNAME/chroot.sh
  42. chroot $DIRNAME "/chroot.sh"
  43. umount -lf $DIRNAME/dev
  44. rm $DIRNAME/chroot.sh
  45.  
  46. sed '/^exec/d' $DIRNAME/etc/init/tty1.conf >$DIRNAME/etc/init/tty1.conf.tmp
  47. cat >> $DIRNAME/etc/init/tty1.conf <<'EOT'
  48. exec /bin/login -f root </dev/tty1 > /dev/tty1 2>&1
  49. EOT
  50.  
  51. mkdir -p image/$DIRNAME/{casper,isolinux,install}
  52. cp /usr/lib/syslinux/isolinux.bin image/$DIRNAME/isolinux/
  53. cp $DIRNAME/boot/initrd.img* image/$DIRNAME/casper/initrd.img
  54. cp $DIRNAME/boot/vmlinuz-* image/$DIRNAME/casper/vmlinuz
  55. cat > image/$DIRNAME/isolinux/isolinux.cfg <<EOT
  56. DEFAULT live
  57. LABEL live
  58.   menu label ^Start or install Ubuntu Remix
  59.   kernel /casper/vmlinuz
  60.   append boot=casper persistent initrd=/casper/initrd.img nomodeset
  61. EOT
  62.  
  63. touch image/$DIRNAME/ubuntu
  64.  
  65. mkdir image/$DIRNAME/.disk
  66. cd image/$DIRNAME/.disk
  67. touch base_installable
  68. echo "full_cd/single" > cd_type
  69. echo "Ubuntu Remix" > info
  70. echo "http//your-release-notes-url.com" > release_notes_url
  71. cd ../../..
  72. chroot $DIRNAME dpkg-query -W --showformat='${Package} ${Version}\n' | tee image/$DIRNAME/casper/filesystem.manifest
  73. cp -v image/$DIRNAME/casper/filesystem.manifest image/$DIRNAME/casper/filesystem.manifest-desktop
  74. REMOVE='ubiquity ubiquity-frontend-gtk ubiquity-frontend-kde casper lupin-casper live-initramfs user-setup discover1 xresprobe os-prober libdebian-installer4'
  75. for i in $REMOVE
  76. do
  77.         sudo sed -i "/${i}/d" image/$DIRNAME/casper/filesystem.manifest-desktop
  78. done
  79. rm image/$DIRNAME/casper/filesystem.squashfs
  80. mksquashfs $DIRNAME image/$DIRNAME/casper/filesystem.squashfs -e boot
  81. (cd image/$DIRNAME && find . -type f -print0 | xargs -0 md5sum | grep -v "\./md5sum.txt" > md5sum.txt)
  82. cd image/$DIRNAME
  83. mkisofs -r -V "$DIRNAMENAME_boot" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../$DIRNAME.iso .
  84. cd ../..
Add Comment
Please, Sign In to add comment