diff options
author | Karl Berry <karl@freefriends.org> | 2008-01-30 19:53:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-01-30 19:53:36 +0000 |
commit | 481631b97b21dd0eda4720f6e03912217bcf9281 (patch) | |
tree | 4812d3d33c1cd81fc8a6d82572865a820da64e2a /Master/tlpkg/doc | |
parent | 6b233664eec7acb80daf7c87690e1fc51d33fc29 (diff) |
move demos to tlpkg/doc
git-svn-id: svn://tug.org/texlive/trunk@6452 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/doc')
-rwxr-xr-x | Master/tlpkg/doc/windemo.bat | 17 | ||||
-rwxr-xr-x | Master/tlpkg/doc/windemo.pl | 5 | ||||
-rwxr-xr-x | Master/tlpkg/doc/wingoo-demo.bat | 31 | ||||
-rw-r--r-- | Master/tlpkg/doc/wingoo-demo.pl | 126 |
4 files changed, 179 insertions, 0 deletions
diff --git a/Master/tlpkg/doc/windemo.bat b/Master/tlpkg/doc/windemo.bat new file mode 100755 index 00000000000..4cf04f380c0 --- /dev/null +++ b/Master/tlpkg/doc/windemo.bat @@ -0,0 +1,17 @@ +@echo off + +rem TeX Live win32 bin directory; ends with backslash +rem This should also work with UNC names +set tlwinbin=%~dp0 + +set PERL5SAVE=%PERL5LIB% + +set PERL5LIB=%tlwinbin%..\..\tlpkg\lib\Perl5_lib-TL_inst +"%tlwinbin%..\..\tlpkg\bin\perl" "%~dpn0" %1 %2 %3 %4 %5 %6 %7 %8 %9 +pause Done + +rem cleanup in case of start from command-line + +set PERL5LIB=%PERL5SAVE% +set PERL5SAVE= +set tlwinbin= diff --git a/Master/tlpkg/doc/windemo.pl b/Master/tlpkg/doc/windemo.pl new file mode 100755 index 00000000000..a92e505a1bc --- /dev/null +++ b/Master/tlpkg/doc/windemo.pl @@ -0,0 +1,5 @@ +#!/usr/bin/env perl +use Config; +v:\print "INC:\n ".(join "\n ", @INC)."\n"; +print "Extension: ".$Config{'exe_ext'}."\n"; +print "Parameters: >".(join "< >", @ARGV)."<\n"; diff --git a/Master/tlpkg/doc/wingoo-demo.bat b/Master/tlpkg/doc/wingoo-demo.bat new file mode 100755 index 00000000000..a3589ba8d20 --- /dev/null +++ b/Master/tlpkg/doc/wingoo-demo.bat @@ -0,0 +1,31 @@ +@echo off
+
+rem TeX Live Root; ends with backslash
+rem This should also work with UNC names
+set tlroot=%~dp0
+set tldrive=%~d0
+
+%tldrive%
+cd %tlroot%
+
+rem we need wget in the path, so add tlpkg\bin to the path
+set pathsave=%path%
+path %path%;%tlroot%tlpkg\bin
+
+rem use provided Perl
+
+set PERL5SAVE=%PERL5LIB%
+
+set PERL5LIB=%tlroot%tlpkg\lib\Perl5_lib-TL_inst
+"%tlroot%tlpkg\bin\perl" "%tlroot%wingoo-demo.pl"
+
+pause Done
+
+rem cleanup in case of start from command-line
+
+set PERL5LIB=%PERL5SAVE%
+set PERL5SAVE=
+path %pathsave%
+set pathsave=
+set tldrive=
+set tlroot=
diff --git a/Master/tlpkg/doc/wingoo-demo.pl b/Master/tlpkg/doc/wingoo-demo.pl new file mode 100644 index 00000000000..c73e3626d64 --- /dev/null +++ b/Master/tlpkg/doc/wingoo-demo.pl @@ -0,0 +1,126 @@ +#!/usr/bin/env perl +# For testing, edit $ro_dir and $wr_dir as needed. + +# $ro_dir should be read-only. +# $wr_dir should be writable. + +#!/usr/bin/env perl + +use strict; + +BEGIN { + $^W = 1; + my $me=$0; + $me=~s!\\!/!g if $^O=~/^MSWin(32|64)$/i; + + if ($me=~m!/!) { + ($::installerdir=$me)=~s!(.*)/.*$!$1!; + } else { + # This shouldn't occur if called from batchfile + $::installerdir='.'; + } + unshift (@INC, "$::installerdir/tlpkg"); + # unshift (@INC, "$::installerdir/bin/win32") if $^O=~/^MSWin(32|64)$/i; +} + +use TeXLive::TLWinGoo; # safe under Unix/Linux! + +my $ro_dir = "z:/aps"; + +sub maybenot { + my $bool = shift; + return $bool ? " is " : " is not "; +} + +sub create_file { + my $name = shift; + return if -e $name; + open DUMMY, ">".$name; + print DUMMY "Hello"; + close DUMMY; +} + +sub print_search_paths { + print "System path: ".get_system_path()."\n"; + print "User path: ".get_user_path()."\n"; +} + +print ((join "\n", @INC)."\n"); +# admin + +if (admin()) { + print "Admin or not on Windows\n"; +} else { + print "Not admin\n"; +} + +# country + +print "Country: " . reg_country() . "\n"; + +# global_tmpdir + +print "Global tempdir: " . global_tmpdir()."\n"; + +if ($^O !~ /^MSWin(32|64)$/i) { + print "Not Windows; bailing out...\n"; + exit; +} + +# dir_writable + +my $wr_dir = $ENV{'USERPROFILE'}; +$wr_dir =~ s/\\/\//g; +mkdir $wr_dir unless -e $wr_dir; +print $wr_dir . maybenot(dir_writable($wr_dir)) . "writable\n"; +print $ro_dir . maybenot(dir_writable($ro_dir)) . "writable\n"; + +# expand_string + +print expand_string("pre\\%systemROOT%\\post")."\n"; + +# win_which_dir + +print "cmd.exe found in " . TeXLive::TLWinGoo::win_which_dir("cmd.exe") . "\n"; + +# adding and removing texbindir + +my $wr_dir1 = $wr_dir . "/tex1"; +mkdir $wr_dir1 unless -e $wr_dir1; +create_file( $wr_dir1."/tex.exe" ); +add_texbindir_to_path($wr_dir1); +print_search_paths(); +print "tex.exe found in " . + TeXLive::TLWinGoo::win_which_dir("tex.exe") . "\n"; + +my $wr_dir2 = $wr_dir . "/tex2"; +mkdir $wr_dir2 unless -e $wr_dir2; +create_file( $wr_dir2."/tex.exe" ); +add_texbindir_to_path($wr_dir2); +print_search_paths(); +print "tex.exe found in " . + TeXLive::TLWinGoo::win_which_dir("tex.exe") . "\n"; + +# the problem case: no admin, but TeX on system path + +if (!admin()) { + my $fn = expand_string("%windir%")."/TEX.EXE"; + $fn =~ s/\\/\//g; + create_file($fn); # a tex.exe on the system path! + add_texbindir_to_path(expand_string($wr_dir2)); + my @wge = wg_error(); + if (@wge) { + print $wge[1]."\n"; + } + print_search_paths(); + print "tex.exe found in " . TeXLive::TLWinGoo::win_which_dir("tex.exe") . "\n"; + unlink $fn; +} + +# adding a filetype + +register_script_type(".rb","x:/ruby/bin/ruby.exe"); + +# broadcast environment changes + +broadcast_env(); |