summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2006-11-06 13:55:04 +0000
committerRoy Marples <uberlord@gentoo.org>2006-11-06 13:55:04 +0000
commit7580bfa04a32a48c56ec59f2e3e4fa388eb96cf2 (patch)
treed4d29311bed509db6e8fb1df29a5fee23a1581fa /eclass/portability.eclass
parentupdate the check for the qt4 bindings based on comments from bug #150888 (diff)
downloadgentoo-2-7580bfa04a32a48c56ec59f2e3e4fa388eb96cf2.tar.gz
gentoo-2-7580bfa04a32a48c56ec59f2e3e4fa388eb96cf2.tar.bz2
gentoo-2-7580bfa04a32a48c56ec59f2e3e4fa388eb96cf2.zip
Added get_mounts to portability.eclass
Diffstat (limited to 'eclass/portability.eclass')
-rw-r--r--eclass/portability.eclass30
1 files changed, 29 insertions, 1 deletions
diff --git a/eclass/portability.eclass b/eclass/portability.eclass
index 90d1b3139589..f8d0a12f1d75 100644
--- a/eclass/portability.eclass
+++ b/eclass/portability.eclass
@@ -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.8 2006/03/08 20:08:13 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/portability.eclass,v 1.9 2006/11/06 13:55:04 uberlord Exp $
#
# Author: Diego Pettenò <flameeyes@gentoo.org>
#
@@ -129,3 +129,31 @@ get_bmake() {
echo pmake
fi
}
+
+# Portable method of getting mount names and points.
+# Returns as "point node fs"
+# Remember to convert 040 back to a space.
+get_mounts() {
+ local point= node= fs= 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}"
+ done < /proc/mounts
+ return
+ fi
+
+ # OK, pray we have a -p option that outputs mounts in fstab format
+ # using tabs as the seperator.
+ # Then pray that there are no tabs in the either.
+ # Currently only FreeBSD supports this and the other BSDs will
+ # have to be patched.
+ # Athough the BSD's may support /proc, they do NOT put \040 in place
+ # 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%% *}"
+ done
+}
+