summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2007-12-30 19:11:38 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2007-12-30 19:11:38 +0000
commit77682e20894aa737b8e8e4c1d09aa8db98293d05 (patch)
tree3c3c607e8fe1c5d7fdd0087dcb6cf9b5ba819388 /Master
parentb937bd9c2e26cee7cc8e757d3f9665121a559f29 (diff)
win-admin.pl, install-tl.pl: Check admin rights.
install-menu-text.pl: Removed "Perl for Windows" button. git-svn-id: svn://tug.org/texlive/trunk@6001 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/install-tl.pl5
-rwxr-xr-xMaster/tlpkg/TeXLive/install-menu-text.pl1
-rw-r--r--Master/tlpkg/TeXLive/win-admin.pl57
3 files changed, 61 insertions, 2 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl
index 08e6b1956e8..6dbfd7d4f69 100755
--- a/Master/install-tl.pl
+++ b/Master/install-tl.pl
@@ -191,7 +191,7 @@ do_postinst_stuff();
dump_vars("$system_tmpdir/texlive.vars");
# if we installed from a profile we don't need to write it out
if (-r "$vars{'TEXDIR'}/$InfraLocation/texlive.profile") {
- warn "Not overwritting already present profile in $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n";
+ warn "Not overwriting already present profile in $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n";
} else {
create_profile("$vars{'TEXDIR'}/$InfraLocation/texlive.profile");
print "Profile written to $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n";
@@ -249,7 +249,8 @@ sub set_texlive_default_dirs {
$tex_prefix=getenv('TEXLIVE_INSTALL_PREFIX');
if (win32) {
- if (-w getenv('ProgramFiles')) {
+ require("TeXLive/win-admin.pl");
+ if (%vars{'win-admin'}) {
$tex_prefix||=getenv('ProgramFiles') . '/texlive';
} else {
$tex_prefix||=getenv('USERPROFILE') . '/texlive';
diff --git a/Master/tlpkg/TeXLive/install-menu-text.pl b/Master/tlpkg/TeXLive/install-menu-text.pl
index cf75cd3337a..0ae98a8a709 100755
--- a/Master/tlpkg/TeXLive/install-menu-text.pl
+++ b/Master/tlpkg/TeXLive/install-menu-text.pl
@@ -279,6 +279,7 @@ sub collection_menu {
@collections=sort @collections_std;
foreach my $collection (@collections) {
+ next if ($collection eq 'collection-perl');
my $tlpobj = $tlpdb->get_package("$collection");
if (length $tlpobj->shortdesc>30) {
push @coll_long_desc, $collection;
diff --git a/Master/tlpkg/TeXLive/win-admin.pl b/Master/tlpkg/TeXLive/win-admin.pl
new file mode 100644
index 00000000000..f163b536721
--- /dev/null
+++ b/Master/tlpkg/TeXLive/win-admin.pl
@@ -0,0 +1,57 @@
+#!/usr/bin/env perl
+
+# $Id: $
+# win-admin.pl
+#
+# Copyright 2007 Siep Kroonenberg
+# This file is licensed under the GNU General Public License version 2
+# or any later version.
+#
+# This file determines whether the script is run with admin rights.
+#
+# This code first sets $admin to true. The function sys-access returns
+# registry access permissions based on the value of $admin. The code
+# then tries to access the system environment with the permissions
+# returned by sys_access. If this fails then it modifies its
+# assumptions and tries again.
+
+use Win32::TieRegistry(
+ Delimiter => "/", ArrayValues => 0, FixSzNulls => 1,
+ qw(REG_SZ REG_EXPAND_SZ KEY_READ KEY_WRITE KEY_ALL_ACCESS
+ KEY_ENUMERATE_SUB_KEYS));
+
+my $admin=1;
+my $SystemEnv;
+our %vars;
+
+sub sys_access {
+ $admin? KEY_ALL_ACCESS() : KEY_READ() | KEY_ENUMERATE_SUB_KEYS();
+}
+
+$SystemEnv=$Registry -> Open(
+ "LMachine/system/currentcontrolset/control/session manager/Environment/",
+ {Access => sys_access()});
+
+if (not $SystemEnv) {
+ print "No admin permissions\n";
+ $admin=0;
+ $SystemEnv=$Registry -> Open(
+ "LMachine/system/currentcontrolset/control/session manager/Environment/",
+ {Access => sys_access()});
+}
+
+$SystemEnv->ArrayValues(1);
+
+$vars{'win-admin'}=$admin? 1:0;
+
+# needs a terminal 1 for require to succeed!
+1;
+
+__END__
+
+### Local Variables:
+### perl-indent-level: 2
+### tab-width: 2
+### indent-tabs-mode: nil
+### End:
+# vim:set tabstop=2 expandtab: #