#!/bin/sh initrd=${samizdat_isolinux_dir}/linux/initrd.img vmlinuz=${samizdat_isolinux_dir}/linux/vmlinuz version=$(uname -r) version=4.5.0-0.bpo.1-amd64 conf_dir=initramfs-tools apt_dependencies=initrd-dependencies.txt find_source_dirs() { set -- find "$conf_dir" ./old-school "$@" "$@" } force_rebuild() { touch "$conf_dir" return 1 } rebuild() { [ ! -f "$apt_dependencies" ] || sudo apt-get install -q=10 --no-upgrade -y $(cat "$apt_dependencies") set -ex cp -f /boot/vmlinuz-${version} "$vmlinuz" /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" ${version} || force_rebuild } if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then rebuild elif [ "$(find_source_dirs -newer "$initrd" -print -quit)" ]; then rebuild fi