[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
"$1" $2 && return
check_vol_slaves "$@" && return 0
- if [[ -f "/sys/dev/block/$2/../dev" ]]; then
+ if [[ -f /sys/dev/block/$2/../dev ]]; then
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
# and a symlink ${initdir}/lib -> lib64.
inst_dir() {
local dir="$1"
- [[ -e "${initdir}$dir" ]] && return 0
+ [[ -e ${initdir}$dir ]] && return 0
# iterate over parent directories
local file=""
local IFS="/"
for part in $dir; do
- [ -z "$part" ] && continue
+ [[ $part ]] || continue
file="$file/$part"
- [[ -e "${initdir}$file" ]] && continue
+ [[ -e ${initdir}$file ]] && continue
- if [ -L "$file" ]; then
+ if [[ -L $file ]]; then
# create link as the original
local target=$(readlink "$file")
ln -sfn "$target" "${initdir}$file" || return 1
# resolve relative path and recursively install destionation
- [[ "$target" = "${target##*/}" ]] && target="${file%/*}/$target"
+ [[ $target = ${target##*/} ]] && target="${file%/*}/$target"
inst_dir "$target"
else
# create directory
inst() {
case $# in
1) ;;
- 2)
- [[ -z $initdir ]] && [[ -d $2 ]] && export initdir=$2
- [[ $initdir = $2 ]] && set $1
- ;;
- 3)
- [[ -z $initdir ]] && export initdir=$2
- set $1 $3
- ;;
- *)
- derror "inst only takes 1 or 2 or 3 arguments"
- exit 1
- ;;
+ 2) [[ ! $initdir && -d $2 ]] && export initdir=$2
+ [[ $initdir = $2 ]] && set $1;;
+ 3) [[ -z $initdir ]] && export initdir=$2
+ set $1 $3;;
+ *) derror "inst only takes 1 or 2 or 3 arguments"
+ exit 1;;
esac
for x in inst_symlink inst_script inst_binary inst_simple; do
$x "$@" && return 0
[[ -x $1/installkernel ]] && return 0
return 1
fi
- [[ -x $1/install ]] || [[ -x $1/installkernel ]] || return 1
+ [[ -x $1/install || -x $1/installkernel ]] || return 1
[[ -x $1/check ]] || return 0
"$1/check" $hostonly || continue
for dep in $("$1/check" -d); do
fi
for modname in $(eval $filtercmd); do
case $modname in
- *.ko)
- "$1" "$modname" && echo "$modname"
- ;;
- *.ko.gz)
- gzip -dc "$modname" > $initdir/$$.ko
- $1 $initdir/$$.ko && echo "$modname"
- rm -f $initdir/$$.ko
- ;;
+ *.ko) "$1" "$modname" && echo "$modname";;
+ *.ko.gz) gzip -dc "$modname" > $initdir/$$.ko
+ $1 $initdir/$$.ko && echo "$modname"
+ rm -f $initdir/$$.ko;;
esac
done
)
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
fi
;;
- --*)
- mod=${mod##*/}
- mpargs+=" $mod";;
- i2o_scsi)
- # Must never run this diagnostic-only module
- shift; continue;
- ;;
- *)
- mod=${mod##*/}
+ --*) mod=${mod##*/}
+ mpargs+=" $mod";;
+ i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
+ *) mod=${mod##*/}
# if we are already installed, skip this module and go on
# to the next one.
[[ -f $initdir/$1 ]] && { shift; continue; }