summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2008-01-13 12:30:29 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2008-01-13 12:30:29 +0000
commit26c58e8a4f8469a61092b4943e604dfaa58d2742 (patch)
tree973be7c4c25229a551f7ed56787ba6c041080fcb /Master
parentd75011acae11da0327fbaf71cd13b29c433c7df6 (diff)
Updated install-tl.pl to make use of TLWinGoo. Moved Norberts file
type code to TLWinGoo. It now only affects HKCU for non-admin users. wingoo-demo.pl now also tests the file type code. Commented out $ENV{'PERL5LIB'}=undef; in install-tl.pl l. 28 since it is unnecessary and generates an undefined scalar value error. git-svn-id: svn://tug.org/texlive/trunk@6209 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/install-tl.pl111
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm50
-rw-r--r--Master/wingoo-demo.pl4
3 files changed, 109 insertions, 56 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl
index 2cf3c60fc68..9be844a404d 100755
--- a/Master/install-tl.pl
+++ b/Master/install-tl.pl
@@ -27,7 +27,7 @@ BEGIN {
# Perl executable.
if ($^O=~/^MSWin(32|64)$/i) {
- $ENV{'PERL5LIB'}=undef;
+ #$ENV{'PERL5LIB'}=undef;
@INC="$::installerdir/tlpkg/lib/Perl5_lib-TL_inst";
}
unshift (@INC, "$::installerdir/tlpkg");
@@ -41,6 +41,7 @@ use TeXLive::TLUtils qw(initialize_installer media platform platform_desc
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
use TeXLive::TLConfig qw($DefaultContainerExtension $InfraLocation);
+use TeXLive::TLWinGoo;
use Getopt::Long;
use strict;
@@ -76,10 +77,10 @@ our @collections_lang;
our @collections_lang_doc;
# The maximum number of binary systems on the CD. This number must be
# smaller than the number of binaries available from the network.
-our $max_bins_on_CD=7;
+our $max_bins_on_CD=7;
# for win dealing
our $Registry;
-# The global variable %vars is an associative list which contains all
+# The global variable %vars is an associative list which contains all
# variables and their values which can be changed by the user.
# needs to be our since TeXLive::TLUtils uses it
our %vars=( # 'n_' means 'number of'.
@@ -342,7 +343,7 @@ sub set_platforms_supported {
if ($trynet==1) {
my @binaries=additional_architectures_available_from_net \%vars;
for my $binary (@binaries) {
- $vars{"netbin_$binary"}=0;
+ $vars{"netbin_$binary"}=0;
}
}
for my $key (keys %vars) {
@@ -362,10 +363,11 @@ sub set_texlive_default_dirs {
my $texmfsysvar;
my $texmflocal;
my $texmfhome;
-
+
$tex_prefix=getenv('TEXLIVE_INSTALL_PREFIX');
if (win32) {
- require("TeXLive/win-admin.pl");
+ #require("TeXLive/win-admin.pl");
+ $vars{'win-admin'} = admin();
if ($vars{'win-admin'}) {
$tex_prefix||=getenv('ProgramFiles') . '/texlive';
} else {
@@ -400,7 +402,7 @@ sub calc_depends {
%install=();
# initialize the %install hash with what should be installed
-
+
# First look for packages in the selected scheme.
my $scheme=$tlpdb->get_package($vars{'selected_scheme'});
@@ -469,7 +471,7 @@ sub calc_depends {
# check for newly selected packages
my @post_selected = keys %install;
tllog($::LOG_DDEBUG, "number of post installations: $#post_selected\n");
-
+
# set repeat condition
if ($#pre_selected != $#post_selected) {
$changed = 1;
@@ -490,7 +492,7 @@ sub calc_depends {
$size += $tlpobj->binsize->{$a} if defined($tlpobj->binsize->{$a});
}
}
- $vars{'total_size'} =
+ $vars{'total_size'} =
sprintf "%d", ($size * $TeXLive::TLConfig::BlockSize)/1024**2;
}
@@ -539,7 +541,7 @@ sub initialize_collections {
sub set_install_platform {
my @available_platforms;
my $detected_platform=platform;
- my $warn_nobin;
+ my $warn_nobin;
my $warn_nobin_x86_64_linux;
my $nowarn="";
my $wp='##'; # warning prefix
@@ -581,7 +583,7 @@ sub create_profile {
my $profilepath = shift;
# The file "TLprofile" is created at the beginning of the
# installation process and contains information about the current
- # setup. The purpose is to allow non-interactive installations.
+ # setup. The purpose is to allow non-interactive installations.
my $fh;
if (ref($profilepath)) {
$fh = $profilepath;
@@ -654,8 +656,8 @@ sub do_install_packages {
}
install_packages($tlpdb,$localtlpdb,\@what,\@netarchs,$vars{'option_src'},$vars{'option_doc'});
}
-
-# do_postinst_stuff has to fix up the texmf tree and install some missing
+
+# do_postinst_stuff has to fix up the texmf tree and install some missing
# files. The things to do are taken from the install-live.sh installer
# of former times, and should be critically checked.
sub do_postinst_stuff {
@@ -664,7 +666,7 @@ sub do_postinst_stuff {
"$vars{'TEXMFSYSVAR'}/tex/plain/config")
if (-f "$vars{'TEXDIR'}/texmf-dist/tex/plain/config/language.def");
copy ("$vars{'TEXDIR'}/texmf/xdvi/XDvi",
- "$vars{'TEXMFSYSVAR'}/xdvi")
+ "$vars{'TEXMFSYSVAR'}/xdvi")
if (-f "$vars{'TEXDIR'}/texmf/xdvi/XDvi");
# those files must exist
@@ -838,49 +840,56 @@ sub do_texmf_cnf {
}
# register texlua handlers etc etc
+#sub do_win_registry_magic {
+# # we are called under if (win32()) !!
+# my $winpath = "$vars{'TEXDIR'}/bin/win32";
+# $winpath =~ s!/!\\!g;
+# my $classespath;
+# if ($vars{'win-admin'}) {
+# # these things can only be done by admins
+# # PATHEXT editing
+# # should this be currentcontrolset or ControlSet001 ????
+# my $winenv = $Registry->Open( "LMachine/SYSTEM/CurrentControlSet/Control/Session Manager/Environment/", {Access=>'KEY_ALL_ACCESS',Delimiter=>"/"});
+# my $pathext = $winenv->GetValue("PATHEXT");
+# my $found = 0;
+# foreach (split(/;/,$pathext)) {
+# $found = 1 if (m/\.texlua/i);
+# }
+# if (!$found) {
+# $winenv->SetValue("PATHEXT","$pathext;.texlua");
+# }
+#
+# # add the win32 dir to the PATH
+# my $wpath = $winenv->GetValue("Path");
+# $wpath .= ";$winpath";
+# $winenv->SetValue("Path","$wpath", "REG_EXPAND_SZ");
+#
+# # for the .texlua binding we can do it for admin and normal users
+# # but with different registry pathes
+# $classespath = "LMachine/Software/Classes/";
+# } else {
+# tllog($::LOG_NORMAL, "non-admin users: no Path and PATHEXT setting possible.\n");
+# # for non-admin users the classes path is different
+# # (Siep, email 2008-01-09)
+# $classespath = "Users/Software/Classes/";
+# }
+# # generate a .texlua association and link it to texlua.exe, which should
+# # be in the path!
+# my $classes = $Registry->Open( $classespath, {Access=>'KEY_ALL_ACCESS',Delimiter=>"/"});
+# $classes->CreateKey(".texlua")->SetValue("","script.texlua");
+# my $scriptkey = $classes->CreateKey("script.texlua");
+# $scriptkey->SetValue("", "TeXLua Script");
+# $scriptkey->CreateKey("Shell/Open/Command/")->SetValue("","$winpath\\texlua.exe %1 %*");
+#}
+
sub do_win_registry_magic {
# we are called under if (win32()) !!
my $winpath = "$vars{'TEXDIR'}/bin/win32";
$winpath =~ s!/!\\!g;
- my $classespath;
- if ($vars{'win-admin'}) {
- # these things can only be done by admins
- # PATHEXT editing
- # should this be currentcontrolset or ControlSet001 ????
- my $winenv = $Registry->Open( "LMachine/SYSTEM/CurrentControlSet/Control/Session Manager/Environment/", {Access=>'KEY_ALL_ACCESS',Delimiter=>"/"});
- my $pathext = $winenv->GetValue("PATHEXT");
- my $found = 0;
- foreach (split(/;/,$pathext)) {
- $found = 1 if (m/\.texlua/i);
- }
- if (!$found) {
- $winenv->SetValue("PATHEXT","$pathext;.texlua");
- }
-
- # add the win32 dir to the PATH
- my $wpath = $winenv->GetValue("Path");
- $wpath .= ";$winpath";
- $winenv->SetValue("Path","$wpath", "REG_EXPAND_SZ");
-
- # for the .texlua binding we can do it for admin and normal users
- # but with different registry pathes
- $classespath = "LMachine/Software/Classes/";
- } else {
- tllog($::LOG_NORMAL, "non-admin users: no Path and PATHEXT setting possible.\n");
- # for non-admin users the classes path is different
- # (Siep, email 2008-01-09)
- $classespath = "Users/Software/Classes/";
- }
- # generate a .texlua association and link it to texlua.exe, which should
- # be in the path!
- my $classes = $Registry->Open( $classespath, {Access=>'KEY_ALL_ACCESS',Delimiter=>"/"});
- $classes->CreateKey(".texlua")->SetValue("","script.texlua");
- my $scriptkey = $classes->CreateKey("script.texlua");
- $scriptkey->SetValue("", "TeXLua Script");
- $scriptkey->CreateKey("Shell/Open/Command/")->SetValue("","$winpath\\texlua.exe %1 %*");
+ add_texbindir_to_path($winpath);
+ register_script_type(".texlua", $winpath."/texlua.exe");
}
-
#
# do everything to select a scheme
#
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index 3629d49007c..0a5bbba2908 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -1,7 +1,7 @@
# TeXLive::TLWinGoo.pm
# Windows nastiness
#
-# Copyright 2007 Siep Kroonenberg
+# Copyright 2008 Siep Kroonenberg, Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
@@ -25,6 +25,7 @@ C<TeXLive::TLWinGoo> -- Additional utilities for Windows
TeXLive::TLWinGoo::get_user_path;
TeXLive::TLWinGoo::win_which_dir($prog);
TeXLive::TLWinGoo::add_texbindir_to_path($texpath);
+ TeXLive::TLWinGoo::register_script_type($extension, $command);
=head2 DESCRIPTION
@@ -45,6 +46,7 @@ BEGIN {
&get_user_path
&win_which_dir
&add_texbindir_to_path
+ &register_script_type
);
if ($^O=~/^MSWin(32|64)$/i) {
@@ -189,7 +191,6 @@ forward slashes.
=cut
sub get_system_path {
- $Registry->ArrayValues(0);
my $value = get_system_env() -> {'/Path'};
$value =~ s/\\/\//g;
$value =~ s/[\s\x00]+$//;
@@ -207,7 +208,6 @@ expandable.
=cut
sub get_user_path {
- $Registry->ArrayValues(0);
my $value = get_user_env() -> {'/Path'};
return "" if not $value;
$value =~ s/\\/\//g;
@@ -264,8 +264,6 @@ path. A directory is a TeX directory if it contains tex.exe or
pdftex.exe. Then add desired TeX directory; to system path if
admin, otherwise to user path.
-=back
-
=cut
sub add_texbindir_to_path {
@@ -306,9 +304,51 @@ sub add_texbindir_to_path {
}
}
+=pod
+
+=item C<register_script_type>
+Add registry entries to associate $extension with $command and make
+$extension an executable file type. Slashes are flipped where necessary.
+
+=back
+
+=cut
+sub register_script_type {
+ my $extension = shift;
+ $extension = '.'.$extension unless $extension =~ /^\./; # ensure leading dot
+ $extension = uc($extension);
+ my $command = shift;
+ $command =~s/\//\\/g;
+ # pathext
+
+ my $pathext = get_user_env() -> {'/PATHEXT'};
+ $pathext = get_system_env() -> {'/PATHEXT'} if not $pathext;
+ my $found = 0;
+ foreach my $e (split(/;/,$pathext)) {
+ $found = 1 if (uc($e) eq $extension);
+ }
+ if (!$found) {
+ if ($is_admin) {
+ (get_system_env() -> {"/PATHEXT"}) = $pathext.";".$extension;
+ } else {
+ (get_user_env() -> {"/PATHEXT"}) = $pathext.";".$extension;
+ }
+ }
+
+ # file type
+
+ $extension = lc($extension);
+ my $classes_key = $Registry -> Open(
+ ($is_admin ? "LMachine/Software/Classes/" : "CUser/Software/Classes/"),
+ {Access => KEY_ALL_ACCESS()}) or die "Cannot open classpath";
+ $classes_key->ArrayValues(0);
+ $classes_key->CreateKey($extension)->SetValue("","script".$extension);
+ $classes_key->CreateKey("script".$extension."/Shell/Open/Command/")->
+ SetValue("", $command.' "%1" %*');
+}
# needs a terminal 1 for require to succeed!
1;
diff --git a/Master/wingoo-demo.pl b/Master/wingoo-demo.pl
index 373a8cc8c04..f4697e3c571 100644
--- a/Master/wingoo-demo.pl
+++ b/Master/wingoo-demo.pl
@@ -104,3 +104,7 @@ if (!admin()) {
print "tex.exe found in " . win_which_dir("tex.exe") . "\n";
unlink $fn;
}
+
+# adding a filetype
+
+register_script_type(".rb","x:/ruby/bin/ruby.exe");