--- lsinitramfs.bela-orig 2010-06-30 03:05:01.000000000 -0700 +++ lsinitramfs 2012-10-27 01:41:20.133400610 -0700 @@ -3,4 +3,7 @@ set -eu +# Defaults +CONFDIR="/etc/initramfs-tools" + usage() { @@ -15,5 +18,5 @@ fi cpio_args="--extract --quiet --list" -OPTIONS=`getopt -o hl --long help,long -n "$0" -- "$@"` +OPTIONS=`getopt -o d:hl --long confdir,help,long -n "$0" -- "$@"` # Check for non-GNU getopt if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi @@ -23,4 +26,12 @@ eval set -- "$OPTIONS" while true; do case "$1" in + -d|--confdir) + CONFDIR="$2" + shift 2 + if [ ! -d "${CONFDIR}" ]; then + echo "${0}: ${CONFDIR}: Not a directory" >&2 + exit 1 + fi + ;; -h|--help) usage @@ -41,4 +52,27 @@ while true; do done +. "${CONFDIR}/initramfs.conf" +EXTRA_CONF='' +for i in /usr/share/initramfs-tools/conf.d/* ${CONFDIR}/conf.d/*; do + [ -e $i ] && EXTRA_CONF="${EXTRA_CONF} $(basename $i \ + | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; +done +# FIXME: deprecated those settings on mkinitramfs run +# these conf dirs are for boot scripts and land on initramfs +for i in ${EXTRA_CONF}; do + if [ -e ${CONFDIR}/conf.d/${i} ]; then + . ${CONFDIR}/conf.d/${i} + elif [ -e /usr/share/initramfs-tools/conf.d/${i} ]; then + . /usr/share/initramfs-tools/conf.d/${i} + fi +done + +# source package confs +for i in /usr/share/initramfs-tools/conf-hooks.d/*; do + if [ -e "${i}" ]; then + . "${i}" + fi +done + for initramfs in "$@" ; do if ! [ -r "${initramfs}" ] ; then @@ -47,5 +81,5 @@ for initramfs in "$@" ; do else echo "${initramfs}" - zcat "${initramfs}" | cpio ${cpio_args} + ${COMPRESS:-gzip} -dc "${initramfs}" | cpio ${cpio_args} fi done