ref: 5b53470cf0491b9378e0a48325e98230569d68b1
parent: 8bfd996b8c79d6eda6d80c02b34d6183f303a267
author: Natanael Copa <ncopa@alpinelinux.org>
date: Mon Nov 10 06:46:00 CST 2014
init: minor refactor of find_ovl use 'set' instead of 'ls' to find duplicate apkovls
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -49,8 +49,6 @@
find_ovl() {
local mnt="$1"
- local ovl
- local lines
if [ -n "$APKOVL" ]; then
[ -f "$mnt/$APKOVL" ] && echo "$mnt/$APKOVL"
@@ -58,14 +56,13 @@
fi
# look for apkovl's on mounted media
- ovl=$( ls -1 "$mnt"/*.apkovl.tar.gz* 2>/dev/null ) || return 1
- lines=$(echo "$ovl" | wc -l)
+ set -- "$mnt"/*.apkovl.tar.gz*
- if [ $lines -gt 1 ] ; then
+ if [ $# -gt 1 ] ; then
echo "ERROR: More than one apkovl file was found on $(basename $mnt). None will be read." >&2
return 1
fi
- echo "$ovl"
+ echo "$1"
}
retry_mount() {