diff options
Diffstat (limited to 'nfs_wizard/scripts/NFSConf.pm')
-rw-r--r-- | nfs_wizard/scripts/NFSConf.pm | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/nfs_wizard/scripts/NFSConf.pm b/nfs_wizard/scripts/NFSConf.pm index 942380d9..673f571a 100644 --- a/nfs_wizard/scripts/NFSConf.pm +++ b/nfs_wizard/scripts/NFSConf.pm @@ -8,20 +8,42 @@ 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"; - my $ip = "$1.$2.$3.0" if $o->get_from_known_dev("IP") =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $mask = $o->get_from_known_dev("Mask"); - my $line = "$ENV{wiz_nfs_dir} $ip/$mask(rw,no_root_squash)\n"; + 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 (/^\s*(?!\#)\s*\$ENV{wiz_nfs_dir}.*/) { + if (/.*(?!\#).*$ENV{wiz_nfs_dir}\s.*/) { $t = $_; last; } } - if ($t) { substInFile { s|$t|\#$&$line|} $file } - else { append_to_file($file, $line) } + if ($t) {substInFile { s|.*(?!\#).*$ENV{wiz_nfs_dir}\s.*|\#$&|} $file } + append_to_file($file, $line); system("/usr/sbin/exportfs -a") } |