Advertisement
Monarch73

cookbooking raspbian jessie installation cd

Dec 27th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.92 KB | None | 0 0
  1. #!/bin/bash
  2. DIRNAME=greenhouse
  3. mkdir $DIRNAME
  4. # if you don't have your own apt-cacher instance, change the mirror url on the line below
  5. debootstrap --include=ca-certificates wily $DIRNAME http://archive.ubuntu.com/ubuntu
  6. cp /etc/resolv.conf $DIRNAME/etc/resolv.conf
  7. cp /etc/apt/sources.list $DIRNAME/etc/apt/sources.list
  8. cat > /tmp/cookbook.b64 <<'EOT6'
  9. IyEvYmluL3NoCmNkIC9tbnQKY2F0ID4+L3Vzci9zaGFyZS9iaW5mbXRzL3FlbXUtYXJtIDw8J0VP
  10. VDk5JwpwYWNrYWdlIHFlbXUtdXNlci1zdGF0aWMKaW50ZXJwcmV0ZXIgL3Vzci9iaW4vcWVtdS1h
  11. cm0tc3RhdGljCm1hZ2ljIFx4N2ZceDQ1XHg0Y1x4NDZceDAxXHgwMVx4MDFceDAwXHgwMFx4MDBc
  12. eDAwXHgwMFx4MDBceDAwXHgwMFx4MDBceDAyXHgwMFx4MjhceDAwCm1hc2sgXHhmZlx4ZmZceGZm
  13. XHhmZlx4ZmZceGZmXHhmZlx4MDBceGZmXHhmZlx4ZmZceGZmXHhmZlx4ZmZceGZmXHhmZlx4ZmVc
  14. eGZmXHhmZlx4ZmYKRU9UOTkKY2F0ID4+L3Vzci9zaGFyZS9iaW5mbXRzL3FlbXUtYXJtZWIgPDwn
  15. RU9UMTAwJwpwYWNrYWdlIHFlbXUtdXNlci1zdGF0aWMKaW50ZXJwcmV0ZXIgL3Vzci9iaW4vcWVt
  16. dS1hcm1lYi1zdGF0aWMKbWFnaWMgXHg3Zlx4NDVceDRjXHg0Nlx4MDFceDAyXHgwMVx4MDBceDAw
  17. XHgwMFx4MDBceDAwXHgwMFx4MDBceDAwXHgwMFx4MDBceDAyXHgwMFx4MjgKbWFzayBceGZmXHhm
  18.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sZXMga2V5Ym9hcmQtY29uZmln
  45. dXJhdGlvbiBiYXNoIHZpbSBvcGVuc3NoLXNlcnZlcgoJZHBrZy1yZWNvbmZpZ3VyZSBsb2NhbGVz
  46. CglkcGtnLXJlY29uZmlndXJlIGtleWJvYXJkLWNvbmZpZ3VyYXRpb24KCWRwa2ctcmVjb25maWd1
  47. cmUgdHpkYXRhCgllY2hvIENoZWNrIGZzdGFiLCBpbnRlcmZhY2VzIGFuZCBzcGVjaWZ5IGEgcm9v
  48. dC1wYXNzd29yZCB1c2luZyBwYXNzd2QuCgllY2hvIEFkZCBwYWNrYWdhZ2VzIGFzIHlvdSBsaWtl
  49. LCB0aGVuIHR5cGUgJ2V4aXQnIHRvIGZpbmFsaXNlIGluc3RhbGxhdGlvbi4KCWJhc2ggLWkKRU9U
  50. MwpjaG1vZCA3NTUgcm9vdGZzL2Nocm9vdC5zaApjaHJvb3Qgcm9vdGZzLyAvY2hyb290LnNoCnVt
  51. b3VudCAtbGYgcm9vdGZzL3Byb2MKdW1vdW50IC1sZiByb290ZnMvc3lzCnVtb3VudCAtbGYgcm9v
  52. dGZzL2Rldi9wdHMKdW1vdW50IC1sZiByb290ZnMvZGV2Cg==
  53. EOT6
  54. base64 -d </tmp/cookbook.b64 >$DIRNAME/mnt/cookbook.sh
  55. mount --bind /dev $DIRNAME/dev
  56. cat > $DIRNAME/chroot.sh  <<'EOT'
  57.         #!/bin/sh
  58.         mount none -t proc /proc
  59.         mount none -t sysfs /sys
  60.         mount none -t devpts /dev/pts
  61.         export HOME=/root
  62.         export LC_ALL=C
  63.         apt-get update
  64.         apt-get install --yes dbus
  65.     dbus-uuidgen > /var/lib/dbus/machine-id
  66.     dpkg-divert --local --rename --add /sbin/initctl
  67.     ln -s /bin/true /sbin/initctl
  68.         apt-get upgrade --yes --force-yes
  69.         apt-get install --yes --force-yes linux-image-generic casper lupin-casper discover laptop-detect os-prober iptraf htop vim qemu-user-static binfmt-support fakeroot debootstrap git unzip wireless-tools firefox xfdesktop4 open-vm-tools xserver-xorg xserver-xorg-video-all x11vnc rdesktop xinit xterm htop xfonts-100dpi xfonts-75dpi python-software-properties nano gnome-terminal xfwm4 wicd
  70.         apt-get clean
  71.         rm  /usr/share/initramfs-tools/scripts/casper-bottom/25configure_init
  72.         rm  /usr/share/initramfs-tools/scripts/casper-bottom/15autologin
  73.         rm  /usr/share/initramfs-tools/scripts/casper-bottom/25adduser
  74.         echo "Please set passwords for root and ubuntu"
  75.         echo "using the passwd command"
  76.         bash -i
  77.         rm /var/lib/dbus/machine-id
  78.         rm /sbin/initctl
  79.     dpkg-divert --rename --remove /sbin/initctl
  80.         rm -rf /tmp/*
  81. #       rm /etc/resolv.conf
  82.         umount -lf /proc
  83.         umount -lf /sys
  84.         umount -lf /dev/pts
  85. EOT
  86. chmod 755 $DIRNAME/mnt/cookbook.sh
  87. mkdir -p $DIRNAME/mnt/rootfs
  88. mkdir -p $DIRNAME/mnt/bootfs
  89. chmod 755 $DIRNAME/chroot.sh
  90. chroot $DIRNAME "/chroot.sh"
  91. umount -lf $DIRNAME/proc
  92. umount -lf $DIRNAME/sys
  93. umount -lf $DIRNAME/dev/pts
  94. umount -lf $DIRNAME/dev
  95. #rm $DIRNAME/chroot.sh
  96.  
  97. rm $DIRNAME/etc/resolv.conf
  98. chroot $DIRNAME ln -s /var/run/resolvconf/resolv.conf /etc/resolv.conf
  99.  
  100. cat >> $DIRNAME/etc/wpa_supplicant/wpa_supplicant.conf <<'EOT11'
  101. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  102. update_config=1
  103. EOT11
  104.  
  105. #cat >> /tmp/shortcut << 'EOT7'
  106. #W0Rlc2t0b3AgRW50cnldClZlcnNpb249MS4wClR5cGU9QXBwbGljYXRpb24KTmFtZT13aWZpCkNv
  107. #bW1lbnQ9CkV4ZWM9d2ljZC1ndGsKSWNvbj1nY3Ita2V5ClBhdGg9L3Jvb3QKVGVybWluYWw9ZmFs
  108. #c2UKU3RhcnR1cE5vdGlmeT1mYWxzZQo=
  109. #EOT7
  110.  
  111. #mkdir -p $DIRNAME/root/Desktop
  112. #base64 -d </tmp/shortcut >$DIRNAME/root/Desktop/wifi.desktop
  113.  
  114. cp $DIRNAME/etc/dhcp/dhclient.conf $DIRNAME/etc/dhcp/dhclient.conf.bkup
  115. sed 's/#require/require/' $DIRNAME/etc/dhcp/dhclient.conf.bkup > $DIRNAME/etc/dhcp/dhclient.conf
  116.  
  117. cat >> $DIRNAME/root/.xinitrc <<'EOT8'
  118. xfwm4&
  119. xfdesktop
  120. EOT8
  121.  
  122. mkdir -p image/$DIRNAME/{casper,isolinux,install}
  123. cp /usr/lib/ISOLINUX/isolinux.bin image/$DIRNAME/isolinux/
  124. cp /usr/lib/syslinux/modules/bios/ldlinux.c32 image/$DIRNAME/isolinux/
  125. cp $DIRNAME/boot/initrd.img* image/$DIRNAME/casper/initrd.img
  126. cp $DIRNAME/boot/vmlinuz-* image/$DIRNAME/casper/vmlinuz
  127. cat > image/$DIRNAME/isolinux/isolinux.cfg <<EOT
  128. DEFAULT live
  129. LABEL live
  130.   menu label ^Start or install Ubuntu Remix
  131.   kernel /casper/vmlinuz
  132.   append boot=casper persistent initrd=/casper/initrd.img nomodeset
  133. EOT
  134.  
  135. touch image/$DIRNAME/ubuntu
  136.  
  137. mkdir image/$DIRNAME/.disk
  138. cd image/$DIRNAME/.disk
  139. touch base_installable
  140. echo "full_cd/single" > cd_type
  141. echo "Ubuntu Remix" > info
  142. echo "http//your-release-notes-url.com" > release_notes_url
  143. cd ../../..
  144. chroot $DIRNAME dpkg-query -W --showformat='${Package} ${Version}\n' | tee image/$DIRNAME/casper/filesystem.manifest
  145. cp -v image/$DIRNAME/casper/filesystem.manifest image/$DIRNAME/casper/filesystem.manifest-desktop
  146. REMOVE='ubiquity ubiquity-frontend-gtk ubiquity-frontend-kde casper lupin-casper live-initramfs user-setup discover1 xresprobe os-prober libdebian-installer4'
  147. for i in $REMOVE
  148. do
  149.         sudo sed -i "/${i}/d" image/$DIRNAME/casper/filesystem.manifest-desktop
  150. done
  151. rm image/$DIRNAME/casper/filesystem.squashfs
  152. mksquashfs $DIRNAME image/$DIRNAME/casper/filesystem.squashfs -e boot
  153. (cd image/$DIRNAME && find . -type f -print0 | xargs -0 md5sum | grep -v "\./md5sum.txt" > md5sum.txt)
  154. cd image/$DIRNAME
  155. 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 .
  156. cd ../..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement