This package allows you to read, manipulate, and write fstab-format files, such as /etc/fstab, /etc/mtab, and /proc/mounts.
Example 37-1. Getting the filesystem type of the root device.
require_once 'File/Fstab.php'; $fstab =& new File_Fstab(); $root =& $fstab->getEntryForPath('/'); echo "Root FS type: " . $root->fsType . "\n";
Example 37-2. Determine if a user may mount the CD-ROM
The user option in your fstab determines whether users may mount a given device or not.
require_once 'File/Fstab.php'; $fstab =& new File_Fstab(); $cd =& $fstab->getEntryForDevice('/dev/cdrom'); if ($cd->hasOption('user')) { echo "Users may mount the CD-ROM\n"; } else { echo "Users may not mount the CD-ROM\n"; }