#!/bin/bash # This script do the following: # Download Debian Initrd for Buster, Bullseye, Stretch, Jessie and Sid # Download firmwares: # bnx2 # all non-free (for tigon) # Myricom for IBM # qlogic # iwlwifi (Intel WiFi for user's laptop) # Extract all downloaded files # Make a new initrd with the previous firmwares with XZ format if command -v in.tftpd > /dev/null; then source /etc/default/tftpd-hpa else TFTP_DIRECTORY="/srv/tftp" fi for DISTRO in bullseye buster stretch sid; do # For ALL Debian's version TEMP_DIR=$(mktemp -d) pushd "${TEMP_DIR}" > /dev/null # Download and uncompress original initrd #wget http://deb.debian.org/debian/dists/${DISTRO}/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz wget --quiet http://deb.debian.org/debian/dists/${DISTRO}/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz mkdir "${TEMP_DIR}"/mkinitrd pushd "${TEMP_DIR}"/mkinitrd/ > /dev/null zcat ../initrd.gz | cpio -iv popd > /dev/null # Download bnx2's firmware and uncompress it #wget http://deb.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_0.43_all.deb wget --quiet http://deb.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 # Download tigon(all non-free)'s firmware and uncompress it #wget http://deb.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-linux-nonfree_0.43_all.deb wget --quiet http://deb.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 # Download myricom for IBM #wget http://deb.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-myricom_0.43_all.deb wget --quiet http://deb.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://deb.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-qlogic_0.43_all.deb wget --quiet http://deb.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 --quiet http://deb.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-iwlwifi_20210315-2_all.deb -O firmware-iwlwifi_all.deb wget --quiet http://ftp.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-iwlwifi_20210818-1_all.deb -O firmware-iwlwifi_all.deb dpkg-deb -x firmware-iwlwifi_all.deb "${TEMP_DIR}"/mkinitrd # Make a new initrd mv initrd.gz initrd_orig.gz pushd "${TEMP_DIR}"/mkinitrd/ > /dev/null find . | cpio --quiet -o -H newc | xz -c -9 --check=crc32 > ../initrd.xz popd > /dev/null # Move it to PXE Debian installer mkdir -p ${TFTP_DIRECTORY}/installer/debian/${DISTRO}/amd64/ mv initrd.xz ${TFTP_DIRECTORY}/installer/debian/${DISTRO}/amd64/initrd_firm.xz popd > /dev/null # Clean temp file rm -rf "${TEMP_DIR}" done exit 0