tftpboot/scripts/make_debian_initrd_with_fir...

68 lines
2.2 KiB
Bash
Raw Normal View History

2014-09-08 09:49:55 +02:00
#!/bin/bash
# This script do the following:
# Download Debian Initrd for Stretch, Buster, Jessie, Wheezy and Sid
2014-09-08 09:49:55 +02:00
# Download firmwares:
# bnx2
# all non-free (for tigon)
# Extract all downloaded files
2016-07-06 14:56:01 +02:00
# Make a new initrd with the previous firmwares
2014-09-08 09:49:55 +02:00
if command -v in.tftpd > /dev/null; then
source /etc/default/tftpd-hpa
else
TFTP_DIRECTORY="/srv/tftp"
fi
for DISTRO in stretch buster jessie wheezy sid; do # For ALL Debian's version
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
TEMP_DIR=$(mktemp -d)
pushd "${TEMP_DIR}"
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
# Download and uncompress original initrd
wget http://ftp.fr.debian.org/debian/dists/${DISTRO}/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
mkdir "${TEMP_DIR}"/mkinitrd
pushd "${TEMP_DIR}"/mkinitrd/
zcat ../initrd.gz | cpio -iv
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
popd
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
# Download bnx2's firmware and uncompress it
wget http://ftp.fr.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_0.43_all.deb
dpkg-deb -x firmware-bnx2_0.43_all.deb "${TEMP_DIR}"/mkinitrd
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
# Download tigon(all non-free)'s firmware and uncompress it
wget http://ftp.fr.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-linux-nonfree_0.43_all.deb
dpkg-deb -x firmware-linux-nonfree_0.43_all.deb "${TEMP_DIR}"/mkinitrd
2014-09-08 09:49:55 +02:00
# Download myricom for IBM
wget http://ftp.fr.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-myricom_0.43_all.deb
dpkg-deb -x firmware-myricom_0.43_all.deb "${TEMP_DIR}"/mkinitrd
# Download qlogic
wget http://ftp.fr.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-qlogic_0.43_all.deb
dpkg-deb -x firmware-qlogic_0.43_all.deb "${TEMP_DIR}"/mkinitrd
# Download iwlwifi
wget http://ftp.fr.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-iwlwifi_20170823-1_all.deb -O firmware-iwlwifi_all.deb
dpkg-deb -x firmware-iwlwifi_all.deb "${TEMP_DIR}"/mkinitrd
2016-07-06 14:56:01 +02:00
# Make a new initrd
mv initrd.gz initrd_orig.gz
pushd "${TEMP_DIR}"/mkinitrd/
find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd.gz
popd
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
# Move it to PXE Debian installer
mkdir -p ${TFTP_DIRECTORY}/installer/debian/${DISTRO}/amd64/
mv initrd.gz ${TFTP_DIRECTORY}/installer/debian/${DISTRO}/amd64/initrd_firm.gz
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
popd
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
# Clean temp file
rm -rf "${TEMP_DIR}"
done
2014-09-08 09:49:55 +02:00
2016-07-06 14:56:01 +02:00
exit 0