&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
&help_search_link("ifconfig hosts resolve.conf nsswitch.conf", "man"));
+$zone = &running_in_zone() || &running_in_vserver();
foreach $i ('ifcs', 'routes', 'dns', 'hosts',
($config{'ipnodes_file'} ? ('ipnodes') : ( ))) {
next if (!$access{$i});
- next if ($i eq "ifcs" && &running_in_zone());
+ next if ($i eq "ifcs" && $zone);
push(@links, "list_${i}.cgi");
push(@titles, $text{"${i}_title"});
}
&icons_table(\@links, \@titles, \@icons, @icons > 4 ? scalar(@icons) : 4);
-if (defined(&apply_network) && $access{'apply'} && !&running_in_zone()) {
+if (defined(&apply_network) && $access{'apply'} && !$zone) {
# Allow the user to apply the network config
print "<hr>\n";
print "<form action=apply.cgi>\n";
# Not supported in a Solaris Zone
return 0;
}
+if ($_[0]->{'novserver'} && &running_in_vserver()) {
+ # Not supported in a Linux vserver
+ return 0;
+ }
return 1 if (!$oss || $oss eq '*');
local $osver = $_[2] || $gconfig{'os_version'};
local $ostype = $_[1] || $gconfig{'os_type'};
return $zn && $zn ne "global";
}
+# running_in_vserver()
+# Returns 1 if the current Webmin instance is running in a Linux VServer.
+# Used to disable modules and features that are not appropriate
+sub running_in_vserver
+{
+return 0 if ($gconfig{'os_type'} !~ /^\*-linux$/);
+local $vserver;
+open(MTAB, "/etc/mtab");
+while(<MTAB>) {
+ local ($dev, $mp) = split(/\s+/, $_);
+ if ($mp eq "/" && $dev =~ /^\/dev\/hdv/) {
+ $vserver = 1;
+ last;
+ }
+ }
+close(MTAB);
+return $vserver;
+}
+
# list_categories(&modules)
# Returns a hash mapping category codes to names
sub list_categories