From 9e04df05a8e92473e9dfad20334059013c764d13 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 18 Mar 2013 23:18:33 +0000 Subject: (make_zip): support for install-tl.exe, via nsis; by Siep git-svn-id: svn://tug.org/texlive/trunk@29425 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/bin/install-tl.nsi | 262 ----------------------------- Master/tlpkg/bin/tl-update-install-pkg | 43 +++-- Master/tlpkg/bin/tl-update-install-pkg.pat | 102 ----------- Master/tlpkg/libexec/install-tl.nsi | 262 +++++++++++++++++++++++++++++ 4 files changed, 288 insertions(+), 381 deletions(-) delete mode 100644 Master/tlpkg/bin/install-tl.nsi delete mode 100644 Master/tlpkg/bin/tl-update-install-pkg.pat create mode 100644 Master/tlpkg/libexec/install-tl.nsi (limited to 'Master') diff --git a/Master/tlpkg/bin/install-tl.nsi b/Master/tlpkg/bin/install-tl.nsi deleted file mode 100644 index d03b4330f37..00000000000 --- a/Master/tlpkg/bin/install-tl.nsi +++ /dev/null @@ -1,262 +0,0 @@ -!include nsDialogs.nsh -!include WinVer.nsh -; !include LogicLib.nsh ; already loaded by either of the above - -!include "FileFunc.nsh" - -!macro NSD_SetUserData hwnd data - nsDialogs::SetUserData ${hwnd} ${data} -!macroend -!define NSD_SetUserData `!insertmacro NSD_SetUserData` - -!macro NSD_GetUserData hwnd outvar - nsDialogs::GetUserData ${hwnd} - Pop ${outvar} -!macroend -!define NSD_GetUserData `!insertmacro NSD_GetUserData` - -!include tlsubdir.nsh ; generated by tl-update-install-pkg - -Name "TeX Live Installer ${YYYYMMDD}" -OutFile install-tl.exe - -Caption "TeX Live installer" -SubCaption 2 ": Unpack directory" -SubCaption 4 ": Unpacking..." - -XPStyle on -RequestExecutionLevel user - -SetCompressor /SOLID bzip2 - -; Controls: installation type -Var Dialog -Var Label -Var RadioSimple -Var RadioAdvanced -Var RadioUnpack - -; Controls: confirmation page -Var Confirm -Var Explain - -; values for installation type -Var Radio_Value -Var Radio_Default -Var Radio_Temp - -Var Admin_warning -Var Completed_text -CompletedText $Completed_text -Var InstOrUnpack -;Var NextOrUnpack -;MiscButtonText "" $NextOrUnpack "" "" -InstallButtonText $InstOrUnpack - -; for local testing: -Var REPO - -Page custom tlOptionsPage tlOptionsPageLeave -Page directory dirPre "" dirLeave -Page custom ConfirmPage ConfirmLeave -Page instfiles - -Function .onInit - - ${If} ${AtMostWin2000} - MessageBox MB_OK|MB_ICONSTOP \ - "Windows XP earliest supported version; aborting..." - Abort - ${EndIf} - - InitPluginsDir - StrCpy $INSTDIR $PLUGINSDIR - - UserInfo::GetAccountType - Pop $0 - ${If} $0 == "Admin" - StrCpy $Admin_warning "" - ${Else} ; failure or no admin permissions - StrCpy $Admin_warning "Only single-user install possible.$\r$\nFor an all-users installation, abort now and re-run as administrator.$\r$\n" - ${EndIf} - - StrCpy $Radio_Default "simple" - StrCpy $Radio_Value $Radio_Default - ;StrCpy $NextOrUnpack "Next" - -FunctionEnd - -Function dirPre - - ${If} $Radio_Value != "unpack" - Abort - ${EndIf} - -FunctionEnd - -Function dirLeave - - Push $0 - - ${DirState} "$INSTDIR\${INST_TL_NAME}" $0 - ${If} $0 == 1 - MessageBox MB_YESNO \ - "OK to replace contents of $INSTDIR\${INST_TL_NAME}?" \ - IDYES continue - Abort - continue: - RMDir /r "$INSTDIR\${INST_TL_NAME}" - ${EndIf} - - Pop $0 - -FunctionEnd - -DirText "Directory to unpack the TeX Live installer" - -Function tlOptionsPage - - nsDialogs::Create 1018 - Pop $Dialog - - ${If} $Dialog == error - Abort - ${EndIf} - - - ${NSD_CreateLabel} 0 0 100% 24u $Admin_warning - Pop $Label - - ${NSD_CreateRadioButton} 0 35u 100% 9u "Simple install (big)" - Pop $RadioSimple - ${NSD_SetUserData} $RadioSimple $Radio_Default ; set to "simple" in .onInit - - ${NSD_CreateRadioButton} 0 50u 100% 9u "Custom install" - Pop $RadioAdvanced - ${NSD_SetUserData} $RadioAdvanced "advanced" - - ${NSD_CreateRadioButton} 0 65u 100% 9u "Unpack only" - Pop $RadioUnpack - ${NSD_SetUserData} $RadioUnpack "unpack" - - Call Value_to_States - - ${NSD_OnClick} $RadioSimple UpdateRadio - ${NSD_OnClick} $RadioAdvanced UpdateRadio - ${NSD_OnClick} $RadioUnpack UpdateRadio - - nsDialogs::Show - -FunctionEnd - -Function tlOptionsPageLeave - - Call Value_to_States - ${If} $Radio_Value == "unpack" - StrCpy $INSTDIR "$DESKTOP" - StrCpy $Completed_text \ - "Done; next run install-tl.bat or install-tl-advanced.bat." - StrCpy $InstOrUnpack "Unpack" - ;StrCpy $NextOrUnpack "Next" - ${Else} - StrCpy $Completed_text "Completed" - StrCpy $InstOrUnpack "Install" - ;StrCpy $NextOrUnpack "Unpack" - ${EndIf} - -FunctionEnd - -Function Value_to_States - - ${NSD_Uncheck} $RadioSimple - ${NSD_Uncheck} $RadioAdvanced - ${NSD_Uncheck} $RadioUnpack - ${NSD_GetUserData} $RadioSimple $Radio_Temp - ${If} $Radio_Temp == $Radio_Value - ${NSD_Check} $RadioSimple - ${EndIf} - ${NSD_GetUserData} $RadioAdvanced $Radio_Temp - ${If} $Radio_Temp == $Radio_Value - ${NSD_Check} $RadioAdvanced - ${EndIf} - ${NSD_GetUserData} $RadioUnpack $Radio_Temp - ${If} $Radio_Temp == $Radio_Value - ${NSD_Check} $RadioUnpack - ${EndIf} - -FunctionEnd - -Function UpdateRadio - - Pop $1 - ${NSD_GetUserData} $1 $Radio_Value - -FunctionEnd - -Function ConfirmPage - - ;${If} $Radio_Value == "unpack" - ; Abort - ;${EndIf} - - nsDialogs::Create 1018 - Pop $Confirm - - ${If} $Confirm == error - Abort - ${EndIf} - - ${If} $Radio_Value == "unpack" - ${NSD_CreateLabel} 0 30% 100% 80u \ - "The main installer will be unpacked into $INSTDIR\${INST_TL_NAME}.$\r$\n$\r$\ninstall-tl.bat and install-tl-advanced.bat will start the main installer." - ${ElseIf} $Radio_Value == "advanced" - ${NSD_CreateLabel} 0 30% 100% 80u \ - "Click 'Install' to start the main installer,$\r$\nwhich lets you select components and an installation directory.$\r$\n$\r$\nUnpacking the main installer may take a moment..." - ${Else} - ${NSD_CreateLabel} 0 30% 100% 80u \ - "Click 'Install' to start the main installer,$\r$\nwhich lets you select an installation directory.$\r$\n$\r$\nUnpacking the main installer may take a moment..." - ${EndIf} - Pop $Explain - - nsDialogs::Show - -FunctionEnd - -Function ConfirmLeave - -FunctionEnd - -Section - - ${GetParameters} $REPO - ${If} $REPO != "" - StrCpy $REPO "-repository $REPO" - ${EndIf} - ; for local testing: - ; StrCpy $REPO "-repository U:\systems\texlive\tlnet" - ; StrCpy $REPO "-repository D:\tlnet" - - ; Detailprint $Radio_Value - ; DetailPrint '-- $REPO --' - ${If} $Radio_Value == "unpack" - SetOutPath $INSTDIR - ${Else} - ; nsis uses $PLUGINSDIR for temporary files which will be - ; automatically cleared afterwards - SetOutPath $PLUGINSDIR - ${EndIf} - - CreateDirectory $INSTDIR\${INST_TL_NAME} - - ; production code: - File /r ${INST_TL_NAME} - ; Quick interface testing: - ; File /oname=${INST_TL_NAME}\README ${INST_TL_NAME}\README - - ${If} $Radio_Value == "advanced" - nsExec::Exec '"$INSTDIR\${INST_TL_NAME}\install-tl.bat" -gui perltk $REPO' - ${ElseIf} $Radio_Value == "simple" - nsExec::Exec '"$INSTDIR\${INST_TL_NAME}\install-tl.bat" $REPO' - ${EndIf} - -SectionEnd diff --git a/Master/tlpkg/bin/tl-update-install-pkg b/Master/tlpkg/bin/tl-update-install-pkg index 7b356028629..d8b8aa5ed2c 100755 --- a/Master/tlpkg/bin/tl-update-install-pkg +++ b/Master/tlpkg/bin/tl-update-install-pkg @@ -1,12 +1,13 @@ #!/usr/bin/env perl # $Id$ # -# Copyright 2008, 2009 Reinhard Kotucha, Norbert Preining, Karl Berry +# Copyright 2008, 2009, 2013 Reinhard Kotucha, Norbert Preining, Karl Berry # This file is licensed under the GNU General Public License version 2 # or any later version. -# This script creates the zip (everything) and tgz (omits windows) -# archives to do a network install. Invoked from tl-update-tlnet. +# This script creates the zip (everything) and exe (everything, made +# with nsi) and tgz (omits windows files) files that are how users +# install TL over thenet. Invoked from tl-update-tlnet. BEGIN { $^W = 1; @@ -84,8 +85,7 @@ my $outputdir = $opt_outputdir; my @signals = qw(HUP INT ILL FPE SEGV TERM ABRT QUIT BUS PIPE); # -sub cleanup -{ +sub cleanup { if (-d $tmpdir) { system ('rm', '-rf', $tmpdir); } @@ -171,6 +171,7 @@ make_zip ("tgz"); copy_files (@win32); make_zip ("zip"); +make_zip ("nsis"); install_files (); @@ -180,8 +181,7 @@ cleanup (); # copy files from the repository to $inst_tmp. # -sub copy_files -{ +sub copy_files { my ($dir, $file); for (@_) { if ($_ !~ m!/!) { @@ -195,30 +195,39 @@ sub copy_files } -# create the .tar.gz and the .zip files. +# create the .tar.gz, .zip, .exe (nsis) install packages. # -sub make_zip -{ +sub make_zip { my ($type) = @_; info ("$0: Making $type...\n"); chdir ($tmpdir) || die "chdir($tmpdir) failed: $!"; if ($type eq 'zip') { system ('zip', '-rq', 'install-tl.zip', $install_tl_name); - } else { + + } elsif ($type eq 'nsis') { + # write include file for dated install directory. + my $nsh = "$tmpdir/tlsubdir.nsh"; + system ("echo !define YYYYMMDD '$YYYYMMDD' >\"$nsh\""); + system ("echo !define INST_TL_NAME '$install_tl_name' >>\"$nsh\""); + copy ("$::installerdir/tlpkg/libexec/install-tl.nsi", $tmpdir); + system ('makensis', 'install-tl'); + + } elsif ($type eq 'tgz') { system ('tar', '-czf', 'install-tl-unx.tar.gz', $install_tl_name); - } - chdir ($installerdir) || die "chdir($installerdir) failed: $!"; + + } else ( + die "unknown install package type $type"; + ) } -# copy generated zip+tgz to outputdir, +# copy generated install packages to outputdir, # -sub install_files -{ +sub install_files { $outputdir = abs_path ($outputdir); info ("$0: Installing to $outputdir\n"); - for my $f ("install-tl-unx.tar.gz", "install-tl.zip") { + for my $f ("install-tl-unx.tar.gz", "install-tl.zip", "install-tl.exe") { copy ("$tmpdir/$f", $outputdir); system ("cd $outputdir && sha256sum $f >$f.sha256"); system ('ls', '-l', "$outputdir/$f"); diff --git a/Master/tlpkg/bin/tl-update-install-pkg.pat b/Master/tlpkg/bin/tl-update-install-pkg.pat deleted file mode 100644 index f2033d689a4..00000000000 --- a/Master/tlpkg/bin/tl-update-install-pkg.pat +++ /dev/null @@ -1,102 +0,0 @@ -*** tl-update-install-pkg 2009-10-10 01:54:07.000000000 +0200 ---- tl-update-install-pkg-new 2013-03-17 11:23:31.000000000 +0100 -*************** -*** 1,7 **** - #!/usr/bin/env perl - # $Id: tl-update-install-pkg 15732 2009-10-09 23:54:07Z karl $ - # -! # Copyright 2008, 2009 Reinhard Kotucha, Norbert Preining, Karl Berry - # This file is licensed under the GNU General Public License version 2 - # or any later version. - ---- 1,7 ---- - #!/usr/bin/env perl - # $Id: tl-update-install-pkg 15732 2009-10-09 23:54:07Z karl $ - # -! # Copyright 2008, 2009, 2013 Reinhard Kotucha, Norbert Preining, Karl Berry - # This file is licensed under the GNU General Public License version 2 - # or any later version. - -*************** -*** 159,165 **** - } - - my @win32 = (); -! push (@win32, @unix); - if (defined $tlpbin{"win32"}) { - push (@win32, @{$tlpbin{"win32"}}); - } ---- 159,165 ---- - } - - my @win32 = (); -! #push (@win32, @unix); # is this necessary? - if (defined $tlpbin{"win32"}) { - push (@win32, @{$tlpbin{"win32"}}); - } -*************** -*** 171,176 **** ---- 171,177 ---- - - copy_files (@win32); - make_zip ("zip"); -+ make_zip ("nsis"); - - install_files (); - -*************** -*** 205,210 **** ---- 206,217 ---- - chdir ($tmpdir) || die "chdir($tmpdir) failed: $!"; - if ($type eq 'zip') { - system ('zip', '-rq', 'install-tl.zip', $install_tl_name); -+ } elsif ($type eq 'nsis') { -+ # write include file for dated install directory -+ system ("echo !define YYYYMMDD '$YYYYMMDD' >\"$tmpdir/tlsubdir.nsh\""); -+ system ("echo !define INST_TL_NAME '$install_tl_name' >>\"$tmpdir/tlsubdir.nsh\""); -+ copy ("$::installerdir/tlpkg/bin/install-tl.nsi", $tmpdir); -+ system ('makensis', 'install-tl'); - } else { - system ('tar', '-czf', 'install-tl-unx.tar.gz', $install_tl_name); - } -*************** -*** 212,228 **** - } - - -! # copy generated zip+tgz to outputdir, - # - sub install_files - { - $outputdir = abs_path ($outputdir); - info ("$0: Installing to $outputdir\n"); -! for my $f ("install-tl-unx.tar.gz", "install-tl.zip") { - copy ("$tmpdir/$f", $outputdir); - system ("cd $outputdir && sha256sum $f >$f.sha256"); - system ('ls', '-l', "$outputdir/$f"); - } - - # create unpacked installer that can run in that directory, - # for the sake of people mirroring. ---- 219,239 ---- - } - - -! # copy generated zip+tgz+nsi to outputdir, - # - sub install_files - { - $outputdir = abs_path ($outputdir); - info ("$0: Installing to $outputdir\n"); -! for my $f ("install-tl-unx.tar.gz", "install-tl.zip", "install-tl.exe") { - copy ("$tmpdir/$f", $outputdir); - system ("cd $outputdir && sha256sum $f >$f.sha256"); - system ('ls', '-l', "$outputdir/$f"); - } -+ for my $e ('', '.sha256') { -+ rename ("$outputdir/install-tl.exe$e", -+ "$outputdir/install-tl-experimental.exe$e"); -+ } - - # create unpacked installer that can run in that directory, - # for the sake of people mirroring. diff --git a/Master/tlpkg/libexec/install-tl.nsi b/Master/tlpkg/libexec/install-tl.nsi new file mode 100644 index 00000000000..d03b4330f37 --- /dev/null +++ b/Master/tlpkg/libexec/install-tl.nsi @@ -0,0 +1,262 @@ +!include nsDialogs.nsh +!include WinVer.nsh +; !include LogicLib.nsh ; already loaded by either of the above + +!include "FileFunc.nsh" + +!macro NSD_SetUserData hwnd data + nsDialogs::SetUserData ${hwnd} ${data} +!macroend +!define NSD_SetUserData `!insertmacro NSD_SetUserData` + +!macro NSD_GetUserData hwnd outvar + nsDialogs::GetUserData ${hwnd} + Pop ${outvar} +!macroend +!define NSD_GetUserData `!insertmacro NSD_GetUserData` + +!include tlsubdir.nsh ; generated by tl-update-install-pkg + +Name "TeX Live Installer ${YYYYMMDD}" +OutFile install-tl.exe + +Caption "TeX Live installer" +SubCaption 2 ": Unpack directory" +SubCaption 4 ": Unpacking..." + +XPStyle on +RequestExecutionLevel user + +SetCompressor /SOLID bzip2 + +; Controls: installation type +Var Dialog +Var Label +Var RadioSimple +Var RadioAdvanced +Var RadioUnpack + +; Controls: confirmation page +Var Confirm +Var Explain + +; values for installation type +Var Radio_Value +Var Radio_Default +Var Radio_Temp + +Var Admin_warning +Var Completed_text +CompletedText $Completed_text +Var InstOrUnpack +;Var NextOrUnpack +;MiscButtonText "" $NextOrUnpack "" "" +InstallButtonText $InstOrUnpack + +; for local testing: +Var REPO + +Page custom tlOptionsPage tlOptionsPageLeave +Page directory dirPre "" dirLeave +Page custom ConfirmPage ConfirmLeave +Page instfiles + +Function .onInit + + ${If} ${AtMostWin2000} + MessageBox MB_OK|MB_ICONSTOP \ + "Windows XP earliest supported version; aborting..." + Abort + ${EndIf} + + InitPluginsDir + StrCpy $INSTDIR $PLUGINSDIR + + UserInfo::GetAccountType + Pop $0 + ${If} $0 == "Admin" + StrCpy $Admin_warning "" + ${Else} ; failure or no admin permissions + StrCpy $Admin_warning "Only single-user install possible.$\r$\nFor an all-users installation, abort now and re-run as administrator.$\r$\n" + ${EndIf} + + StrCpy $Radio_Default "simple" + StrCpy $Radio_Value $Radio_Default + ;StrCpy $NextOrUnpack "Next" + +FunctionEnd + +Function dirPre + + ${If} $Radio_Value != "unpack" + Abort + ${EndIf} + +FunctionEnd + +Function dirLeave + + Push $0 + + ${DirState} "$INSTDIR\${INST_TL_NAME}" $0 + ${If} $0 == 1 + MessageBox MB_YESNO \ + "OK to replace contents of $INSTDIR\${INST_TL_NAME}?" \ + IDYES continue + Abort + continue: + RMDir /r "$INSTDIR\${INST_TL_NAME}" + ${EndIf} + + Pop $0 + +FunctionEnd + +DirText "Directory to unpack the TeX Live installer" + +Function tlOptionsPage + + nsDialogs::Create 1018 + Pop $Dialog + + ${If} $Dialog == error + Abort + ${EndIf} + + + ${NSD_CreateLabel} 0 0 100% 24u $Admin_warning + Pop $Label + + ${NSD_CreateRadioButton} 0 35u 100% 9u "Simple install (big)" + Pop $RadioSimple + ${NSD_SetUserData} $RadioSimple $Radio_Default ; set to "simple" in .onInit + + ${NSD_CreateRadioButton} 0 50u 100% 9u "Custom install" + Pop $RadioAdvanced + ${NSD_SetUserData} $RadioAdvanced "advanced" + + ${NSD_CreateRadioButton} 0 65u 100% 9u "Unpack only" + Pop $RadioUnpack + ${NSD_SetUserData} $RadioUnpack "unpack" + + Call Value_to_States + + ${NSD_OnClick} $RadioSimple UpdateRadio + ${NSD_OnClick} $RadioAdvanced UpdateRadio + ${NSD_OnClick} $RadioUnpack UpdateRadio + + nsDialogs::Show + +FunctionEnd + +Function tlOptionsPageLeave + + Call Value_to_States + ${If} $Radio_Value == "unpack" + StrCpy $INSTDIR "$DESKTOP" + StrCpy $Completed_text \ + "Done; next run install-tl.bat or install-tl-advanced.bat." + StrCpy $InstOrUnpack "Unpack" + ;StrCpy $NextOrUnpack "Next" + ${Else} + StrCpy $Completed_text "Completed" + StrCpy $InstOrUnpack "Install" + ;StrCpy $NextOrUnpack "Unpack" + ${EndIf} + +FunctionEnd + +Function Value_to_States + + ${NSD_Uncheck} $RadioSimple + ${NSD_Uncheck} $RadioAdvanced + ${NSD_Uncheck} $RadioUnpack + ${NSD_GetUserData} $RadioSimple $Radio_Temp + ${If} $Radio_Temp == $Radio_Value + ${NSD_Check} $RadioSimple + ${EndIf} + ${NSD_GetUserData} $RadioAdvanced $Radio_Temp + ${If} $Radio_Temp == $Radio_Value + ${NSD_Check} $RadioAdvanced + ${EndIf} + ${NSD_GetUserData} $RadioUnpack $Radio_Temp + ${If} $Radio_Temp == $Radio_Value + ${NSD_Check} $RadioUnpack + ${EndIf} + +FunctionEnd + +Function UpdateRadio + + Pop $1 + ${NSD_GetUserData} $1 $Radio_Value + +FunctionEnd + +Function ConfirmPage + + ;${If} $Radio_Value == "unpack" + ; Abort + ;${EndIf} + + nsDialogs::Create 1018 + Pop $Confirm + + ${If} $Confirm == error + Abort + ${EndIf} + + ${If} $Radio_Value == "unpack" + ${NSD_CreateLabel} 0 30% 100% 80u \ + "The main installer will be unpacked into $INSTDIR\${INST_TL_NAME}.$\r$\n$\r$\ninstall-tl.bat and install-tl-advanced.bat will start the main installer." + ${ElseIf} $Radio_Value == "advanced" + ${NSD_CreateLabel} 0 30% 100% 80u \ + "Click 'Install' to start the main installer,$\r$\nwhich lets you select components and an installation directory.$\r$\n$\r$\nUnpacking the main installer may take a moment..." + ${Else} + ${NSD_CreateLabel} 0 30% 100% 80u \ + "Click 'Install' to start the main installer,$\r$\nwhich lets you select an installation directory.$\r$\n$\r$\nUnpacking the main installer may take a moment..." + ${EndIf} + Pop $Explain + + nsDialogs::Show + +FunctionEnd + +Function ConfirmLeave + +FunctionEnd + +Section + + ${GetParameters} $REPO + ${If} $REPO != "" + StrCpy $REPO "-repository $REPO" + ${EndIf} + ; for local testing: + ; StrCpy $REPO "-repository U:\systems\texlive\tlnet" + ; StrCpy $REPO "-repository D:\tlnet" + + ; Detailprint $Radio_Value + ; DetailPrint '-- $REPO --' + ${If} $Radio_Value == "unpack" + SetOutPath $INSTDIR + ${Else} + ; nsis uses $PLUGINSDIR for temporary files which will be + ; automatically cleared afterwards + SetOutPath $PLUGINSDIR + ${EndIf} + + CreateDirectory $INSTDIR\${INST_TL_NAME} + + ; production code: + File /r ${INST_TL_NAME} + ; Quick interface testing: + ; File /oname=${INST_TL_NAME}\README ${INST_TL_NAME}\README + + ${If} $Radio_Value == "advanced" + nsExec::Exec '"$INSTDIR\${INST_TL_NAME}\install-tl.bat" -gui perltk $REPO' + ${ElseIf} $Radio_Value == "simple" + nsExec::Exec '"$INSTDIR\${INST_TL_NAME}\install-tl.bat" $REPO' + ${EndIf} + +SectionEnd -- cgit v1.2.3