summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2002-09-03 15:17:49 +0000
committerStew Benedict <stewb@mandriva.org>2002-09-03 15:17:49 +0000
commit6347aab73cb2b46a25ce2e45709904d63e9fea46 (patch)
tree8b5d13fd14a011ce04c67dbd54d523324bce4c30 /perl-install/standalone
parent41fd4c5ecf59f690b01f50464d143aac1a3a3126 (diff)
downloaddrakx-6347aab73cb2b46a25ce2e45709904d63e9fea46.tar
drakx-6347aab73cb2b46a25ce2e45709904d63e9fea46.tar.gz
drakx-6347aab73cb2b46a25ce2e45709904d63e9fea46.tar.bz2
drakx-6347aab73cb2b46a25ce2e45709904d63e9fea46.tar.xz
drakx-6347aab73cb2b46a25ce2e45709904d63e9fea46.zip
Fix empty subnet in /etc/exports /home entry.
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/drakTermServ75
1 files changed, 48 insertions, 27 deletions
diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ
index 9b868e5d5..8f68d0fa8 100755
--- a/perl-install/standalone/drakTermServ
+++ b/perl-install/standalone/drakTermServ
@@ -753,15 +753,10 @@ sub maintain_clients {
sub dhcpd_config {
#- do main dhcp server config
my $dhcpd_box;
- my @netmask = ();
- my @broadcast = ();
- my @netconfig = ();
- my @ifconfig = ();
my @ifvalues = ();
my @resolve = ();
my @nserve = ();
my %netconfig;
- my @subnet = ();
my @nservers = ();
#- entry boxes for data entry
@@ -826,29 +821,16 @@ sub dhcpd_config {
%netconfig = getVarsFromSh("/etc/sysconfig/network");
$entry_domain->set_text($netconfig{DOMAINNAME});
}
-
- if ( -e "/etc/sysconfig/network-scripts/ifcfg-eth0") {
- %netconfig = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-eth0");
- $entry_netmask->set_text($netconfig{NETMASK});
- $entry_subnet_mask->set_text($netconfig{NETMASK});
- }
-
- @ifconfig = grep(/inet/, `/sbin/ifconfig eth0`);
- @ifvalues = split(/[: \t]+/, $ifconfig[0]);
- $entry_broadcast->set_text($ifvalues[5]);
-
- @broadcast = split(/\./, $ifvalues[5]);
- @netmask = split(/\./, $netconfig{NETMASK});
-
- foreach (0..3) {
- #- wasn't evaluating the & as expected
- my $val1= $broadcast[$_] + 0;
- my $val2 = $netmask[$_] + 0;
- $subnet[$_] = $val1 & $val2;
- }
+ my $sys_netmask = get_mask_from_sys();
+ $entry_netmask->set_text($sys_netmask);
+ $entry_subnet_mask->set_text($sys_netmask);
- $entry_subnet->set_text(join(".", @subnet));
+ my $sys_broadcast = get_broadcast_from_sys();
+ $entry_broadcast->set_text($sys_broadcast);
+ my $sys_subnet = get_subnet_from_sys($sys_broadcast, $sys_netmask);
+
+ $entry_subnet->set_text($sys_subnet);
my @route = grep(/^0.0.0.0/, `/sbin/route -n`);
@ifvalues = split(/[ \t]+/, $route[0]);
@@ -906,6 +888,38 @@ sub dhcpd_config {
$dhcpd_box->show_all();
}
+sub get_mask_from_sys {
+ my %netconfig;
+ if ( -e "/etc/sysconfig/network-scripts/ifcfg-eth0") {
+ %netconfig = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-eth0");
+ $netconfig{NETMASK};
+ }
+}
+
+sub get_subnet_from_sys {
+ my ($sys_broadcast, $sys_netmask) = @_;
+ my @subnet;
+
+ my @netmask = split(/\./, $sys_netmask);
+ my @broadcast = split(/\./, $sys_broadcast);
+
+ foreach (0..3) {
+ #- wasn't evaluating the & as expected
+ my $val1= $broadcast[$_] + 0;
+ my $val2 = $netmask[$_] + 0;
+ $subnet[$_] = $val1 & $val2;
+ }
+
+ join(".", @subnet);
+}
+
+sub get_broadcast_from_sys {
+ my @ifconfig = grep(/inet/, `/sbin/ifconfig eth0`);
+ my @ifvalues = split(/[: \t]+/, $ifconfig[0]);
+
+ $ifvalues[5];
+}
+
sub write_dhcpd_config {
my( $subnet, $netmask, $routers, $subnet_mask, $broadcast, $domain, $ns1, $ns2, $ns3) = @_;
@@ -994,6 +1008,13 @@ sub enable_ts {
open(FHANDLE, "> /etc/exports");
print FHANDLE "#/etc/exports - generated by drakTermServ\n\n";
print FHANDLE "/\t(ro,all_squash)\n";
+ if ($nfs_subnet eq '') {
+ $nfs_subnet = get_subnet_from_sys();
+ $nfs_mask = get_mask_from_sys();
+ my $sys_broadcast = get_broadcast_from_sys();
+ $nfs_subnet = get_subnet_from_sys($sys_broadcast, $nfs_mask);
+
+ }
print FHANDLE "/home\t$nfs_subnet/$nfs_mask(rw,root_squash)\n";
close FHANDLE;
$buff_index = toggle_chkconfig("on", "clusternfs", $buff_index+1);
@@ -1173,7 +1194,7 @@ sub deluser {
if ($user =~ /$username/) {
splice (@ts_users, $i, 1);
$user_deleted = 1;
- break;
+ last;
}
$i++;
}