texlive[43941] Master/tlpkg: Future-proof win version; no uninst reg

commits+siepo at tug.org commits+siepo at tug.org
Thu Apr 20 22:20:09 CEST 2017


Revision: 43941
          http://tug.org/svn/texlive?view=revision&revision=43941
Author:   siepo
Date:     2017-04-20 22:20:09 +0200 (Thu, 20 Apr 2017)
Log Message:
-----------
Future-proof win version; no uninst reg entry for w10 user install

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLWinGoo.pm
    trunk/Master/tlpkg/installer/install-menu-perltk.pl
    trunk/Master/tlpkg/installer/install-menu-text.pl

Modified: trunk/Master/tlpkg/TeXLive/TLWinGoo.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLWinGoo.pm	2017-04-20 14:47:49 UTC (rev 43940)
+++ trunk/Master/tlpkg/TeXLive/TLWinGoo.pm	2017-04-20 20:20:09 UTC (rev 43941)
@@ -34,8 +34,9 @@
 
 =head2 DIAGNOSTICS
 
-  TeXLive::TLWinGoo::win_version;
   TeXLive::TLWinGoo::is_vista;
+  TeXLive::TLWinGoo::is_seven;
+  TeXLive::TLWinGoo::is_ten;
   TeXLive::TLWinGoo::admin;
   TeXLive::TLWinGoo::non_admin;
   TeXLive::TLWinGoo::reg_country;
@@ -93,11 +94,12 @@
   @ISA = qw( Exporter );
   @EXPORT = qw(
     &is_vista
+    &is_seven
+    &is_ten
     &admin
     &non_admin
   );
   @EXPORT_OK = qw(
-    &win_version
     &admin_again
     &reg_country
     &broadcast_env
@@ -194,23 +196,48 @@
 =cut
 
 my $windows_version = 0;
+my $windows_subversion = 0;
 
 if ($is_win) {
-  my @osver = Win32::GetOSVersion();
-  $windows_version = $osver[1];
-  debug "Windows version $osver[0], major version $osver[1]\n";
+  #my @osver = Win32::GetOSVersion(); # deprecated
+  #$windows_version = $osver[1];
+  #debug "Windows version $osver[0], major version $osver[1]\n";
+  my $ver = `ver`;
+  chomp $ver;
+  $ver =~ s/^[^0-9]*//;
+  $ver =~ s/[^0-9.]*$//;
+  ($windows_version = $ver) =~ s/\..*$//;
+  ($windows_subversion = $ver) =~ s/^[^\.]*\.//;
+  $windows_subversion =~ s/\..*$//;
 }
 
-sub win_version { return $windows_version; }
-
 =item C<is_vista>
 
-C<is_vista> returns 1 if win_version is >= 6.0, otherwise 0.
+C<is_vista> returns 1 if windows version is >= 6.0, otherwise 0.
 
 =cut
 
 sub is_vista { return $windows_version >= 6; }
 
+=item C<is_seven>
+
+C<is_seven> returns 1 if windows version is >= 6.1, otherwise 0.
+
+=cut
+
+sub is_seven {
+  return (($windows_version == 6 && $windows_subversion >= 1) ||
+    ($windows_version > 6));
+}
+
+=item C<is_ten>
+
+C<is_ten> returns 1 if windows version is >= 10.0, otherwise 0.
+
+=cut
+
+sub is_ten { return $windows_version >= 10; }
+
 # permissions with which we try to access the system environment
 
 my $is_admin = 1;
@@ -1237,26 +1264,32 @@
         "$uninst_dir\\uninst.bat", "", 0);
   }
   # register uninstaller
-  &log("Registering uninstaller\n");
-  my $k;
-  my $uninst_key = $Registry -> Open((admin() ? "LMachine" : "CUser") .
-      "/software/microsoft/windows/currentversion/",
-      {Access => KEY_FULL_ACCESS()});
-  if ($uninst_key) {
-    $k = $uninst_key->CreateKey(
-      "uninstall/TeXLive$::TeXLive::TLConfig::ReleaseYear/");
-    if ($k) {
-      $k->{"/DisplayName"} = "TeX Live $::TeXLive::TLConfig::ReleaseYear";
-      $k->{"/UninstallString"} = "\"$td\\tlpkg\\installer\\uninst.bat\"";
-      $k->{'/DisplayVersion'} = $::TeXLive::TLConfig::ReleaseYear;
-      $k->{'/URLInfoAbout'} = "http://www.tug.org/texlive";
+  # but not for a user install under win10 because then
+  # it shows up in Settings / Apps / Apps & features,
+  # where it will trigger an inappropriate UAC prompt
+  if (admin() || !is_ten()) {
+    &log("Registering uninstaller\n");
+    my $k;
+    my $uninst_key = $Registry -> Open((admin() ? "LMachine" : "CUser") .
+        "/software/microsoft/windows/currentversion/",
+        {Access => KEY_FULL_ACCESS()});
+    if ($uninst_key) {
+      $k = $uninst_key->CreateKey(
+        "uninstall/TeXLive$::TeXLive::TLConfig::ReleaseYear/");
+      if ($k) {
+        $k->{"/DisplayName"} = "TeX Live $::TeXLive::TLConfig::ReleaseYear";
+        $k->{"/UninstallString"} = "\"$td\\tlpkg\\installer\\uninst.bat\"";
+        $k->{'/DisplayVersion'} = $::TeXLive::TLConfig::ReleaseYear;
+        $k->{'/Publisher'} = 'TeX Live';
+        $k->{'/URLInfoAbout'} = "http://www.tug.org/texlive";
+      }
     }
+    if (!$k and admin()) {
+      tlwarn("Failed to register uninstaller\n".
+         "You can still run $td\\tlpkg\\installer\\uninst.bat manually.\n");
+      return 0;
+    }
   }
-  if (!$k and admin()) {
-    tlwarn("Failed to register uninstaller\n".
-       "You can still run $td\\tlpkg\\installer\\uninst.bat manually.\n");
-    return 0;
-  }
 }
 
 =pod

Modified: trunk/Master/tlpkg/installer/install-menu-perltk.pl
===================================================================
--- trunk/Master/tlpkg/installer/install-menu-perltk.pl	2017-04-20 14:47:49 UTC (rev 43940)
+++ trunk/Master/tlpkg/installer/install-menu-perltk.pl	2017-04-20 20:20:09 UTC (rev 43941)
@@ -63,7 +63,7 @@
 
 $::deskintdesc[0] = __("No shortcuts");
 $::deskintdesc[1] = __("TeX Live menu");
-if (win32() && is_vista()) { $::deskintdesc[2] = __("Launcher entry"); }
+if (win32() && is_seven()) { $::deskintdesc[2] = __("Launcher entry"); }
 
 # generic option strings:
 $::yesno[0] = __('No');

Modified: trunk/Master/tlpkg/installer/install-menu-text.pl
===================================================================
--- trunk/Master/tlpkg/installer/install-menu-text.pl	2017-04-20 14:47:49 UTC (rev 43940)
+++ trunk/Master/tlpkg/installer/install-menu-text.pl	2017-04-20 20:20:09 UTC (rev 43941)
@@ -40,7 +40,7 @@
 
 $::deskintdesc[0] = "None";
 $::deskintdesc[1] = "Menu shortcuts";
-if (win32() && is_vista()) { $::deskintdesc[2] = "Launcher"; }
+if (win32() && is_seven()) { $::deskintdesc[2] = "Launcher"; }
 
 sub clear_screen {
   return 0 if ($::opt_no_cls);



More information about the tex-live-commits mailing list