diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2016-08-25 16:10:45 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2016-08-25 16:12:33 -0500 |
commit | fef6268f8d03e3ab3e2564cbf3634d0db2bcd99e (patch) | |
tree | 1ec6511b27e1a5c5088e445d396bc9c1759d27a7 | |
parent | 556dbff99d53cdcc00e6b1ec67e1679f72b6f284 (diff) |
modules-load.d: cleanups
Move list of directories to a local variable and create the fn variable
to use for an individual file name rather than using path.
-rw-r--r-- | init.d/modules-load.in | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/init.d/modules-load.in b/init.d/modules-load.in index 8c19a36c..0f80396d 100644 --- a/init.d/modules-load.in +++ b/init.d/modules-load.in @@ -16,12 +16,11 @@ depend() keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver } -modules_dirs="/usr/lib/modules-load.d /run/modules-load.d /etc/modules-load.d" - find_modfiles() { - local basenames files x y - for x in $modules_dirs; do + local dirs="/usr/lib/modules-load.d /run/modules-load.d /etc/modules-load.d" + local basenames files fn x y + for x in $dirs; do [ ! -d $x ] && continue for y in $x/*.conf; do [ -f $y ] && basenames="${basenames}\n${y##*/}" @@ -29,11 +28,11 @@ find_modfiles() done basenames=$(printf "$basenames" | sort -u) for x in $basenames; do - for y in $modules_dirs; do + for y in $dirs; do [ -r $y/$x ] && - path=$y/$x + fn=$y/$x done - files="$files $path" + files="$files $fn" done echo $files } |