diff options
Diffstat (limited to 'nfs_wizard/scripts/NFSConf.pm')
-rw-r--r-- | nfs_wizard/scripts/NFSConf.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/nfs_wizard/scripts/NFSConf.pm b/nfs_wizard/scripts/NFSConf.pm new file mode 100644 index 00000000..942380d9 --- /dev/null +++ b/nfs_wizard/scripts/NFSConf.pm @@ -0,0 +1,27 @@ +#! /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 do_it { + 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"; + my $t; + + foreach (cat_($file)) { + if (/^\s*(?!\#)\s*\$ENV{wiz_nfs_dir}.*/) { + $t = $_; + last; + } + } + if ($t) { substInFile { s|$t|\#$&$line|} $file } + else { append_to_file($file, $line) } + system("/usr/sbin/exportfs -a") +} |