diff options
author | Dave Reisner <d@falconindy.com> | 2011-06-03 19:24:07 +0200 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2011-06-07 20:38:43 +0200 |
commit | 16e6c970bc2a261cb3c890bc92ec41bb393821f5 (patch) | |
tree | a6fb32df029f2757eea493ef57261d2a811d6289 /functions | |
parent | 4a69075b0a11a4ca982d4daa8b30dd6117e845d4 (diff) | |
download | mkinitcpio-16e6c970bc2a261cb3c890bc92ec41bb393821f5.tar.gz mkinitcpio-16e6c970bc2a261cb3c890bc92ec41bb393821f5.tar.xz |
functions: refactor checked modules
Do a single grep to compare the contents of the module file (if exists)
against the results of all_modules for the provided arguments. If
there's no module file, this is still just pass through to all_modules.
Signed-off-by: Dave Reisner <d@falconindy.com>
Diffstat (limited to 'functions')
-rw-r--r-- | functions | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -65,16 +65,11 @@ all_modules () checked_modules () { - if [ -e "${MODULE_FILE}" ]; then - for mod in $(all_modules $@); do - modname=$(get_module_name "${mod}") - if grep -q "^${modname}$" "${MODULE_FILE}"; then - echo ${modname} - fi - done + if [[ -s "$MODULE_FILE" ]]; then + grep -xFf "$MODULE_FILE" <(all_modules "$@") return 1 else - all_modules ${@} + all_modules "$@" fi } |