Better detection of shared zone perl
authorJamie Cameron <jcameron@webmin.com>
Wed, 15 Aug 2007 05:31:25 +0000 (05:31 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 15 Aug 2007 05:31:25 +0000 (05:31 +0000)
cpan/CHANGELOG
cpan/cpan-lib.pl
cpan/index.cgi
cpan/lang/en
cpan/module.info

index cdc1ef5..ec4558c 100644 (file)
@@ -16,3 +16,5 @@ Fixed a bug that prevented a custom temp files directory from being used when in
 When installing a Perl module from CPAN and it already exists in an operating system package (such as from APT or YUM), use that instead.
 ---- Changes since 1.340 ----
 Added Module Config option to not install modules from APT or YUM.
+---- Changes since 1.360 ----
+The module is now available when running Webmin inside a Solaris zone, but only if Perl is not shared with the global zone.
index 4edc229..a200e69 100644 (file)
@@ -347,5 +347,30 @@ foreach my $a (@avail) {
 return @rv;
 }
 
+# shared_perl_root()
+# Returns 1 if Perl is shared with the root zone, indicating that Perl modules
+# cannot be installed.
+sub shared_perl_root
+{
+return 0 if (!&running_in_zone());
+local $pp = &get_perl_path();
+if (&foreign_exists("mount")) {
+       &foreign_require("mount", "mount-lib.pl");
+       local @rst = stat($pp);
+       local $m;
+       foreach $m (&mount::list_mounted()) {
+               local @mst = stat($m->[0]);
+               if ($mst[0] == $rst[0] &&
+                   &is_under_directory($m->[0], $pp)) {
+                       # Found the mount!
+                       if ($m->[2] eq "lofs" || $m->[2] eq "nfs") {
+                               return 1;
+                               }
+                       }
+               }
+       }
+return 0;
+}
+
 1;
 
index f94bb68..465e977 100755 (executable)
@@ -7,6 +7,13 @@ $ver = join(".", map { ord($_) } split(//, $^V));
 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
                 undef, undef, undef, &text('index_pversion', $ver));
 
+# Check if Perl is installed from a global zone
+if (&shared_perl_root()) {
+       print "<b>$text{'index_ezone'}</b><p>\n";
+       &ui_print_footer("/", $text{'index'});
+       exit;
+       }
+
 # Display perl modules
 @mods = &list_perl_modules();
 if (@mods) {
index d3bc229..fed8188 100644 (file)
@@ -19,6 +19,7 @@ index_upgrade=Upgrade Modules
 index_recs=The following Perl modules are recommended for installation by Webmin :
 index_recsok=Install Selected Modules
 index_recsgot=All of the following Perl modules recommended by Webmin are installed : $1
+index_ezone=Perl appears to be shared with the global zone, so modules cannot be installed here. They must be installed in the global zone instead.
 
 download_err=Failed to install module
 download_elocal=No local file given
index e2d2b6d..f11be80 100644 (file)
@@ -1,4 +1,3 @@
-nozone=1
 desc_nl=Perl Modules (CPAN)
 desc_ko_KR.euc=Perl ¸ðµâ
 desc_ru_SU=íÏÄÕÌÉ Perl