From bb7ca2b540ca8a15459c1f1a1aa61915494e2667 Mon Sep 17 00:00:00 2001 From: Piotr Strzelczyk Date: Sat, 9 May 2009 16:30:00 +0000 Subject: additions to installer .bat launcher: detection of OS, network drives and path adjustment without embedded perl script git-svn-id: svn://tug.org/texlive/branches/branch2009-dev@13021 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl.bat | 104 ++++++++++++++++++++++++++++++------------------- Master/tl-portable.bat | 54 ++++++++++++++++++++----- 2 files changed, 109 insertions(+), 49 deletions(-) diff --git a/Master/install-tl.bat b/Master/install-tl.bat index 8b0dbc3f75d..068e3250db8 100755 --- a/Master/install-tl.bat +++ b/Master/install-tl.bat @@ -1,48 +1,74 @@ @echo off -setlocal - -rem TeX Live Root; ends with backslash -set tlroot=%~dp0 -set tldrive=%~d0 - -%tldrive% -cd %tlroot% - -rem use provided Perl -set PERL5LIB=%tlroot%tlpkg\tlperl\lib -path %tlroot%tlpkg\tlperl\bin;%path% - -rem remove TeX directories from searchpath with -rem some embedded Perl and a temporary batchfile. -rem If it is done in the Perl installer then it may not work right. -perl -x "%~dpn0.bat" -goto fixpath - -#! perl -my @newpt = (); -foreach my $d (split (';', $ENV{'PATH'})) { - my $df = $d; - $df =~ s/\\/\//g; - push @newpt, $d unless (-e ($df."/pdftex.exe")); -} -$ENV{'PATH'} = join(';',@newpt); -my $batfile = $ENV{'TEMP'}."\\setpath.bat"; -$batfile =~ s/\\/\//g; -open TMPBAT, ">$batfile"; -print TMPBAT 'path '.$ENV{'PATH'}."\n"; -close TMPBAT; -__END__ - -:fixpath -call %TEMP%\setpath.bat -echo Path: %path% -rem del %TEMP%\setpath.bat +rem Wrapper script to set up environment for installer +rem +rem Copyright 2009 by Tomasz M. Trzeciak +rem Public Domain + +rem First, check if this is DOS based system +rem in DOS '&' is just a normal character +echo.>nul & goto continue +goto DOS +:continue + +rem Now check for Windows NT which is also not supported +ver | find "NT" +if not errorlevel 1 goto WinNT + +rem Abort if we are running from UNC path +if %~d0==\\ goto UNC + +rem Localize environment changes +setlocal enableextensions + +rem Do we really need to cd to the batch location? +cd /d %~dp0 + +rem Break search path into dir list and rebuild w/o tex dirs +call :rebuildpath ";" "%path:;=" "%" + +rem Use TL Perl +path %~dp0tlpkg\tlperl\bin;%path% +set PERL5LIB=%~dp0tlpkg\tlperl\lib + +rem Start installer +path perl "%~dpn0" %* pause Done +goto :eof -rem endlocal is implicit +rem Subroutine to build search path without tex directories +rem any dir containing pdftex.exe is considered a tex dir +:rebuildpath ";" dir list ... +shift +rem The first argument (";") serves as a marker to reset the path +if "%~0"==";" set path= +rem Finish if no more arguments to process +if "%~1"=="" goto :eof +rem Continue if tex dir +if exist "%~1\pdftex.exe" goto :rebuildpath +rem Add dir to path +if not defined path (path %~1) else (path %path%;%~1) +goto :rebuildpath rem About install-tl.bat.manifest: rem Vista assumes that a file with install in the name is rem an installer and therefore requires administrative privileges. rem The manifest file tells Vista otherwise. + +:UNC +echo Cannot run from UNC path. +echo Map network drive to a drive letter and rerun the installer. +echo Use pushd/popd commands for temporary mapping. +pause +exit /b 1 + +:WinNT +echo Windows NT is not supported. Sorry. +echo Windows 2000 or newer is required. +pause +exit /b 1 + +:DOS +echo DOS and Windows 9x systems are not supported. Sorry. +echo Windows 2000 or newer is required. +pause diff --git a/Master/tl-portable.bat b/Master/tl-portable.bat index 3fcf68d8a70..98a52b2725c 100755 --- a/Master/tl-portable.bat +++ b/Master/tl-portable.bat @@ -1,11 +1,25 @@ @echo off - -rem Copyright 2008 Siep Kroonenberg. +rem Copyright 2008-2009 Siep Kroonenberg, Tomasz M. Trzeciak. rem You may freely use, modify and/or distribute this file. +rem First, check if this is DOS based system +rem in DOS '&' is just a normal character +echo.>nul & goto continue +goto DOS +:continue + +rem Now check for Windows NT which is also not supported +ver | find "NT" +if not errorlevel 1 goto WinNT + +rem Abort if we are running from UNC path +if %~d0==\\ goto UNC + +rem Localize environment changes +setlocal enableextensions + rem TeX Live Root; ends with backslash set TEXDIR=%~dp0 -set tldrive=%~d0 rem TEXDIR writable? set TEXDIRW=%USERPROFILE%\.tlportable2008\ @@ -38,14 +52,34 @@ set platform=win32 rem use provided Perl set PERL5LIB=%TEXDIR%tlpkg\tlperl\lib -path %TEXDIR%tlpkg\tlperl\bin;%path% +path %TEXDIR%tlpkg\tlperl\bin;%TEXDIR%bin\win32;%path% perl "%TEXDIR%install-tl" --portable -if not errorlevel 1 goto doit -echo Initialization of TeXLive failed! -pause -exit /b 1 +if errorlevel 1 goto failedinit -:doit -path %TEXDIR%bin\win32;%path% +rem start command interperter set PROMPT=TL $P$G %COMSPEC% /k +goto :eof + +:failedinit +echo Initialization of TeX Live failed! +pause +exit /b 1 + +:UNC +echo Cannot run from UNC path. +echo Map network drive to a drive letter and rerun the installer. +echo Use pushd/popd commands for temporary mapping. +pause +exit /b 1 + +:WinNT +echo Windows NT is not supported. Sorry. +echo Windows 2000 or newer is required. +pause +exit /b 1 + +:DOS +echo DOS and Windows 9x systems are not supported. Sorry. +echo Windows 2000 or newer is required. +pause -- cgit v1.2.3