Advertisement
gassanpavel

Untitled

Nov 23rd, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #!/bin/bash
  2. set -e
  3.  
  4.  
  5. rm -rf *.iso*
  6. rm -rf iso
  7. # Download ISO Installer:
  8. wget https://releases.ubuntu.com/20.04.1/ubuntu-20.04.1-live-server-amd64.iso
  9.  
  10. # Create ISO distribution dirrectory:
  11. mkdir -p iso/nocloud/
  12.  
  13. # Extract ISO:
  14. 7z x ubuntu-20.04.1-live-server-amd64.iso -x'![BOOT]' -oiso
  15.  
  16. # Create empty meta-data file:
  17. touch iso/nocloud/meta-data
  18.  
  19. # Copy user-data file:
  20. cp user-data iso/nocloud/user-data
  21.  
  22. # Update boot flags with cloud-init autoinstall:
  23. ## Should look similar to this: initrd=/casper/initrd quiet autoinstall ds=nocloud;s=/cdrom/nocloud/ ---
  24. sed -i 's|---|autoinstall ds=nocloud\\\;s=/cdrom/nocloud/ ---|g' iso/boot/grub/grub.cfg
  25. sed -i 's|---|autoinstall ds=nocloud;s=/cdrom/nocloud/ ---|g' iso/isolinux/txt.cfg
  26.  
  27. # Disable mandatory md5 checksum on boot:
  28. md5sum iso/README.diskdefines > iso/md5sum.txt
  29. sed -i 's|iso/|./|g' iso/md5sum.txt
  30.  
  31.  
  32. # Create Install ISO from extracted dir (Ubuntu):
  33. xorriso -as mkisofs -r \
  34. -V Ubuntu\ custom\ amd64 \
  35. -o ubuntu-20.04-live-server-amd64-autoinstall.iso \
  36. -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
  37. -boot-load-size 4 -boot-info-table \
  38. -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \
  39. -isohybrid-gpt-basdat -isohybrid-apm-hfsplus \
  40. -isohybrid-mbr isohdpfx.bin \
  41. iso/boot iso
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement