Created
July 31, 2018 08:34
-
-
Save ThorstenS-linux/f1df67ff130f7ddc055834563c8149ac to your computer and use it in GitHub Desktop.
integrate preseed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Dieses Script ist von http://wiki.debian.org/DebianInstaller/Preseed/EditIso | |
# Es holt die aktuellen initrd.gz (CD-Version, nicht hd-media). Es entpackt sie | |
# und plaziert die preseed.cfg in das root der initrd. Danach werden sie wieder | |
# zusammengesetzt und unter dem originalen Namen abgespeichert. | |
# | |
# Hintergrund: | |
# In der initrd schaut das Script lib/debian-installer-startup.d/S35initrd-preseed | |
# nach, ob die preseed.cfg existiert und nutzt diese. | |
# XXX | |
# Ob eine per isolinug.cfg übergebene preseed.cfg Vorrang hat oder überhaupt noch | |
# interessant ist, muss noch geprüft werden. | |
# | |
# 2Do | |
# prüfen ob ein neues Logo für die GTK Version vor Ort ist und einbauen | |
# unter ./usr/share/graphics/logo_debian.png | |
# # logo_custom.png: PNG image data, 800 x 75, 8-bit/color RGBA, non-interlaced | |
# | |
# ISO von https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/ | |
# https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current/amd64/iso-cd/firmware-9.5.0-amd64-netinst.iso | |
################################################################################## | |
## Bei einem Fehler abbrechen | |
#set -e | |
#set -x | |
ARCH=amd64 | |
SUITE=stretch | |
#ISO="firmware-6.0.1a-amd64-netinst.iso" | |
ISO="firmware-9.5.0-amd64-netinst.iso" | |
ISOENTPACKT=iso_entpackt | |
#--------------------------------------------------------------------------------- | |
# Zwei Tests | |
if [ `/usr/bin/id -u` != "0" ]; then | |
echo -e "Dieses Script muss als root/per sudo laufen, sonst kann die initrd nicht gebaut werden\n" | |
exit 1 | |
fi | |
if [ ! -f preseed.cfg ] ; then | |
echo -e "Wenn du mir keine preseed.cfg zum Einbauen gibst, ist das sinnlos hier weiterzumachen" | |
exit 1 | |
fi | |
if [ ! -f logo_custom.png ] ; then | |
echo -e "Wenn du mir keine logo_custom.png zum Einbauen gibst, ist das sinnlos hier weiterzumachen" | |
exit 1 | |
fi | |
test -f initrd_org.gz || \ | |
wget http://ftp.debian.org/debian/dists/$SUITE/main/installer-$ARCH/current/images/cdrom/initrd.gz \ | |
-O initrd_org.gz | |
test -f gtk_initrd_org.gz || \ | |
wget http://ftp.debian.org/debian/dists/$SUITE/main/installer-$ARCH/current/images/cdrom/gtk/initrd.gz \ | |
-O gtk_initrd_org.gz | |
echo -e '\nOk, die initrds sind da, bei einer beliebigen Taste gehts los!\n' | |
a=0 | |
read a | |
# Die normale initrd mit der preseed.cfg ausstatten: | |
mkdir -p initrdmod | |
cd initrdmod | |
gzip -d < ../initrd_org.gz | \ | |
cpio --extract --verbose --make-directories --no-absolute-filenames | |
echo -e "\nDateien werden nach initrdmod kopiert - Taste\n" | |
a=0 | |
read a | |
cp ../preseed.cfg preseed.cfg | |
find . | cpio -H newc --create --verbose | \ | |
gzip -9 > ../initrd.gz | |
cd ../ | |
# Die GTK initrd mit der preseed.cfg ausstatten: | |
mkdir -p gtk-initrdmod gtk | |
cd gtk-initrdmod | |
gzip -d < ../gtk_initrd_org.gz | \ | |
cpio --extract --verbose --make-directories --no-absolute-filenames | |
echo -e "\nDateien werden nach gtk-initrdmod kopiert - Taste\n" | |
a=0 | |
read a | |
cp ../preseed.cfg preseed.cfg | |
cp ../logo_custom.png ./usr/share/graphics | |
cd ./usr/share/graphics | |
rm logo_installer.png | |
ln -s logo_custom.png logo_installer.png | |
cd - | |
find . | cpio -H newc --create --verbose | \ | |
gzip -9 > ../gtk/initrd.gz | |
cd ../ | |
rm -fr initrdmod/ | |
rm -fr gtk-initrdmod/ | |
echo -e "\nJetzt wird die CD neu zusammengestellt\n" | |
a=0 | |
read a | |
mkdir -p loop $ISOENTPACKT | |
mount -oloop $ISO loop | |
rsync -av loop/ $ISOENTPACKT/ | |
umount loop | |
cp initrd.gz ./$ISOENTPACKT/install.amd/ | |
cp gtk/initrd.gz ./$ISOENTPACKT/install.amd/gtk/initrd.gz | |
genisoimage -l -r -J -v -V "Debian 9.5 amd64 cust" -input-charset utf-8 -no-emul-boot -boot-load-size 4 \ | |
-boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat -hide-rr-moved \ | |
-o ${ISO%.iso}_cust.iso $ISOENTPACKT | |
echo -e "Fertig. Das Image heißt: ${ISO%.iso}_cust.iso" | |
rm -r iso_entpackt/ gtk initrd.gz | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment