From a884f563f66f82dc0c6e12e2547805c24def3477 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Mon, 15 Aug 2022 02:31:03 +0200 Subject: [PATCH] working scripts --- .gitignore | 2 ++ docker.sh | 8 ++++++++ unattended.sh | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 .gitignore create mode 100755 docker.sh create mode 100755 unattended.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..088b495 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.iso +preseed.cfg diff --git a/docker.sh b/docker.sh new file mode 100755 index 0000000..30ff639 --- /dev/null +++ b/docker.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +apt-get update +apt-get install -y xorriso genisoimage + +cd /root/unattended +genisoimage -r -J -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o $(ls | grep "netinst.iso" | sed 's/netinst/unattended/') isofiles +chown 1000:1000 $(ls | grep "netinst.iso" | sed 's/netinst/unattended/') diff --git a/unattended.sh b/unattended.sh new file mode 100755 index 0000000..55750c5 --- /dev/null +++ b/unattended.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +xorriso -osirrox on -indev debian-11.3.0-amd64-netinst.iso -extract / isofiles +sudo sed -i '/vesamenu.c32/d' isofiles/isolinux/isolinux.cfg +if [[ $(grep timeout_style isofiles/boot/grub/grub.cfg) == "" ]]; then sudo sed -i 's/insmod play/set timeout_style=hidden\nset timeout=0\nset default=1\n\ninsmod play/' isofiles/boot/grub/grub.cfg; fi + +chmod +w -R isofiles/install.amd/ +gunzip isofiles/install.amd/initrd.gz +echo preseed.cfg | cpio -H newc -o -A -F isofiles/install.amd/initrd +gzip isofiles/install.amd/initrd +chmod -w -R isofiles/install.amd/ + +cd isofiles/ +chmod a+w md5sum.txt +md5sum $(find -follow -type f) > md5sum.txt +chmod a-w md5sum.txt +cd .. + +chmod a+w isofiles/isolinux/isolinux.bin +docker run --interactive --tty --rm --volume $(pwd):/root/unattended debian:buster /root/unattended/docker.sh +sudo rm -rf isofiles