So I'm trying to build an NSIS installer where I need to embed multiple PowerShell scripts that launch processes in an MSYS2 terminal.
One of my PowerShell script is structured like this:
# This is the script that updates MSYS2 for the user
bash -1 -c "pacman -Syuu --noconfirm"
bash -1 -c "pacman -Sy mingw-w64-x86_64-make --noconfirm"
bash -1 -c "pacman -Syu gcc --noconfirm"
!include psexec.nsh
The syntax is described here: Invoke MSYS2 Shell from Command Prompt or PowerShell
The NSIS section I'm writing to access the PowerShell script is
# start prerequisites section
Section -Prerequisites "Install Prerequisites needed"
SetOutPath $INSTDIR\\Prereqresites
MessageBox MB_YESNO "Install the latest version of MSYS2?" /SD IDYES IDNO endmsys2Setup
File "Prereqresites\msys2-x86_64-20201109.exe"
ExecWait "$INSTDIR\Prereqresites\msys2-x86_64-20201109.exe"
ExecWait "powershell -ExecutionPolicy Bypass -WindowStyle Hidden -File psexec.nsh\msys2_setup.ps1 -FFFeatureOff"
Goto endmsys2Setup
endmsys2Setup:
SectionEnd
Section close
SetAutoClose true
I just want to know what I might be doing wrong as I'm trying to use PowerShell scripts that are already written. NSIS documentation states that I should put it into a .nsh file.
https://nsis.sourceforge.io/PowerShell_support
Though I could be misinterpreting this as I'm new to NSIS and would welcome to be corrected.
Also, I'm trying to just link the PowerShell scripts I wrote correctly so that they trigger when the installer for MSYS2 finishes and that way things are updated in the MSYS2 terminal for the user and they have all the dependencies needed to run CmdStan.
This is part of a larger install process that is featured here for CmdStan. https://github.com/bparbhu/CmdStan-Windows10-Installer
I currently have an installer that does this through linux: https://github.com/bparbhu/CmdStan-Linux-Installer
So the goal for using NSIS would be to create an easier installation process for Windows users.
What I'm trying to do overall is install something that can only be installed via the MSYS2 terminal but I have to go through PowerShell as a proxy to launch MSYS2.
I'm not exactly sure how to write a PowerShell Macro to cite commands that launch msys2 terminal code. Any help or feedback is much appreciated.