get_mounts now returns mount options too
authorRoy Marples <uberlord@gentoo.org>
Fri, 10 Nov 2006 15:56:59 +0000 (15:56 +0000)
committerRoy Marples <uberlord@gentoo.org>
Fri, 10 Nov 2006 15:56:59 +0000 (15:56 +0000)
eclass/eutils.eclass
eclass/portability.eclass

index 91f24feb75dab350be4e0390696242f0e4f3c3c1..fcb6a5d2be5ce4ac38e398317c95145313e4e61f 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.258 2006/11/02 21:13:47 nyhm Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.259 2006/11/10 15:56:58 uberlord Exp $
 #
 # This eclass is for general purpose functions that most ebuilds
 # have to implement themselves.
@@ -1404,16 +1404,16 @@ _cdrom_locate_file_on_cd() {
                        local dir=$(dirname ${cdset[${i}]})
                        local file=$(basename ${cdset[${i}]})
 
-                       for mline in $(gawk '/(iso|cdrom|fs=cdfss)/ {print $2}' /proc/mounts) ; do
-                               mline=$(echo -e ${mline})
-                               [[ -d ${mline}/${dir} ]] || continue
-                               if [[ -n $(find "${mline}"/${dir} -maxdepth 1 -iname ${file}) ]] ; then
-                                       export CDROM_ROOT=${mline}
-                                       export CDROM_SET=${i}
-                                       export CDROM_MATCH=${cdset[${i}]}
-                                       return
-                               fi
-                       done
+                       local point= node= fs= foo=
+                       while read point node fs foo ; do
+                               [[ *" ${fs} "* != " cd9660 iso9660 " ]] && continue
+                               point=${point//\040/ }
+                               [[ -z $(find "${point}/${dir}" -maxdepth 1 -iname "${file}") ]] && continue
+                               export CDROM_ROOT=${point}
+                               export CDROM_SET=${i}
+                               export CDROM_MATCH=${cdset[${i}]}
+                               return
+                       done < <(get_mounts)
 
                        ((++i))
                done
index f8d0a12f1d75b5cffdf3225fd3d265384e8be4d6..c198218083eeb4c14d8b1556b9627d585255b717 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.9 2006/11/06 13:55:04 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.10 2006/11/10 15:56:59 uberlord Exp $
 #
 # Author: Diego Pettenò <flameeyes@gentoo.org>
 #
@@ -131,15 +131,15 @@ get_bmake() {
 }
 
 # Portable method of getting mount names and points.
-# Returns as "point node fs"
+# Returns as "point node fs options"
 # Remember to convert 040 back to a space.
 get_mounts() {
-       local point= node= fs= foo=
+       local point= node= fs= opts= foo=
 
        # Linux has /proc/mounts which should always exist
        if [[ $(uname -s) == "Linux" ]] ; then
-               while read node point fs foo ; do
-                       echo "${point} ${node} ${fs}" 
+               while read node point fs opts foo ; do
+                       echo "${point} ${node} ${fs} ${opts}
                done < /proc/mounts
                return 
        fi
@@ -153,7 +153,9 @@ get_mounts() {
        # of the spaces and we should not force a /proc either.
        local IFS=$'\t'
        LC_ALL=C mount -p | while read node point fs foo ; do
-               echo "${point// /\040} ${node// /\040} ${fs%% *}"
+               opts=${fs#* }
+               fs=${fs%% *}
+               echo "${point// /\040} ${node// /\040} ${fs%% *} ${opts// /\040}"
        done
 }