diff --git a/exports/module.info b/exports/module.info index 8b2e39a49..b1040060e 100644 --- a/exports/module.info +++ b/exports/module.info @@ -24,3 +24,4 @@ depends=mount 1.276 version=1.276 desc_ru_RU= NFS desc_ca=Exportacions NFS +novserver=1 diff --git a/fdisk/module.info b/fdisk/module.info index d0c4e3fcf..bdd1e24c2 100644 --- a/fdisk/module.info +++ b/fdisk/module.info @@ -23,3 +23,4 @@ desc_zh_TW.UTF-8=本機磁碟分割區 desc_zh_CN.UTF-8=本地磁盘分区 desc_ja_JP.UTF-8=ローカル ディスクのパーティション desc_ko_KR.UTF-8=지역 디스크 파티션 +novserver=1 diff --git a/mount/module.info b/mount/module.info index dfc634e18..d0c0a78f3 100644 --- a/mount/module.info +++ b/mount/module.info @@ -27,3 +27,4 @@ desc_zh_TW.UTF-8=磁碟與網路檔案系統 desc_zh_CN.UTF-8=磁盘和网络文件系统 desc_ja_JP.UTF-8=ディスクおよびネットワーク・ファイルシステム desc_ko_KR.UTF-8=디스크 및 네트워크 파일시스템 +novserver=1 diff --git a/net/index.cgi b/net/index.cgi index 95cee5bbe..0cc77af0a 100755 --- a/net/index.cgi +++ b/net/index.cgi @@ -6,10 +6,11 @@ require './net-lib.pl'; &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"}); @@ -17,7 +18,7 @@ foreach $i ('ifcs', 'routes', 'dns', 'hosts', } &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 "
\n"; print "
\n"; diff --git a/time/module.info b/time/module.info index fbbdb28cd..3ee18cb56 100644 --- a/time/module.info +++ b/time/module.info @@ -27,3 +27,4 @@ desc_zh_TW.UTF-8=系統時間 desc_zh_CN.UTF-8=系统时间 desc_ja_JP.UTF-8=システム時間 desc_ko_KR.UTF-8=시스템 시간 +novserver=1 diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index 5886ef092..8ff7858ce 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -1319,6 +1319,10 @@ if ($_[0]->{'nozone'} && &running_in_zone()) { # 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'}; @@ -5937,6 +5941,25 @@ chop($zn); 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() { + 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