summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functions22
-rw-r--r--hooks/modload4
-rw-r--r--hooks/raid2
-rw-r--r--init22
-rw-r--r--install/autodetect10
-rw-r--r--install/base6
-rw-r--r--install/firmware8
-rwxr-xr-xmkinitcpio30
8 files changed, 51 insertions, 53 deletions
diff --git a/functions b/functions
index e124303..ce8a544 100644
--- a/functions
+++ b/functions
@@ -3,7 +3,7 @@ auto_modules ()
{
aliases=$(find /sys/devices/ -name modalias -exec cat {} \;)
mods=$(/sbin/modprobe --set-version ${KERNELVERSION} --show-depends -a \
- $aliases 2>/dev/null | sed 's|insmod \(.*\)|\1|' | grep ${@} | sort -u)
+ ${aliases} 2>/dev/null | sed 's|insmod \(.*\)|\1|' | grep $@ | sort -u)
echo "${mods}"
[ -z "${mods}" ] && return 1
@@ -12,7 +12,7 @@ auto_modules ()
all_modules ()
{
- mods=$(find ${MODULEDIR} -name *.ko 2>/dev/null | grep ${@} | sort -u)
+ mods=$(find ${MODULEDIR} -name *.ko 2>/dev/null | grep $@ | sort -u)
echo "${mods}"
[ -z "${mods}" ] && return 1
@@ -22,7 +22,7 @@ all_modules ()
checked_modules ()
{
if [ -e "${MODULE_FILE}" ]; then
- for mod in $(all_modules ${@}); do
+ for mod in $(all_modules $@); do
if grep "^$(basename ${mod%%\.ko})$" "${MODULE_FILE}" >/dev/null 2>&1; then
echo ${mod}
fi
@@ -33,9 +33,9 @@ checked_modules ()
fi
}
-msg () { [ "${QUIET}" = "n" ] && echo ${@}; }
-err () { echo "ERROR: ${@}" >&2; }
-die () { echo "FATAL: ${@}" >&2; cleanup; exit 1; }
+msg () { [ "${QUIET}" = "n" ] && echo $}; }
+err () { echo "ERROR: $@" >&2; }
+die () { echo "FATAL: $@" >&2; cleanup; exit 1; }
add_full_dir ()
{
@@ -155,7 +155,7 @@ add_module ()
HAS_MODULES="y"
add_file "${path}" && found=1
done
- if [ $found -eq 0 ]; then
+ if [ ${found} -eq 0 ]; then
err "module '$fil' not found"
fi
}
@@ -170,7 +170,7 @@ add_binary ()
dest=""
if [ $# -eq 2 ]; then
- dest=$2
+ dest=${2}
fi
if [ ! -f "${bin}" ]; then
@@ -209,19 +209,19 @@ add_binary ()
parse_hook ()
{
local mod bin fil
- for mod in $MODULES; do
+ for mod in ${MODULES}; do
if [ -n "${mod}" ]; then
add_module "${mod}"
fi
done
- for bin in $BINARIES; do
+ for bin in ${BINARIES}; do
if [ -n "${bin}" ]; then
add_binary "${bin}"
fi
done
- for fil in $FILES; do
+ for fil in ${FILES}; do
if [ -n "${fil}" ]; then
add_file "${fil}"
fi
diff --git a/hooks/modload b/hooks/modload
index 41361c1..8bb9d1d 100644
--- a/hooks/modload
+++ b/hooks/modload
@@ -19,13 +19,13 @@ run_hook ()
for d in /sys/bus/scsi/devices/*; do
if [ -e "${d}/type" ]; then
read m < "${d}/type"
- case "$m" in
+ case "${m}" in
0) /sbin/modprobe -q sd_mod 2>&1 >/dev/null ;;
# this below is take from the Arch udev rules
1) read vendor < "${d}/vendor"
if [ "${vendor}" = "Onstream" ]; then
read model < "${d}/model"
- case "$model" in
+ case "${model}" in
ADR*) /sbin/modprobe -q st >/dev/null 2>&1;;
*) /sbin/modprobe -q osst >/dev/null 2>&1;;
esac
diff --git a/hooks/raid b/hooks/raid
index 8128cff..cd1a920 100644
--- a/hooks/raid
+++ b/hooks/raid
@@ -2,7 +2,7 @@
run_hook ()
{
#TODO scan for these somehow...
- /sbin/modprobe -aq linear multipath raid0 raid1 raid456 raid10>/dev/null 2>&1
+ /sbin/modprobe -aq linear multipath raid0 raid1 raid456 raid10 >/dev/null 2>&1
# md= can be specified multiple times. The simplistic commandline
# parsing does not handle this, so we will let mdassemble parse it
/bin/mdassemble ${CMDLINE}
diff --git a/init b/init
index 11b9aa7..3706391 100644
--- a/init
+++ b/init
@@ -16,10 +16,10 @@ export kinit_params=""
export root=""
echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
-for cmd in $CMDLINE; do
- case "$cmd" in
+for cmd in ${CMDLINE}; do
+ case "${cmd}" in
\#*) break ;; # ignore everything after a # in the commandline
- [0123456Ss]) export runlevel="$cmd" ;;
+ [0123456Ss]) export runlevel="${cmd}" ;;
single) export runlevel="S" ;; #some people use 'single'
#Allow "init=X" to pass-through
init=*) kinit_params="${kinit_params} ${cmd}" ;;
@@ -49,28 +49,28 @@ fi
if [ -n "${earlymodules}" ]; then
for m in $(replace "${earlymodules}" ','); do
- /sbin/modprobe -q $m > /dev/null 2>&1
+ /sbin/modprobe -q ${m} > /dev/null 2>&1
done
fi
. /config
-for m in $MODULES; do
+for m in ${MODULES}; do
TST=""
eval "TST=\$mod_${m}"
if [ "${TST}" != "disabled" ]; then
- /sbin/modprobe -q $m > /dev/null 2>&1
+ /sbin/modprobe -q ${m} > /dev/null 2>&1
fi
done
if [ -e "/hooks" ]; then
- for h in $HOOKS; do
+ for h in ${HOOKS}; do
TST=""
eval "TST=\$hook_${h}"
if [ "${TST}" != "disabled" ]; then
- run_hook () { msg "$h: no run function defined"; }
- if [ -e "/hooks/$h" ]; then
- . /hooks/$h
+ run_hook () { msg "${h}: no run function defined"; }
+ if [ -e "/hooks/${h}" ]; then
+ . /hooks/${h}
msg ":: Running Hook [${h}]"
run_hook
fi
@@ -129,7 +129,7 @@ fi
#Special handling if udev is running
udevpid=$(/bin/minips -C udevd -o pid=)
if [ -n "${udevpid}" ]; then
- /bin/kill -9 $udevpid
+ /bin/kill -9 ${udevpid}
/bin/sleep 0.01
fi
diff --git a/install/autodetect b/install/autodetect
index e446a07..8d7da7e 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -13,14 +13,14 @@ install ()
findfs ()
{
for blkdev in $(find /dev -type b | grep -v -e loop -e ram -e fd); do
- eval $(/usr/lib/klibc/bin/fstype 2>/dev/null < $blkdev)
- if [ -n "$FSTYPE" -a "$FSTYPE" != "swap" -a "$FSTYPE" != "unknown" -a "$FSTYPE" != "luks" -a "$FSTYPE" != "lvm2" ]; then
- echo $FSTYPE
+ eval $(/usr/lib/klibc/bin/fstype 2>/dev/null < ${blkdev})
+ if [ -n "${FSTYPE}" -a "${FSTYPE}" != "swap" -a "${FSTYPE}" != "unknown" -a "${FSTYPE}" != "luks" -a "${FSTYPE}" != "lvm2" ]; then
+ echo ${FSTYPE}
fi
done
}
- if [ $UID -eq 0 -o "$(groups | grep disk)" != "" ]; then
+ if [ ${UID} -eq 0 -o "$(groups | grep disk)" != "" ]; then
for fs in $(findfs | sort | uniq); do
for mod in $(find "${MODULEDIR}" -type f -name "${fs}.ko"); do
if [ -n "${mod}" ]; then
@@ -44,7 +44,7 @@ install ()
err "User does not have proper permissions to read superblocks, raid and filesystem modules are not detected"
fi
- for m in $AUTODETECT; do
+ for m in ${AUTODETECT}; do
modname="$(basename ${m%%\.ko})"
grep "^${modname}$" "${MODULE_FILE}" >/dev/null 2>&1 && continue
case "${m}" in
diff --git a/install/base b/install/base
index 071e62e..1a5d9bd 100644
--- a/install/base
+++ b/install/base
@@ -12,14 +12,14 @@ install ()
add_device "/dev/mem" c 1 1
for f in $(find /lib -name klibc-*.so); do
- add_file $f
+ add_file ${f}
done
for f in /usr/lib/klibc/bin/*; do
- add_file $f /bin/$(basename $f)
+ add_file ${f} /bin/$(basename ${f})
done
for f in /usr/lib/klibc/sbin/*; do
- add_file $f /sbin/$(basename $f)
+ add_file ${f} /sbin/$(basename ${f})
done
# add symlink for compatibility
add_symlink2 /bin/modprobe /sbin/modprobe
diff --git a/install/firmware b/install/firmware
index ca78b80..d03e274 100644
--- a/install/firmware
+++ b/install/firmware
@@ -6,12 +6,10 @@ install ()
BINARIES=""
FILES=""
SCRIPT=""
- if [ -e /lib/firmware ]; then
- for i in /lib/firmware/*; do
- add_file $i
- done
+ if [ -d /lib/firmware ]; then
+ add_full_dir /lib/firmware
else
- err "No firmware files found!"
+ err "No firmware files found!"
fi
}
diff --git a/mkinitcpio b/mkinitcpio
index e3489b6..ae012b8 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -74,19 +74,19 @@ trap sighandler TERM INT
while getopts ':c:k:s:b:g:a:p:m:vH:LMhS:' arg; do
if [ "${OPTARG:0:1}" = "-" ]; then
- echo "error: optional argument to '-$arg' begins with a '-'"
+ echo "error: optional argument to '-${arg}' begins with a '-'"
echo " you probably don't want this....aborting."
usage
fi
- case "$arg" in
- c) CONFIG="$OPTARG" ;;
- k) KERNELVERSION="$OPTARG" ;;
- s) SAVELIST="y"; FILELIST="$OPTARG" ;;
- b) BASEDIR="$OPTARG" ;;
- g) GENIMG="$OPTARG" ;;
- a) APPEND="y"; SAVELIST="y"; FILELIST="$OPTARG" ;;
- p) PRESET="$OPTARG" ;;
- m) MESSAGE="$OPTARG" ;;
+ case "${arg}" in
+ c) CONFIG="${OPTARG}" ;;
+ k) KERNELVERSION="${OPTARG}" ;;
+ s) SAVELIST="y"; FILELIST="${OPTARG}" ;;
+ b) BASEDIR="${OPTARG}" ;;
+ g) GENIMG="${OPTARG}" ;;
+ a) APPEND="y"; SAVELIST="y"; FILELIST="${OPTARG}" ;;
+ p) PRESET="${OPTARG}" ;;
+ m) MESSAGE="${OPTARG}" ;;
v) QUIET="n" ;;
S) SKIPHOOKS="${OPTARG}" ;;
H) source "${INSTDIR}/${OPTARG}";
@@ -103,10 +103,10 @@ while getopts ':c:k:s:b:g:a:p:m:vH:LMhS:' arg; do
M) SHOW_AUTOMODS="y" ;;
h|?) usage ;;
:) echo "${OPTARG} requires a value..."; usage ;;
- *) echo "invalid argument '$arg'"; usage ;;
+ *) echo "invalid argument '${arg}'"; usage ;;
esac
done
-shift $(($OPTIND - 1))
+shift $((${OPTIND} - 1))
# use preset $PRESET
if [ -n "${PRESET}" ]; then
@@ -225,7 +225,7 @@ echo ":: Begin build"
#parse 'global' hook, as defined in ${CONFIG}
parse_hook
-for hook in $HOOKS; do
+for hook in ${HOOKS}; do
echo "${SKIPHOOKS}" | grep -qw ${hook} && continue
unset MODULES
unset BINARIES
@@ -269,7 +269,7 @@ if [ "${HAS_MODULES}" == "y" ]; then
fi
status=0
-if [ -n "$GENIMG" ]; then
+if [ -n "${GENIMG}" ]; then
echo -n ":: Generating image '${GENIMG}'..."
sort -u ${FILELIST} > ${FILELIST}.sorted
mv ${FILELIST}.sorted ${FILELIST}
@@ -290,5 +290,5 @@ fi
cleanup
-exit $status
+exit ${status}
#vim:set ft=sh ts=4 sw=4 noet: