And if you remove the extension .sh, then it is also backwards
compatible with Debian 4.0 "Etch" :)
# Define your network setup for the InitRAMFS via IP variable
#
# Still a kernel ip parameter will override any InitRAMFS config
# setting (see script /usr/share/initramfs-tools/init).
#
# Additional information:
# * https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
# In Debian as kernel command via /etc/default/grub
# * The "variable" ${hostname} (case-sensitive) will be replaced on InitRAMFS
creation
# with the current host name through the hook `set_hostname_in_network_config`
# This allows the machine to be registered with its name in DNS.
IP=::::${hostname}
#!/bin/sh
#
# This InitRAMFS hook provides:
# Simple script to set IP parameter in InitRAMFS config with current
# hostname, instead of manually maintaining InitRAMFS config.
PREREQ=""
prereqs()
{
echo "${PREREQ}"
}
case "${1}" in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
#
# Begin real processing
#
[ ! -f "${DESTDIR}/conf/initramfs.conf" ] || sed -i -e "s#\${hostname}#$(hostname)#" "${DESTDIR}/conf/initramfs.conf"
[ ! -f "${DESTDIR}/conf/conf.d/network" ] || sed -i -e "s#\${hostname}#$(hostname)#" "${DESTDIR}/conf/conf.d/network"