summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2013-03-13 17:40:18 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2013-03-13 17:40:18 +0000
commit822d98439954f0fef863481b85be865206566fb5 (patch)
tree4eb1b385c1c95438df3fa8681be0d31e139041e9
parentcd3b6a9e7df0134fd69163a5e54e4ee7c59ad1c3 (diff)
Draft version of nsis wrapper for installer
git-svn-id: svn://tug.org/texlive/trunk@29368 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/tlpkg/bin/install-tl.nsi193
-rw-r--r--Master/tlpkg/bin/isadmin_q.cmd34
-rw-r--r--Master/tlpkg/bin/tl-update-install-pkg.pat62
3 files changed, 289 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/install-tl.nsi b/Master/tlpkg/bin/install-tl.nsi
new file mode 100644
index 00000000000..5bf3f6df5ee
--- /dev/null
+++ b/Master/tlpkg/bin/install-tl.nsi
@@ -0,0 +1,193 @@
+!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 ${INST_TL_NAME}.exe
+
+; ShowInstDetails show
+
+RequestExecutionLevel highest
+
+SetCompressor /SOLID bzip2
+
+; Controls
+Var Dialog
+Var Label
+Var RadioSimple
+Var RadioAdvanced
+Var RadioUnpack
+
+; values
+Var Radio_Value
+Var Radio_Default
+Var Radio_Temp
+Var Is_Admin
+
+Var Admin_warning
+Var Completed_text
+CompletedText $Completed_text
+
+; for local testing:
+Var REPO
+
+ReserveFile isadmin_q.cmd
+
+Page custom tlOptionsPage tlOptionsPageLeave
+Page directory dirPre
+Page instfiles
+
+Function dirPre
+
+ ${If} $Radio_Value != "unpack"
+ Abort
+ ${EndIf}
+
+FunctionEnd
+
+DirText "Directory to unpack the TeX Live installer.$\nClick Install to start unpacking."
+
+Function .onInit
+
+ ${If} ${AtMostWin2000}
+ MessageBox MB_OK|MB_ICONSTOP "Windows XP earliest supported version; aborting..."
+ Abort
+ ${EndIf}
+
+ InitPluginsDir
+ StrCpy $INSTDIR $PLUGINSDIR
+
+ File /oname=$PLUGINSDIR\isadmin_q.cmd "isadmin_q.cmd"
+ nsExec::ExecToStack '"cmd" /c "$PLUGINSDIR\isadmin_q.cmd"'
+ Pop $0
+
+ ${If} $0 == 0 ; Admin permissions
+ Push 1
+ Pop $Is_Admin
+ StrCpy $Admin_warning ""
+ #StrCpy $License_button "Continue"
+ ${Else} ; failure or no admin permissions
+ Push 0
+ Pop $Is_Admin
+ StrCpy $Admin_warning "Only single-user install possible.$\r$\nFor an all-users installation, abort now and re-run as administrator."
+ ${EndIf}
+
+ StrCpy $Radio_Default "simple"
+ StrCpy $Radio_Value $Radio_Default
+ StrCpy $Completed_text "Completed"
+
+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 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 $TEMP
+ StrCpy $Completed_text "Done unpacking; run install-tl.bat or install-tl-advanced.bat"
+ ${EndIf}
+
+FunctionEnd
+
+Function UpdateRadio
+
+ Pop $1
+ ${NSD_GetUserData} $1 $Radio_Value
+
+FunctionEnd
+
+Section
+
+ ${GetParameters} $REPO
+ ${If} $REPO != ""
+ StrCpy $REPO "-repository $REPO"
+ ${EndIf}
+ ; 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}
+ File /r ${INST_TL_NAME}\*.*
+ ; File ${INST_TL_NAME}\install-tl*
+ ${If} $Radio_Value == "advanced"
+ nsExec::Exec '"$INSTDIR\install-tl.bat" -gui perltk $REPO'
+ ; ExecWait '"$INSTDIR\install-tl.bat" -gui perltk $REPO'
+ ${ElseIf} $Radio_Value == "simple"
+ nsExec::Exec '"$INSTDIR\install-tl.bat" $REPO'
+ ; ExecWait '"$INSTDIR\install-tl.bat" $REPO'
+ ${EndIf}
+
+SectionEnd
diff --git a/Master/tlpkg/bin/isadmin_q.cmd b/Master/tlpkg/bin/isadmin_q.cmd
new file mode 100644
index 00000000000..22333e525fe
--- /dev/null
+++ b/Master/tlpkg/bin/isadmin_q.cmd
@@ -0,0 +1,34 @@
+@echo off
+setlocal enableextensions
+
+for /f "tokens=3" %%a in ('reg query "HKLM\software\microsoft\windows nt\currentversion" /v currentversion ^| findstr "REG_SZ"') do set ver=%%a
+
+rem echo %ver%
+
+rem The caller already tests for >=xp
+rem if %ver% leq 5.0 echo too old
+rem if %ver% leq 5.0 exit /b
+
+set el=1
+if %ver% geq 6.0 (
+ rem echo vista test
+ for /f "usebackq delims=, tokens=3" %%a in (`whoami /groups /fo csv`) do (
+ rem The second item is "type", hopefully without commas,
+ rem otherwise the parsing would break.
+ rem What comes after the 3rd token is irrelevant.
+ rem Alternatively, search the entire string for the sid with findstr.
+ rem echo %%a
+ if /i %%a=="S-1-16-12288" (
+ set el=0
+ )
+ )
+) else (
+ for /f "usebackq delims= skip=4" %%a in (`net localgroup Administrators`) do (
+ if /i "%%a"=="%username%" (
+ set el=0
+ )
+ )
+)
+exit %el%
+
+endlocal
diff --git a/Master/tlpkg/bin/tl-update-install-pkg.pat b/Master/tlpkg/bin/tl-update-install-pkg.pat
new file mode 100644
index 00000000000..54d92dd09cb
--- /dev/null
+++ b/Master/tlpkg/bin/tl-update-install-pkg.pat
@@ -0,0 +1,62 @@
+*** tl-update-install-pkg 2009-10-10 01:54:07.000000000 +0200
+--- tl-update-install-pkg-new 2013-03-13 18:33:44.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,218 ----
+ 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);
++ copy ("$::installerdir/tlpkg/bin/isadmin_q.cmd", $tmpdir);
++ system ('makensis', 'install-tl');
+ } else {
+ system ('tar', '-czf', 'install-tl-unx.tar.gz', $install_tl_name);
+ }