debian-unattended/unattended.sh

26 lines
940 B
Bash
Raw Normal View History

2022-08-15 00:31:03 +00:00
#!/usr/bin/env bash
2023-01-28 14:35:35 +00:00
ISONAME=$(ls | grep "netinst.iso" | sort | tail -n1)
2023-01-28 14:45:39 +00:00
rm -f $(echo ${ISONAME} | sed 's/netinst/unattended/')
2023-01-28 14:35:35 +00:00
xorriso -osirrox on -indev ${ISONAME} -extract / isofiles
2022-08-15 00:31:03 +00:00
sudo sed -i '/vesamenu.c32/d' isofiles/isolinux/isolinux.cfg
2022-08-15 00:34:06 +00:00
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
2022-08-15 00:31:03 +00:00
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