#! /usr/bin/perl -w package NFSConf; require "__WIZ_HOME__/common/scripts/Vareqval.pm"; require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm"; use MDK::Common; use strict; my $o = DrakconnectConf->new(); sub network_mask { my $wiz_ip_server = $o->get_from_known_dev("IP"); my $mask = $o->get_from_known_dev("Mask"); $mask = $mask ? $mask : "255.255.255.0"; $wiz_ip_server = $wiz_ip_server ? $wiz_ip_server : "192.168.1.0"; "$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; } sub chooser { if ($ENV{wiz_nfs_level} == 1) { do_it(); } $ENV{wiz_nfs_level}; } sub do_it { my $line; my $file = "/etc/exports"; chomp($ENV{wiz_nfs_dir}); -f $file and cp_af($file, $file.".orig"); if ($ENV{wiz_nfs_level} == 2) { my $mask = $o->get_from_known_dev("Mask"); $line = "$ENV{wiz_nfs_dir} $ENV{wiz_netmask}(rw,no_root_squash)\n"; } else { $line = "$ENV{wiz_nfs_dir} *(rw,no_root_squash)\n"; } print "$line\n"; my $t; foreach (cat_($file)) { if (/.*(?!\#).*$ENV{wiz_nfs_dir}\s.*/) { $t = $_; last; } } if ($t) {substInFile { s|.*(?!\#).*$ENV{wiz_nfs_dir}\s.*|\#$&|} $file } append_to_file($file, $line); system("/usr/sbin/exportfs -a") }