### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### dfstab.pm - psgconf action class for generating /etc/dfs/dfstab ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Action::GenerateFile::dfstab; use strict; use PSGConf::Action::GenerateFile; our @ISA = qw(PSGConf::Action::GenerateFile); ############################################################################### ### generate() method ############################################################################### sub generate { my ($self, $fh, $psgconf) = @_; my ($path, $opt, @options, $exp); $exp = $self->{exports}; foreach $path (sort keys %$exp) { @options = (); foreach $opt (keys %{$exp->{$path}}) { if (! defined($exp->{$path}->{$opt})) { push(@options, $opt); } elsif (! ref($exp->{$path}->{$opt})) { push(@options, "$opt=$exp->{$path}->{$opt}"); } elsif (ref($exp->{$path}->{$opt}) eq 'HASH') { push(@options, "$opt=" . join(':', sort keys %{$exp->{$path}->{$opt}})); } } print $fh '/usr/sbin/share -F nfs -o ' . join(',', @options) . ' ' . $path . "\n"; } return 1; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Action::GenerateFile::dfstab - action to generate /etc/dfs/dfstab =head1 SYNOPSIS use PSGConf::Action::GenerateFile::dfstab; $psgconf->register_actions( PSGConf::Action::GenerateFile::dfstab->new( 'name' => '/etc/dfs/dfstab', 'exports' => { "/path/to/export" => { rw => { host1, host2, ... }, ro => { host1, host2, ... }, root => { host1, host2, ... }, anon => 60001, nosuid => undef, ... }, ... }, ... ), ... ); =head1 DESCRIPTION The B module provides a B action class for generating the F file. The B class is derived from the B class, but it defines/overrides the following methods: =over 4 =item generate() Generates the F file based on the value of the I attribute. =back In addition to the attributes supported by the B class, the B class supports the following attributes: =over 4 =item I A reference to a hash that maps absolute paths to a hash containing the options for that path to be exported with. In the sub-hash containing the export options, the value may be a scalar, in which case it is encoded as the value of the option, or a reference to a hash, in which case the keys of this sub-sub-hash will be considered multiple values for the specified option. =back =head1 SEE ALSO L L L =cut