fstest for Linux:
Automatically detect file system type.
This commit is contained in:
parent
48a8b4cd56
commit
d385c6dd7e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185223
@ -4,5 +4,29 @@
|
||||
# Known operating systems: FreeBSD, SunOS, Linux
|
||||
os=`uname`
|
||||
|
||||
# Known file systems: UFS, ZFS, other
|
||||
fs="UFS"
|
||||
case "${os}" in
|
||||
FreeBSD|Darwin)
|
||||
#fs=`df -T . | tail -1 | awk '{print $2}'`
|
||||
pattern="`df . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`"
|
||||
fs=`mount | egrep "^${pattern}" | awk -F '[(,]' '{print $2}'`
|
||||
;;
|
||||
Solaris)
|
||||
pattern="`df -k . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`"
|
||||
fs=`mount -v | egrep "^${pattern}" | awk '{print $5}'`
|
||||
;;
|
||||
Linux)
|
||||
fs=`df -PT . | tail -1 | awk '{print $2}'`
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported operating system ${os}." >/dev/stderr
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# If we cannot figure out file system type, define it here.
|
||||
#fs="UFS"
|
||||
|
||||
if [ -z "${fs}" ]; then
|
||||
echo "Cannot figure out file system type, define it by hand." >/dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user