commit: fef6268f8d03e3ab3e2564cbf3634d0db2bcd99e Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> AuthorDate: Thu Aug 25 21:10:45 2016 +0000 Commit: William Hubbs <williamh <AT> gentoo <DOT> org> CommitDate: Thu Aug 25 21:12:33 2016 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fef6268f
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. init.d/modules-load.in | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/init.d/modules-load.in b/init.d/modules-load.in index 8c19a36..0f80396 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 }