summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-07 02:04:59 +0200
committerDave Reisner <d@falconindy.com>2011-06-19 23:33:34 +0200
commitf2988f2bea65e345fd58e0e413b9eef4359d196b (patch)
tree7965a4aee21045712fbe7aa3f9236ac542200b6c
parentc17f3fdb2df60b65233b8659e64107e6bf8d34cd (diff)
downloadmkinitcpio-f2988f2bea65e345fd58e0e413b9eef4359d196b.tar.gz
mkinitcpio-f2988f2bea65e345fd58e0e413b9eef4359d196b.tar.xz
functions: simplify parse_hook
Since we intentionally word split these variables, a variable containing only white space will never trigger us to iterate on each for loop. Therefore, the existance check is superfluous as it will always pass. Signed-off-by: Dave Reisner <d@falconindy.com>
-rw-r--r--functions25
1 files changed, 9 insertions, 16 deletions
diff --git a/functions b/functions
index 17c15b5..bd80eb2 100644
--- a/functions
+++ b/functions
@@ -262,28 +262,21 @@ parse_hook() {
# prior to the start of hook processing, and after each hook's build
# function is run.
- local mod bin fil
- for mod in ${MODULES}; do
- if [ -n "${mod}" ]; then
- add_module "${mod}"
- fi
+ local item
+
+ for item in $MODULES; do
+ add_module "$item"
done
- for bin in ${BINARIES}; do
- if [ -n "${bin}" ]; then
- add_binary "${bin}"
- fi
+ for item in $BINARIES; do
+ add_binary "$item"
done
- for fil in ${FILES}; do
- if [ -n "${fil}" ]; then
- add_file "${fil}"
- fi
+ for item in $FILES; do
+ add_file "$item"
done
- if [ -n "${SCRIPT}" ]; then
- add_file "${HOOKDIR}/${SCRIPT}" "/hooks/${SCRIPT}"
- fi
+ [[ $SCRIPT ]] && add_file "$HOOKDIR/$SCRIPT" "/hooks/$SCRIPT"
}
# vim: set ft=sh ts=4 sw=4 et: