diff options
author | maximilian attems <maks@debian.org> | 2010-04-07 07:24:19 +0200 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2010-04-07 07:25:06 +0200 |
commit | f9db3f7bcbad79bdb1817aa53eb27a46b5951381 (patch) | |
tree | bfb5566f427fa5c4e0272fc761c869076d43a335 | |
parent | 17b4d500164f285273c353c55e86850dd8a5998c (diff) | |
download | initramfs-tools-f9db3f7bcbad79bdb1817aa53eb27a46b5951381.tar.gz initramfs-tools-f9db3f7bcbad79bdb1817aa53eb27a46b5951381.zip |
mkinitramfs: Fix several unbound variables
might not be all, but a first go in stricter mkinitramfs.
as bonus remove old amusing unused varialbe from day 2..
Signed-off-by: maximilian attems <maks@debian.org>
-rw-r--r-- | hook-functions | 14 | ||||
-rwxr-xr-x | mkinitramfs | 7 | ||||
-rw-r--r-- | scripts/functions | 4 |
3 files changed, 12 insertions, 13 deletions
diff --git a/hook-functions b/hook-functions index 5f00f17..76cbba9 100644 --- a/hook-functions +++ b/hook-functions @@ -175,10 +175,10 @@ copy_modules_dir() fi fi while [ $# -ge 1 ]; do - exclude="$exclude -name $1 -prune -o " + exclude="${exclude:-} -name $1 -prune -o " shift done - for x_mod in $(find "${MODULESDIR}/${dir}" ${exclude} -name '*.ko' -print); do + for x_mod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko' -print); do manual_add_modules $(basename ${x_mod} .ko) done } @@ -367,7 +367,7 @@ dep_add_modules() # The modules "most" classes added per default to the initramfs auto_add_modules() { - case "$1" in + case "${1:-}" in base) for x in ehci-hcd ohci-hcd uhci-hcd usbhid btrfs ext2 \ ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs af_packet \ @@ -479,10 +479,10 @@ check_minkver() { local curversion initdir DPKG_ARCH minversion cm_x tmp - curversion="${1}" - initdir="${2}" + curversion="${1:-}" + initdir="${2:-}" if [ -z "${initdir}" ]; then - case ${DPKG_ARCH} in + case ${DPKG_ARCH:-} in ia64|hppa) minversion="2.6.15" ;; @@ -498,7 +498,7 @@ check_minkver() return 0 fi set_initlist - for cm_x in ${initlist}; do + for cm_x in ${initlist:-}; do # sed: keep last line starting with MINKVER=, # remove MINKVER= and trailing space minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}") diff --git a/mkinitramfs b/mkinitramfs index be983cf..045e73d 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -7,7 +7,6 @@ export PATH='/usr/bin:/sbin:/bin' keep="n" CONFDIR="/etc/initramfs-tools" verbose="n" -errors_to="2>/dev/null" # BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" export BUSYBOXDIR="/bin" @@ -86,7 +85,7 @@ for i in /usr/share/initramfs-tools/conf-hooks.d/*; do fi done -if [ -n "${UMASK}" ]; then +if [ -n "${UMASK:-}" ]; then umask "${UMASK}" fi @@ -128,7 +127,7 @@ case "${version}" in esac # Check userspace and kernel support for compressed initramfs images -if [ -z "${compress}" ]; then +if [ -z "${compress:-}" ]; then compress=${COMPRESS} else COMPRESS=${compress} @@ -252,7 +251,7 @@ for i in ${EXTRA_CONF}; do done # ROOT hardcoding -if [ -n "${ROOT}" ]; then +if [ -n "${ROOT:-}" ]; then echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root fi diff --git a/scripts/functions b/scripts/functions index 7b68255..ec8a44b 100644 --- a/scripts/functions +++ b/scripts/functions @@ -189,7 +189,7 @@ reduce_prereqs() get_prereq_pairs() { set_initlist - for gp_x in ${initlist}; do + for gp_x in ${initlist:-}; do echo ${gp_x} ${gp_x} prereqs=$(${initdir}/${gp_x} prereqs) for prereq in ${prereqs}; do @@ -223,7 +223,7 @@ run_scripts() . ${initdir}/ORDER elif command -v tsort >/dev/null 2>&1; then runlist=$(get_prereq_pairs | tsort) - call_scripts $2 + call_scripts ${2:-} else get_prereqs reduce_prereqs |