- Update to 1.27
PR: ports/146356 Submitted by: Jim Pirzyk <pirzyk@FreeBSD.org> (maintainer)
This commit is contained in:
parent
6ded77e4cc
commit
6a7af898e2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=253870
10 changed files with 18 additions and 283 deletions
|
@ -6,26 +6,28 @@
|
|||
#
|
||||
|
||||
PORTNAME= Sys-Filesystem
|
||||
PORTVERSION= 1.22
|
||||
PORTVERSION= 1.27
|
||||
CATEGORIES= sysutils perl5
|
||||
MASTER_SITES= CPAN
|
||||
MASTER_SITE_SUBDIR= Sys
|
||||
PKGNAMEPREFIX= p5-
|
||||
|
||||
MAINTAINER= pirzyk@FreeBSD.org
|
||||
COMMENT= Perl module to Retrieve list of filesystems and their properties
|
||||
COMMENT= Perl module to Retrieve list of filesystems and their properties
|
||||
|
||||
PERL_MODBUILD= yes
|
||||
|
||||
MAN3= Sys::Filesystem::Mswin32.3 \
|
||||
Sys::Filesystem.3 \
|
||||
Sys::Filesystem::Linux.3 \
|
||||
Sys::Filesystem::Darwin.3 \
|
||||
Sys::Filesystem::Cygwin.3 \
|
||||
Sys::Filesystem::Aix.3 \
|
||||
Sys::Filesystem::Unix.3 \
|
||||
Sys::Filesystem::Dummy.3 \
|
||||
Sys::Filesystem::Freebsd.3 \
|
||||
Sys::Filesystem::Solaris.3
|
||||
Sys::Filesystem.3 \
|
||||
Sys::Filesystem::Linux.3 \
|
||||
Sys::Filesystem::Darwin.3 \
|
||||
Sys::Filesystem::Cygwin.3 \
|
||||
Sys::Filesystem::Aix.3 \
|
||||
Sys::Filesystem::Unix.3 \
|
||||
Sys::Filesystem::Dummy.3 \
|
||||
Sys::Filesystem::Freebsd.3 \
|
||||
Sys::Filesystem::Solaris.3 \
|
||||
Sys::Filesystem::Hpux.3 \
|
||||
Sys::Filesystem::Netbsd.3
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
MD5 (Sys-Filesystem-1.22.tar.gz) = c73754f0ad3c2ae9cb9552ca70010e8c
|
||||
SHA256 (Sys-Filesystem-1.22.tar.gz) = 32a10085fc347dd7e02e4df7d2bb2eff9dd7e3528471e7e82f57e0965172fcb2
|
||||
SIZE (Sys-Filesystem-1.22.tar.gz) = 18722
|
||||
MD5 (Sys-Filesystem-1.27.tar.gz) = ecba80460e35d5b23ec7896e1e78f745
|
||||
SHA256 (Sys-Filesystem-1.27.tar.gz) = 5544413ff3e1b9df49b15ecc2410f0eacca96404b1d7be5aa3e7dd3488bde945
|
||||
SIZE (Sys-Filesystem-1.27.tar.gz) = 32467
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
--- ./lib/Sys/Filesystem/Aix.pm.orig Thu Jun 1 14:10:48 2006
|
||||
+++ ./lib/Sys/Filesystem/Aix.pm Fri Nov 30 11:39:17 2007
|
||||
@@ -37,7 +37,7 @@
|
||||
$args{fstab} ||= '/etc/filesystems';
|
||||
|
||||
my @fstab_keys = qw(account boot check dev free mount nodename size type vfs vol log);
|
||||
- my @special_fs = qw(swap procfs proc tmpfs nfs mntfs autofs);
|
||||
+ push (@Sys::Filesystem::special_fs, qw(procfs mntfs));
|
||||
|
||||
# Read the fstab
|
||||
my $fstab = new FileHandle;
|
||||
@@ -53,18 +53,43 @@
|
||||
|
||||
# This matches a filesystem attribute
|
||||
} elsif (my ($key,$value) = $_ =~ /^\s*([a-z]{3,8})\s+=\s+"?(.+)"?\s*$/) {
|
||||
- $self->{$current_filesystem}->{$key} = $value;
|
||||
$self->{$current_filesystem}->{unmounted} = -1; # Unknown mount state?
|
||||
if ($key eq 'vfs') {
|
||||
- if (grep(/^$value$/, @special_fs)) {
|
||||
+ if (grep(/^$value$/, @Sys::Filesystem::special_fs)) {
|
||||
$self->{$current_filesystem}->{special} = 1;
|
||||
}
|
||||
+ $self->{$current_filesystem}->{type} = $value;
|
||||
+ } else {
|
||||
+ $self->{$current_filesystem}->{$key} = $value
|
||||
+ if ( $key ne 'type');
|
||||
}
|
||||
}
|
||||
}
|
||||
$fstab->close;
|
||||
} else {
|
||||
croak "Unable to open fstab file ($args{fstab})\n";
|
||||
+ }
|
||||
+
|
||||
+ # /dev/hd4 / jfs Apr 02 13:45 rw,log=/dev/hd8
|
||||
+ if ($fstab->open('/usr/sbin/mount -p|')) {
|
||||
+ while (<$fstab>) {
|
||||
+ my ($device, $mount_point, $fstype);
|
||||
+ grep (m|^\s+(/\S+)\s+(/\S+)\s+(\S+)|
|
||||
+ && ($device=$1, $mount_point=$2, $fstype=$3), $_);
|
||||
+
|
||||
+ if ( defined $mount_point ) {
|
||||
+ $self->{$mount_point}->{mounted} = 1;
|
||||
+ $self->{$mount_point}->{device} = $device;
|
||||
+ $self->{$mount_point}->{mount_point} = $mount_point;
|
||||
+ $self->{$mount_point}->{fs_vfstype} = $fstype;
|
||||
+ if (grep(/^$fstype$/, @Sys::Filesystem::special_fs)) {
|
||||
+ $self->{$mount_point}->{special} = 1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ $fstab->close;
|
||||
+ } else {
|
||||
+ croak "Unable to run mount command\n";
|
||||
}
|
||||
|
||||
bless($self,$class);
|
|
@ -1,20 +0,0 @@
|
|||
--- ./lib/Sys/Filesystem/Cygwin.pm.orig Thu Jun 1 14:10:48 2006
|
||||
+++ ./lib/Sys/Filesystem/Cygwin.pm Fri Nov 30 11:39:17 2007
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
local $/ = "\n";
|
||||
my @keys = qw(fs_spec fs_file fs_vfstype fs_mntops);
|
||||
- my @special_fs = qw(swap proc devpts tmpfs);
|
||||
+ push (@Sys::Filesystem::special_fs, qw(devpts));
|
||||
|
||||
my $mtab = new FileHandle;
|
||||
if ($mtab->open('mount|')) {
|
||||
@@ -44,7 +44,7 @@
|
||||
next if (/^\s*#/ || /^\s*$/);
|
||||
if (my @vals = $_ =~ /^\s*(.+?) on (\/.+?) type (\S+) \((\S+)\)\s*$/) {
|
||||
$self->{$vals[1]}->{mounted} = 1;
|
||||
- $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@special_fs);
|
||||
+ $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@Sys::Filesystem::special_fs);
|
||||
for (my $i = 0; $i < @keys; $i++) {
|
||||
$self->{$vals[1]}->{$keys[$i]} = $vals[$i];
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
--- ./lib/Sys/Filesystem/Freebsd.pm.orig Thu Jun 1 14:10:48 2006
|
||||
+++ ./lib/Sys/Filesystem/Freebsd.pm Fri Nov 30 11:53:45 2007
|
||||
@@ -26,32 +26,46 @@
|
||||
use FileHandle;
|
||||
use Carp qw(croak);
|
||||
|
||||
+# For access to the getfsstat system call
|
||||
+require 'sys/syscall.ph';
|
||||
+require 'sys/mount.ph';
|
||||
+
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '1.05' || sprintf('%d', q$Revision: 364 $ =~ /(\d+)/g);
|
||||
|
||||
+my $sizeof;
|
||||
+if ( &STATFS_VERSION == 0x20030518 ) {
|
||||
+ $sizeof = 472; # The size in bytes of the statfs structure
|
||||
+} else {
|
||||
+ croak "The statfs strucuture changed version (" . &STATFS_VERSION . ")\n";
|
||||
+}
|
||||
+# unpack format, we want the 3rd and the last 3 fields.
|
||||
+my $format = 'x8L' . 'x268' . 'A' . &MFSNAMELEN . ('A' . &MNAMELEN ) x 2 ;
|
||||
+
|
||||
sub new {
|
||||
ref(my $class = shift) && croak 'Class name required';
|
||||
my %args = @_;
|
||||
my $self = { };
|
||||
+ my (@vals, $i);
|
||||
|
||||
$args{fstab} ||= '/etc/fstab';
|
||||
- $args{mtab} ||= '/etc/mtab';
|
||||
- $args{xtab} ||= '/etc/lib/nfs/xtab';
|
||||
+ # $args{mtab} ||= '/etc/mtab'; # Does not exist on FreeBSD
|
||||
+ $args{xtab} ||= '/var/db/mountdtab';
|
||||
|
||||
my @keys = qw(fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno);
|
||||
- my @special_fs = qw(swap proc devpts tmpfs);
|
||||
+ push (@Sys::Filesystem::special_fs, qw(procfs devpts devfs));
|
||||
|
||||
# Read the fstab
|
||||
my $fstab = new FileHandle;
|
||||
if ($fstab->open($args{fstab})) {
|
||||
while (<$fstab>) {
|
||||
next if (/^\s*#/ || /^\s*$/);
|
||||
- my @vals = split(/\s+/, $_);
|
||||
+ @vals = split(/\s+/, $_);
|
||||
$self->{$vals[1]}->{mount_point} = $vals[1];
|
||||
$self->{$vals[1]}->{device} = $vals[0];
|
||||
$self->{$vals[1]}->{unmounted} = 1;
|
||||
- $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@special_fs);
|
||||
- for (my $i = 0; $i < @keys; $i++) {
|
||||
+ $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@Sys::Filesystem::special_fs);
|
||||
+ for ($i = 0; $i < @keys; $i++) {
|
||||
$self->{$vals[1]}->{$keys[$i]} = $vals[$i];
|
||||
}
|
||||
}
|
||||
@@ -60,24 +74,42 @@
|
||||
croak "Unable to open fstab file ($args{fstab})\n";
|
||||
}
|
||||
|
||||
- # Read the mtab
|
||||
- my $mtab = new FileHandle;
|
||||
- if ($mtab->open($args{mtab})) {
|
||||
- while (<$mtab>) {
|
||||
- next if (/^\s*#/ || /^\s*$/);
|
||||
- my @vals = split(/\s+/, $_);
|
||||
- delete $self->{$vals[1]}->{unmounted} if exists $self->{$vals[1]}->{unmounted};
|
||||
- $self->{$vals[1]}->{mounted} = 1;
|
||||
- $self->{$vals[1]}->{mount_point} = $vals[1];
|
||||
- $self->{$vals[1]}->{device} = $vals[0];
|
||||
- $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,qw(swap proc devpts tmpfs));
|
||||
- for (my $i = 0; $i < @keys; $i++) {
|
||||
- $self->{$vals[1]}->{$keys[$i]} = $vals[$i];
|
||||
- }
|
||||
+ # Get the number of mounted fileystems we have
|
||||
+ my $buf = '';
|
||||
+ my $cnt = syscall(&SYS_getfsstat, $buf, length $buf, &MNT_NOWAIT);
|
||||
+
|
||||
+ # Fix a bug on some 5.x systems, the previous syscall may return 0...
|
||||
+ $cnt = 20 if ( ! $cnt );
|
||||
+
|
||||
+ # Preallocate the buffer memory per the syscall() requreiments
|
||||
+ $buf = ' ' x ( $sizeof * $cnt );
|
||||
+
|
||||
+ if ( ($cnt=syscall(&SYS_getfsstat, $buf, length $buf, &MNT_NOWAIT)) ) {
|
||||
+ for (($i) = 0; $i < $cnt; $i++) {
|
||||
+
|
||||
+ my $offset = ($i)? 'x' . ($i * $sizeof): '';
|
||||
+ @vals = unpack ( $offset . $format, $buf);
|
||||
+
|
||||
+ delete $self->{$vals[3]}->{unmounted} if exists $self->{$vals[3]}->{unmounted};
|
||||
+ $self->{$vals[3]}->{mounted} = 1;
|
||||
+ $self->{$vals[3]}->{mount_point} = $vals[3];
|
||||
+ $self->{$vals[3]}->{device} = $vals[2];
|
||||
+ $self->{$vals[3]}->{special} = 1 if grep(/^$vals[1]$/,@Sys::Filesystem::special_fs);
|
||||
+
|
||||
+ $self->{$vals[3]}->{fs_spec} = $vals[2];
|
||||
+ $self->{$vals[3]}->{fs_file} = $vals[3];
|
||||
+ $self->{$vals[3]}->{fs_vfstype} = $vals[1];
|
||||
+ $self->{$vals[3]}->{fs_mntops} =
|
||||
+ ($vals[0] & &MNT_RDONLY)? 'ro': 'rw';
|
||||
+ $self->{$vals[3]}->{fs_mntops} .= ',noexec'
|
||||
+ if ($vals[0] & &MNT_NOEXEC);
|
||||
+ $self->{$vals[3]}->{fs_mntops} .= ',nosuid'
|
||||
+ if ($vals[0] & &MNT_NOSUID);
|
||||
+ $self->{$vals[3]}->{fs_mntops} .= ',nodev'
|
||||
+ if ($vals[0] & &MNT_NODEV);
|
||||
}
|
||||
- $mtab->close;
|
||||
} else {
|
||||
- croak "Unable to open mtab file ($args{mtab})\n";
|
||||
+ croak "Unable to retrieve mounted filesystem information\n";
|
||||
}
|
||||
|
||||
# Bless and return
|
|
@ -1,19 +0,0 @@
|
|||
--- ./lib/Sys/Filesystem/Linux.pm.orig Thu Jun 1 14:10:48 2006
|
||||
+++ ./lib/Sys/Filesystem/Linux.pm Fri Nov 30 11:39:17 2007
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
# Default fstab and mtab layout
|
||||
my @keys = qw(fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno);
|
||||
+ push (@Sys::Filesystem::special_fs, qw(devpts usbfs sysfs binfmt_misc rpc_pipefs));
|
||||
|
||||
# Read the fstab
|
||||
my $fstab = new FileHandle;
|
||||
@@ -54,7 +55,7 @@
|
||||
$self->{$vals[1]}->{mount_point} = $vals[1];
|
||||
$self->{$vals[1]}->{device} = $vals[0];
|
||||
$self->{$vals[1]}->{unmounted} = 1;
|
||||
- $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,qw(swap proc devpts tmpfs));
|
||||
+ $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@Sys::Filesystem::special_fs);
|
||||
for (my $i = 0; $i < @keys; $i++) {
|
||||
$self->{$vals[1]}->{$keys[$i]} = $vals[$i];
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
--- ./lib/Sys/Filesystem/Solaris.pm.orig Thu Jun 1 14:10:48 2006
|
||||
+++ ./lib/Sys/Filesystem/Solaris.pm Fri Nov 30 11:39:17 2007
|
||||
@@ -42,7 +42,7 @@
|
||||
my @fstab_keys = qw(device device_to_fsck mount_point fs_vfstype fs_freq mount_at_boot fs_mntops);
|
||||
my @mtab_keys = qw(device mount_point fs_vfstype fs_mntops time);
|
||||
|
||||
- my @special_fs = qw(swap proc procfs tmpfs nfs mntfs autofs lofs fd ctfs devfs objfs cachefs);
|
||||
+ push (@Sys::Filesystem::special_fs, qw(mntfs lofs fd ctfs devfs objfs cachefs));
|
||||
local $/ = "\n";
|
||||
|
||||
# Read the fstab
|
||||
@@ -57,7 +57,7 @@
|
||||
$vals[$i] = '' unless defined $vals[$i];
|
||||
}
|
||||
$self->{$vals[2]}->{unmounted} = 1;
|
||||
- $self->{$vals[2]}->{special} = 1 if grep(/^$vals[3]$/,@special_fs);
|
||||
+ $self->{$vals[2]}->{special} = 1 if grep(/^$vals[3]$/,@Sys::Filesystem::special_fs);
|
||||
for (my $i = 0; $i < @fstab_keys; $i++) {
|
||||
$self->{$vals[2]}->{$fstab_keys[$i]} = $vals[$i];
|
||||
}
|
||||
@@ -77,7 +77,7 @@
|
||||
my @vals = split(/\s+/, $_);
|
||||
delete $self->{$vals[1]}->{unmounted} if exists $self->{$vals[1]}->{unmounted};
|
||||
$self->{$vals[1]}->{mounted} = 1;
|
||||
- $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@special_fs);
|
||||
+ $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@Sys::Filesystem::special_fs);
|
||||
for (my $i = 0; $i < @mtab_keys; $i++) {
|
||||
$self->{$vals[1]}->{$mtab_keys[$i]} = $vals[$i];
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
--- ./lib/Sys/Filesystem/Unix.pm.orig Thu Jun 1 14:10:48 2006
|
||||
+++ ./lib/Sys/Filesystem/Unix.pm Fri Nov 30 11:39:17 2007
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
# Default fstab and mtab layout
|
||||
my @keys = qw(fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno);
|
||||
- my @special_fs = qw(swap proc);
|
||||
|
||||
# Read the fstab
|
||||
my $fstab = new FileHandle;
|
||||
@@ -54,7 +53,7 @@
|
||||
$self->{$vals[1]}->{mount_point} = $vals[1];
|
||||
$self->{$vals[1]}->{device} = $vals[0];
|
||||
$self->{$vals[1]}->{unmounted} = 1;
|
||||
- $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@special_fs);
|
||||
+ $self->{$vals[1]}->{special} = 1 if grep(/^$vals[2]$/,@Sys::Filesystem::special_fs);
|
||||
for (my $i = 0; $i < @keys; $i++) {
|
||||
$self->{$vals[1]}->{$keys[$i]} = $vals[$i];
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ./lib/Sys/Filesystem.pm.orig Thu Jun 1 14:10:48 2006
|
||||
+++ ./lib/Sys/Filesystem.pm Fri Nov 30 11:39:17 2007
|
||||
@@ -30,6 +30,8 @@
|
||||
use vars qw($VERSION $AUTOLOAD);
|
||||
$VERSION = '1.22' || sprintf('%d', q$Revision: 574 $ =~ /(\d+)/g);
|
||||
|
||||
+our @special_fs = qw(swap proc tmpfs nfs autofs);
|
||||
+
|
||||
sub new {
|
||||
# Check we're being called correctly with a class name
|
||||
ref(my $class = shift) && croak 'Class name required';
|
|
@ -4,8 +4,10 @@
|
|||
%%SITE_PERL%%/Sys/Filesystem/Darwin.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Dummy.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Freebsd.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Hpux.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Linux.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Mswin32.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Netbsd.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Solaris.pm
|
||||
%%SITE_PERL%%/Sys/Filesystem/Unix.pm
|
||||
@dirrm %%SITE_PERL%%/Sys/Filesystem
|
||||
|
|
Loading…
Reference in a new issue