diff --git a/NSIS/signal-k-logo-image.bmp b/NSIS/signal-k-logo-image.bmp new file mode 100644 index 0000000..f3baccd Binary files /dev/null and b/NSIS/signal-k-logo-image.bmp differ diff --git a/NSIS/signalk-server.nsi b/NSIS/signalk-server.nsi index 39ebb70..526f61e 100644 --- a/NSIS/signalk-server.nsi +++ b/NSIS/signalk-server.nsi @@ -6,23 +6,35 @@ ;Include tools !include "tools.nsh" !include x64.nsh + !include WinVer.nsh + !include nsDialogs.nsh ;====================================================== ;Include Modern UI !include "MUI2.nsh" ;====================================================== ;General - !define INST_VERSION "0.4.3" + !define INST_VERSION "1.0.0" BrandingText "Signal K from http://signalk.org/" Name "Signal K installer ${INST_VERSION}" OutFile "..\output\signalk-server-setup-${INST_VERSION}.exe" InstallDir "c:\signalk" RequestExecutionLevel admin ; user | admin !define MUI_ICON "..\target\tools\signalk.ico" +; !define MUI_HEADERIMAGE +; !define MUI_HEADERIMAGE_BITMAP "signal-k-logo-image.bmp" ; 150x57 pixels +; !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH +; !define MUI_HEADERIMAGE_RIGHT +; !define MUI_WELCOMEFINISHPAGE_BITMAP "xxx.bmp" ; 164x314 pixels +; !define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH ;====================================================== ;Pages +;internal_page_type [pre_function] [show_function] [leave_function] [/ENABLECANCEL] !insertmacro MUI_PAGE_WELCOME +; !define MUI_PAGE_CUSTOMFUNCTION_PRE wel_pre +; !define MUI_PAGE_CUSTOMFUNCTION_SHOW wel_show !insertmacro MUI_PAGE_DIRECTORY ; !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" + Page custom nodejsAlertPre !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES @@ -46,8 +58,16 @@ Var /GLOBAL NODE64_ORG_DIR Var /GLOBAL NODE86_URL Var /GLOBAL NODE86_ORG_DIR + Var /GLOBAL W7_DETECTED + Var /GLOBAL LOG_FILE + Var /GLOBAL NODE_INSTALLED + Var /GLOBAL NODE_INSTALL + Var /GLOBAL NODE_UPGRADE + Var /GLOBAL NODE_SHORT_VERSION + Var /GLOBAL NODE_VERSION Function SetGlobalVars + LogSet on StrCpy $USERPROFILE $INSTDIR\signalkhome StrCpy $NODE_PATH '$INSTDIR\nodejs' StrCpy $NODE_MODULES_PATH '$INSTDIR\nodejs\node_modules' @@ -55,10 +75,22 @@ StrCpy $OPENSSL_BIN_PATH '$INSTDIR\openssl\bin' StrCpy $OPENSSL_CONF '$INSTDIR\openssl\openssl.cnf' StrCpy $TOOLS_PATH '$INSTDIR\tools' - StrCpy $NODE64_URL 'https://nodejs.org/dist/v10.23.0/node-v10.23.0-win-x64.zip' - StrCpy $NODE86_URL 'https://nodejs.org/dist/v10.23.0/node-v10.23.0-win-x86.zip' - StrCpy $NODE64_ORG_DIR 'node-v10.23.0-win-x64' - StrCpy $NODE86_ORG_DIR 'node-v10.23.0-win-x86' + ${If} ${AtLeastWin10} + StrCpy $NODE64_URL 'https://nodejs.org/dist/v16.13.2/node-v16.13.2-win-x64.zip' + StrCpy $NODE86_URL 'https://nodejs.org/dist/v16.13.2/node-v16.13.2-win-x86.zip' + StrCpy $NODE64_ORG_DIR 'node-v16.13.2-win-x64' + StrCpy $NODE86_ORG_DIR 'node-v16.13.2-win-x86' + StrCpy $NODE_VERSION 'v16.13.2' + StrCpy $NODE_SHORT_VERSION 'v16' + ${Else} + StrCpy $NODE64_URL 'https://nodejs.org/download/release/v12.22.9/node-v12.22.9-win-x64.zip' + StrCpy $NODE86_URL 'https://nodejs.org/download/release/v12.22.9/node-v12.22.9-win-x86.zip' + StrCpy $NODE64_ORG_DIR 'node-v12.22.9-win-x64' + StrCpy $NODE86_ORG_DIR 'node-v12.22.9-win-x86' + StrCpy $W7_DETECTED '1' + StrCpy $NODE_VERSION 'v12.22.9' + StrCpy $NODE_SHORT_VERSION 'v12' + ${EndIf} FunctionEnd !macro CreateInternetShortcutWithIcon FILEPATH URL ICONPATH ICONINDEX @@ -76,6 +108,10 @@ LogSet on SetDetailsView show LogText "Signal K installer version: ${INST_VERSION}" + ${IfNot} ${AtLeastWin10} + MessageBox MB_ICONEXCLAMATION|MB_OK "Your current version of Windows is lower than Windows 10,$\nNodeJS 12 will be installed instead of NodeJS 16.$\nLimited support for Signal K server versions > 1.40.0." + LogText "Windows version < 10 detected, install NodeJS 12" + ${EndIf} LogSet off FunctionEnd ;====================================================== @@ -120,7 +156,7 @@ Push $NODE_PATH Call ConvertBStoDBS Pop $R1 - FileWrite $9 'process.env.Path = "$R1;$R0;" + process.env.Path$\r$\n' + FileWrite $9 'process.env.Path = "$R1;$R0;" + process.env.Path$\r$\n' Push $NODE_MODULES_PATH Call ConvertBStoDBS Pop $R0 @@ -179,14 +215,15 @@ FileOpen $9 $TOOLS_PATH\remove-signalk-server-services.cmd w FileWrite $9 '@ECHO OFF$\r$\n' FileWrite $9 'echo "Remove signalk as service in progress..."$\r$\n' + FileWrite $9 'net stop "signalkservernode.exe"$\r$\n' FileWrite $9 'SC DELETE "signalkservernode.exe"$\r$\n' FileWrite $9 'if %ERRORLEVEL% neq 0 goto :ERROR$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 0$\r$\n' + FileWrite $9 'exit /b 0$\r$\n' FileWrite $9 ':ERROR$\r$\n' FileWrite $9 'echo "An ERROR has occurred."$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 1$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' FileWrite $9 '$\r$\n' FileClose $9 @@ -200,11 +237,11 @@ FileWrite $9 'cd $TOOLS_PATH$\r$\n' FileWrite $9 'node .\install-signalk-server-services.js$\r$\n' FileWrite $9 'if %ERRORLEVEL% neq 0 goto :ERROR$\r$\n' - FileWrite $9 'exit 0$\r$\n' + FileWrite $9 'exit /b 0$\r$\n' FileWrite $9 ':ERROR$\r$\n' FileWrite $9 'echo An ERROR has occurred.$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 1$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' FileWrite $9 '$\r$\n' FileClose $9 @@ -214,11 +251,11 @@ FileWrite $9 'echo Stop Signal K service...$\r$\n' FileWrite $9 'net stop "signalkservernode.exe"$\r$\n' FileWrite $9 'if %ERRORLEVEL% neq 0 goto :ERROR$\r$\n' - FileWrite $9 'exit 0$\r$\n' + FileWrite $9 'exit /b 0$\r$\n' FileWrite $9 ':ERROR$\r$\n' FileWrite $9 'echo An ERROR has occurred.$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 1$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' FileWrite $9 '$\r$\n' FileClose $9 @@ -232,59 +269,96 @@ FileWrite $9 ':ERROR_ADMIN$\r$\n' FileWrite $9 'echo ERROR: This command must be "Run as Administrator"$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 1$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' FileWrite $9 ':STOP_SERVICE$\r$\n' FileWrite $9 'net stop "signalkservernode.exe" >nul 2>&1$\r$\n' FileWrite $9 'net start "signalkservernode.exe"$\r$\n' FileWrite $9 'if %ERRORLEVEL% neq 0 goto :ERROR_START$\r$\n' - FileWrite $9 'exit 0$\r$\n' + FileWrite $9 'exit /b 0$\r$\n' FileWrite $9 ':ERROR_START$\r$\n' FileWrite $9 'echo An ERROR has occurred.$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 1$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' FileWrite $9 '$\r$\n' FileClose $9 DetailPrint "Create $TOOLS_PATH\npm-install-node-windows.cmd" + StrCpy $LOG_FILE "npm-inst-node-windows.log" FileOpen $9 $TOOLS_PATH\npm-install-node-windows.cmd w FileWrite $9 '@ECHO OFF$\r$\n' FileWrite $9 '$INSTALL_DRIVE$\r$\n' - FileWrite $9 'echo Install node-windows package in progress...$\r$\n' + FileWrite $9 'echo Install node-windows service package in progress...$\r$\n' + FileWrite $9 'echo Install log saved in $INSTDIR\$LOG_FILE file$\r$\n' + FileWrite $9 'echo Please wait ...$\r$\n' FileWrite $9 'set USERPROFILE=$USERPROFILE$\r$\n' FileWrite $9 'set NODE_PATH=$NODE_PATH$\r$\n' FileWrite $9 'set "Path=%NODE_PATH%;%Path%"$\r$\n' FileWrite $9 'set OPENSSL_CONF=$OPENSSL_CONF$\r$\n' FileWrite $9 'cd $NODE_PATH$\r$\n' - FileWrite $9 'npm install -g --unsafe-perm node-windows@1.0.0-beta.5$\r$\n' + FileWrite $9 'echo "start: npm install -g --unsafe-perm node-windows@1.0.0-beta.5" 1>>$INSTDIR\$LOG_FILE 2>&1$\r$\n' + FileWrite $9 'call npm install -g --unsafe-perm node-windows@1.0.0-beta.5 1>>$INSTDIR\$LOG_FILE 2>&1$\r$\n' FileWrite $9 'if %ERRORLEVEL% neq 0 goto :ERROR$\r$\n' - FileWrite $9 'exit 0$\r$\n' + FileWrite $9 'exit /b 0$\r$\n' FileWrite $9 ':ERROR$\r$\n' FileWrite $9 'echo An ERROR has occurred.$\r$\n' + FileWrite $9 'echo See the $INSTDIR\$LOG_FILE file$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 1$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' FileWrite $9 '$\r$\n' FileClose $9 DetailPrint "Create $TOOLS_PATH\npm-install-signalk-server.cmd" + StrCpy $LOG_FILE "npm-inst-signalk-server.log" FileOpen $9 $TOOLS_PATH\npm-install-signalk-server.cmd w FileWrite $9 '@ECHO OFF$\r$\n' FileWrite $9 '$INSTALL_DRIVE$\r$\n' FileWrite $9 'echo Install signalk-server package in progress...$\r$\n' + FileWrite $9 'echo Install log saved in $INSTDIR\$LOG_FILE file$\r$\n' + FileWrite $9 'echo Please wait this may take some time ...$\r$\n' FileWrite $9 'set USERPROFILE=$USERPROFILE$\r$\n' FileWrite $9 'set NODE_PATH=$NODE_PATH$\r$\n' FileWrite $9 'set "Path=%NODE_PATH%;%Path%"$\r$\n' FileWrite $9 'set OPENSSL_CONF=$OPENSSL_CONF$\r$\n' FileWrite $9 'cd $NODE_PATH$\r$\n' - FileWrite $9 'npm install -g --unsafe-perm signalk-server$\r$\n' + FileWrite $9 'echo "start: npm install -g --unsafe-perm signalk-server" 1>>$INSTDIR\$LOG_FILE 2>&1$\r$\n' + FileWrite $9 'call npm install -g --unsafe-perm signalk-server 1>>$INSTDIR\$LOG_FILE 2>&1$\r$\n' FileWrite $9 'if %ERRORLEVEL% neq 0 goto :ERROR$\r$\n' - FileWrite $9 'exit 0$\r$\n' + FileWrite $9 'exit /b 0$\r$\n' FileWrite $9 ':ERROR$\r$\n' FileWrite $9 'echo An ERROR has occurred.$\r$\n' + FileWrite $9 'echo See the $INSTDIR\$LOG_FILE file$\r$\n' FileWrite $9 'pause$\r$\n' - FileWrite $9 'exit 1$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' FileWrite $9 '$\r$\n' FileClose $9 + ${If} $W7_DETECTED == "1" + DetailPrint "Create $TOOLS_PATH\npm-install-serial.cmd for Windows 7" + StrCpy $LOG_FILE "npm-inst-serial.log" + FileOpen $9 $TOOLS_PATH\npm-install-serial.cmd w + FileWrite $9 '@ECHO OFF$\r$\n' + FileWrite $9 '$INSTALL_DRIVE$\r$\n' + FileWrite $9 'echo Install alternative package for serial port support in progress...$\r$\n' + FileWrite $9 'echo Install log saved in $INSTDIR\$LOG_FILE file$\r$\n' + FileWrite $9 'echo Please wait ...$\r$\n' + FileWrite $9 'set USERPROFILE=$USERPROFILE$\r$\n' + FileWrite $9 'set NODE_PATH=$NODE_PATH$\r$\n' + FileWrite $9 'set "Path=%NODE_PATH%;%Path%"$\r$\n' + FileWrite $9 'set OPENSSL_CONF=$OPENSSL_CONF$\r$\n' + FileWrite $9 'cd $NODE_PATH$\r$\n' + FileWrite $9 'echo "start: npm install -g --unsafe-perm serialport@10.1.0" 1>>$INSTDIR\$LOG_FILE 2>&1$\r$\n' + FileWrite $9 'call npm install -g --unsafe-perm serialport@10.1.0 1>>$INSTDIR\$LOG_FILE 2>&1$\r$\n' + FileWrite $9 'if %ERRORLEVEL% neq 0 goto :ERROR$\r$\n' + FileWrite $9 'exit /b 0$\r$\n' + FileWrite $9 ':ERROR$\r$\n' + FileWrite $9 'echo An ERROR has occurred.$\r$\n' + FileWrite $9 'echo See the $INSTDIR\$LOG_FILE file$\r$\n' + FileWrite $9 'pause$\r$\n' + FileWrite $9 'exit /b 1$\r$\n' + FileWrite $9 '$\r$\n' + FileClose $9 + ${EndIf} + DetailPrint "Create $TOOLS_PATH\SignalK-CLI.lnk" CreateShortCut "$TOOLS_PATH\SignalK-CLI.lnk" "cmd" \ "/k $TOOLS_PATH\signalk-server-cli.cmd" "$TOOLS_PATH\signalk.ico" 0 SW_SHOWNORMAL \ @@ -296,43 +370,62 @@ ;====================================================== Section "Extract nodejs" SecExtractJS LogSet on -; SectionIn RO SetDetailsView show - Call SetGlobalVars SetOutPath $INSTDIR File /r ..\target\wget.exe - LogText "Extract wget.exe to $INSTDIR" + DetailPrint "Extract wget.exe to $INSTDIR" ClearErrors ${If} ${RunningX64} - DetailPrint "Download nodejs 64-bits" - LogText "Download nodejs 64-bits from $NODE64_URL" + DetailPrint "Download nodejs 64-bits from $NODE64_URL" ExecWait '"$INSTDIR\wget.exe" "--output-document=$INSTDIR\nodejs.zip" "$NODE64_URL"' $0 ${Else} - DetailPrint "Download nodejs 32-bits" - LogText "Download nodejs 32-bits from $NODE86_URL" + DetailPrint "Download nodejs 32-bits from $NODE86_URL" ExecWait '"$INSTDIR\wget.exe" "--output-document=$INSTDIR\nodejs.zip" "$NODE86_URL"' $0 - ${EndIf} + ${EndIf} ${If} ${Errors} - MessageBox MB_OK "Download nodejs failed with code: $0" - LogText "Download nodejs failed whith code: $0" + MessageBox MB_ICONSTOP|MB_OK "Download nodejs failed with code: $0" + DetailPrint "Download nodejs failed whith code: $0" Quit ${EndIf} - DetailPrint "Extract nodejs" - LogText "Extract nodejs from $INSTDIR\nodejs.zip to $INSTDIR" + DetailPrint "Extract nodejs from $INSTDIR\nodejs.zip to $INSTDIR" nsisunz::Unzip "$INSTDIR\nodejs.zip" "$INSTDIR" Pop $0 DetailPrint "Extract nodejs: $0" StrCmp $0 "success" unzipOk - MessageBox MB_OK "Extract nodejs failed" - Quit + MessageBox MB_ICONSTOP|MB_OK "Extract nodejs failed" + DetailPrint "Extract nodejs failed: $0" + SetAutoClose false + Quit unzipOk: + StrCmp $NODE_UPGRADE '0' renamenode + DetailPrint "Upgrade NodeJS to $NODE_VERSION in progress..." + ${If} ${RunningX64} + CopyFiles /SILENT $INSTDIR\$NODE64_ORG_DIR\* $INSTDIR\nodejs + ${Else} + CopyFiles /SILENT $INSTDIR\$NODE86_ORG_DIR\* $INSTDIR\nodejs + ${EndIf} + DetailPrint "Upgrade NodeJS to $NODE_VERSION completed" + Goto endcopynode + renamenode: + DetailPrint "Install NodeJS $NODE_VERSION in progress..." ${If} ${RunningX64} Rename $INSTDIR\$NODE64_ORG_DIR $INSTDIR\nodejs ${Else} Rename $INSTDIR\$NODE86_ORG_DIR $INSTDIR\nodejs - ${EndIf} + ${EndIf} + DetailPrint "Install NodeJS $NODE_VERSION completed" + endcopynode: + DetailPrint "Cleaning up temporary files..." Delete "$INSTDIR\nodejs.zip" Delete "$INSTDIR\wget.exe" + ${If} ${RunningX64} + DetailPrint 'RMDir /r "$INSTDIR\$NODE64_ORG_DIR"' + RMDir /r "$INSTDIR\$NODE64_ORG_DIR" + ${Else} + DetailPrint 'RMDir /r "$INSTDIR\$NODE86_ORG_DIR"' + RMDir /r "$INSTDIR\$NODE86_ORG_DIR" + ${EndIf} + DetailPrint "Cleaning up temporary files completed" SectionEnd Section "Extract openssl" SecExtractSSL @@ -346,7 +439,7 @@ ${Else} DetailPrint "Extract openssl 32-bits" File /r "..\target\openssl-x86\*.*" - ${EndIf} + ${EndIf} SectionEnd Section "Generate tools" SecTools @@ -369,14 +462,17 @@ Section "install signalk-server" SecSkInstall LogSet on - Call SetGlobalVars + ${If} $W7_DETECTED == "1" + ExecWait '"$TOOLS_PATH\npm-install-serial.cmd"' $0 + DetailPrint "npm install -g --unsafe-perm serialport@10.1.0 returned $0" + ${EndIf} ExecWait '"$TOOLS_PATH\npm-install-signalk-server.cmd"' $0 DetailPrint "npm install -g --unsafe-perm signalk-server returned $0" SectionEnd Section "Signal K as services" SecSkService LogSet on - Call SetGlobalVars +; Call SetGlobalVars ExecWait '"$TOOLS_PATH\create-signalk-server-services.cmd"' $0 DetailPrint "Install Signal K as windows services returned $0" SectionEnd @@ -384,7 +480,6 @@ SectionGroup /e "Desktop shortcut" SecShortcuts Section "Start service" SecStartService LogSet on - Call SetGlobalVars DetailPrint "Create desktop shortcut 'Start Signal K Service'" CreateShortCut "$DESKTOP\Start Signal K Service.lnk" "$TOOLS_PATH\start-signalk-server-services.cmd" \ "" "$TOOLS_PATH\signalk.ico" 0 SW_SHOWNORMAL \ @@ -392,14 +487,12 @@ SectionEnd Section "Signal Web GUI" SecSignalkWebGUI LogSet on - Call SetGlobalVars DetailPrint "Create desktop shortcut 'SignalK-GUI'" !insertmacro CreateInternetShortcutWithIcon "$DESKTOP\SignalK-GUI.URL" "http://localhost:3000" "$TOOLS_PATH\signalk.ico" 0 SectionEnd Section /o "Signal K CLI" SecSignalkCli LogSet on - Call SetGlobalVars DetailPrint "Create desktop shortcut 'Signal K CLI'" CreateShortCut "$DESKTOP\Signal K CLI.lnk" "cmd" \ "/k $TOOLS_PATH\signalk-server-cli.cmd" "$TOOLS_PATH\signalk.ico" 0 SW_SHOWNORMAL \ @@ -408,19 +501,18 @@ SectionGroupEnd ;====================================================== -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SecExtractJS} "Download and extract node js binary and library, mandatory for running Signal K (Internet access required)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecExtractSSL} "Extract OpenSSL binary and library (mandatory for running Signal K with https)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} "Generate startup scripts, home dir and tools for running Signal K on Windows OS (mandatory for running Signal K)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSkInstall} "Install the lastest version of Signal K server node from npm repository (Internet access required)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSkService} "Install Signal as Windows service (Internet access required)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "Create desktop shortcut" - !insertmacro MUI_DESCRIPTION_TEXT ${SecStartService} "Desktop shortcut to start Signal K service.$\n'Signal K as services' must be selected" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSignalkCli} "Desktop shortcut to open nodejs console for run Signal K as standalone server.$\nOnly for advanced users" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSignalkWebGUI} "Desktop shortcut to open the web GUI of Signal K server" -!insertmacro MUI_FUNCTION_DESCRIPTION_END + !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SecExtractJS} "Download and extract node js binary and library, mandatory for running Signal K (Internet access required)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecExtractSSL} "Extract OpenSSL binary and library (mandatory for running Signal K with https)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} "Generate startup scripts, home dir and tools for running Signal K on Windows OS (mandatory for running Signal K)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSkInstall} "Install the lastest version of Signal K server node from npm repository (Internet access required)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSkService} "Install Signal as Windows service (Internet access required)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "Create desktop shortcut" + !insertmacro MUI_DESCRIPTION_TEXT ${SecStartService} "Desktop shortcut to start Signal K service.$\n'Signal K as services' must be selected" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSignalkCli} "Desktop shortcut to open nodejs console for run Signal K as standalone server.$\nOnly for advanced users" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSignalkWebGUI} "Desktop shortcut to open the web GUI of Signal K server" + !insertmacro MUI_FUNCTION_DESCRIPTION_END ;====================================================== - Function .onSelChange ${If} $0 != ${SecSkService} Return @@ -435,3 +527,54 @@ Function .onSelChange SectionSetFlags ${SecStartService} ${SF_RO} end: FunctionEnd + +Function nodejsAlertPre + LogSet on + SetDetailsView show + Call SetGlobalVars + ${If} ${FileExists} "$NODE_PATH\node.exe" + StrCpy $NODE_INSTALL '1' + StrCpy $NODE_UPGRADE '1' + nsExec::ExecToStack '"$NODE_PATH\node.exe" -v' + Pop $0 # return value/error/timeout + Pop $1 # printed text, up to ${NSIS_MAX_STRLEN} + StrCpy $NODE_INSTALLED $1 + DetailPrint 'nodejs detected: "$NODE_PATH\node.exe" in version: $NODE_INSTALLED' + LogText "Return code: $0" + ${StrContains} $0 "$NODE_SHORT_VERSION" $NODE_INSTALLED + StrCmp $0 "" noinstall + StrCpy $NODE_INSTALL '1' + StrCpy $NODE_UPGRADE '1' + Goto done + noinstall: + StrCpy $NODE_INSTALL '0' + StrCpy $NODE_UPGRADE '0' + SectionSetFlags ${SecExtractJS} ${SF_RO} + LogText "A different major version of NodeJs is detected: $NODE_INSTALLED in $INSTDIR and cannot be updated to $NODE_VERSION" + SetOutPath $INSTDIR + ExecShell "open" "https://github.com/SignalK/signalk-server-windows/blob/v${INST_VERSION}/readme.md" + System::Call "User32::SetWindowPos(i $HWNDPARENT, i -1, i 0, i 0, i 0, i 0, i 3) i." ; Keep focus + !insertmacro MUI_HEADER_TEXT "Node JS version" "Checking the Node JS version" + nsDialogs::Create 1018 + Pop $0 + ${If} $0 == error + Abort + ${EndIf} + ${NSD_CreateLabel} 0 26u 100% 10u "A different major version of NodeJs is detected: $NODE_INSTALLED" + Pop $0 + ${NSD_CreateLabel} 0 36u 100% 10u "in $INSTDIR" + Pop $0 + ${NSD_CreateLabel} 0 46u 100% 10u "and cannot be updated to $NODE_VERSION." + Pop $0 + ${NSD_CreateLabel} 0 60u 100% 10u "Please see upgrade section in readme.md page that has just opened." + Pop $0 + ${NSD_CreateLabel} 0 74u 100% 10u "Or continue to upgrade only Signal K (not recommended)." + Pop $0 + nsDialogs::Show + ${Else} + StrCpy $NODE_INSTALL '1' + StrCpy $NODE_UPGRADE '0' + ${EndIf} + done: + LogText "NODE_INSTALL: '$NODE_INSTALL' NODE_UPGRADE: '$NODE_UPGRADE'" +FunctionEnd diff --git a/NSIS/tools.nsh b/NSIS/tools.nsh index eee453a..fb17a57 100644 --- a/NSIS/tools.nsh +++ b/NSIS/tools.nsh @@ -23,3 +23,52 @@ done: Pop $R1 Exch $R0 ;output string FunctionEnd +;============================================================= +; StrContains +; This function does a case sensitive searches for an occurrence of a substring in a string. +; It returns the substring if it is found. +; Otherwise it returns null(""). +; Written by kenglish_hi +; Adapted from StrReplace written by dandaman32 + + +Var STR_HAYSTACK +Var STR_NEEDLE +Var STR_CONTAINS_VAR_1 +Var STR_CONTAINS_VAR_2 +Var STR_CONTAINS_VAR_3 +Var STR_CONTAINS_VAR_4 +Var STR_RETURN_VAR + +Function StrContains + Exch $STR_NEEDLE + Exch 1 + Exch $STR_HAYSTACK + ; Uncomment to debug + ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK ' + StrCpy $STR_RETURN_VAR "" + StrCpy $STR_CONTAINS_VAR_1 -1 + StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE + StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK + loop: + IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1 + StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1 + StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found + StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done + Goto loop + found: + StrCpy $STR_RETURN_VAR $STR_NEEDLE + Goto done + done: + Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the + Exch $STR_RETURN_VAR +FunctionEnd + +!macro _StrContainsConstructor OUT NEEDLE HAYSTACK + Push `${HAYSTACK}` + Push `${NEEDLE}` + Call StrContains + Pop `${OUT}` +!macroend + +!define StrContains '!insertmacro "_StrContainsConstructor"' diff --git a/output/.placeholder b/output/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/readme.md b/readme.md index c91ddfc..f44d6b4 100644 --- a/readme.md +++ b/readme.md @@ -1,20 +1,27 @@ -**All in one Windows installer for Signal K server node http://signalk.org/** +**All in one Windows installer v1.0.0 for Signal K server node http://signalk.org/** ___ -**Prerequisite:** +# Prerequisite - Internet connection during setup process - -**What's provide with this installer:** +- **If you have already installed Signal K** with a previous version of the installer with a version of NodeJS lower than 16, +you will see a windows like this: +![Install-SelectDir](screenshots/Install-CheckNode.png) +Please see [Upgrade NodeJS](#upgrade-nodejs) before ! +- **If your current OS version is lower than Windows 10**, +NodeJS 12 will be installed instead of NodeJS 16 with limited Signal K server support ( Windows 7 is end of life ). + +# What's provide with this installer - The latest version of the Signal K server downloaded during installation. -- node js 10.23.0 ( downloaded from https://nodejs.org/dist/v10.23.0/ during installation). +- NodeJS 16.13.2 ( downloaded from https://nodejs.org/dist/v16.13.2/ during installation). +**If your current OS version is lower than Windows 10**, NodeJS 12 only will be install (https://nodejs.org/download/release/v12.22.9/) - openssl 1.1.1h ( from https://slproweb.com/products/Win32OpenSSL.html ). - support of X64 and X86 Windows version (Windows 10 X64 and Windows 7 X86 tested). - All packages are installed under a root directory. You choose your root directory at the time of installation. - Signal K can start as windows service if you choose it at the time of installation. - You can re-run the installer several times. -- HTML installation help built with https://markdowntohtml.com/ +- HTML installation help built with https://github.com/nea/MarkdownViewerPlusPlus -**How to install Signal K server node:** +# How to install Signal K server node - Download installer at https://github.com/SignalK/signalk-server-windows/releases/latest/download/signalk-server-setup.exe - You can verify the checksum of the exec file at https://github.com/SignalK/signalk-server-windows/releases/latest/download/SHA256SUMS.txt `Get-FileHash .\signalk-server-setup.exe -Algorithm SHA256 | Format-List` @@ -75,7 +82,7 @@ Then reopen you web browser at URL: http://localhost:3000 and enter your admin a Then check out the website: http://signalk.org/ or https://github.com/SignalK/signalk-server-node for more informations. Or ask for support at http://slack-invite.signalk.org/ in channel #support-windows -**Software structure:** +# Software structure + `c:\signalk` This is the root directory that you choosed at install. All components are under this root directory. - `readme.html` minimal help file of installer. - `screenshots` screenshot for the html help file. @@ -85,7 +92,7 @@ Or ask for support at http://slack-invite.signalk.org/ in channel #support-windo - `signalkhome` home directory of Signal K server. - `.signalk` The configuration of your server is stored in this folder. -**The tools to manage server (located in `tools` directory):** +# The tools to manage server (located in "tools" directory) - `SignalK-CLI.lnk` open a command line windows with environment prepared for running Signal K. You do not use it if the signalk service is running. - `SignalK-GUI.URL` open the web GUI of Signal K server in your web browser. - `start-signalk-server-services.cmd` start or restart the Signal K service, you must `Run as administrator` this script. @@ -93,26 +100,44 @@ Or ask for support at http://slack-invite.signalk.org/ in channel #support-windo - `remove-signalk-server-services.cmd` remove the Signal K windows service, use this before delete the root directory. You must `Run as administrator` this script. - `create-signalk-server-services.cmd` create the Signal K windows service if you didn't choose it at installation. Cannot be re-run if `tools\daemon` directory exist. You must `Run as administrator` this script. -**Delete all of your Signal K server:** +# Upgrade NodeJS +Since the installer in version 1.0.0, NodeJS is provided in version 16. +If you have already installed Signal K with a previous version (with NodeJS version 10), +it is recommended to make a new installation and then restore the configuration of your Signal K server later. +- Stop your Signal K server `stop-signalk-server-services.cmd`. +- Remove the Signal K service `remove-signalk-server-services.cmd`. +- Close all windows related to signal K. +- Rename your Signal K root directory: e.g. `c:\signalk` to `c:\signalk10`. +This way, you will keep your Signal K server configuration in a safe place. +You can also `Backup` your Signal K server configuration in GUI server: `Server` then `Backup/Restore`. +See also the tips here, about plugin compatibility: [Updating to Node.js-16](https://github.com/SignalK/signalk-server/wiki/Updating-to-Node.js-16) +- Start installer and install Signal K in the original directory: e.g. `c:\signalk`. +- Start the Signal K server and check first without any plugins. +- If everything is OK, reinstall your plugins, restore your previous configuration with the `Backup/Restore` function +or by copying the saved settings files located in `.signalk` directory from your renamed directory. + +# Delete all of your Signal K server - This installation is completely free of windows registry keys. - First of all, if you installed as service, `Run as administrator` the `remove-signalk-server-services.cmd` script in tools dirrectory. - You can then safely delete the root directory e.g. `c:\signalk` - And that's all ! -**Rebuild install kit:** +# Rebuild install kit - Clone Github project: `git clone https://github.com/SignalK/signalk-server-windows.git` - Install `nsis-3.06.1-setup.exe` located in src folder. - Extract `nsis-3.06.1-log.zip` located in src folder. - Copy the content of extracted files in the folder of NSIS install directory. +- Extract `NSISunzU.zip` located in src folder. +- Copy the `NSISunzU\Plugin unicode\nsisunz.dll` file of extracted files in the folder of NSIS install directory `Plugins\x86-unicode\nsisunz.dll`. - Run NSIS. - Open `NSIS\signalk-server.nsi` file in NSIS. - Select `Script` `Recompile` - The new compiled install kit is located in `output` directory. -**Credits:** +# Credits - Openssl for Windows https://slproweb.com/products/Win32OpenSSL.html - NodeJs https://nodejs.org/ -- MarkDown to HTML https://markdowntohtml.com/ +- MarkDown to HTML https://github.com/nea/MarkdownViewerPlusPlus - Signal K http://signalk.org/ - Wget for Windows https://eternallybored.org/misc/wget/ - NodeJs windows service https://www.npmjs.com/package/node-windows diff --git a/screenshots/Install-CheckNode.greenshot b/screenshots/Install-CheckNode.greenshot new file mode 100644 index 0000000..547e199 Binary files /dev/null and b/screenshots/Install-CheckNode.greenshot differ diff --git a/screenshots/Install-CheckNode.png b/screenshots/Install-CheckNode.png new file mode 100644 index 0000000..f244c8e Binary files /dev/null and b/screenshots/Install-CheckNode.png differ diff --git a/screenshots/Install-Finished.greenshot b/screenshots/Install-Finished.greenshot index 5b39119..8854265 100644 Binary files a/screenshots/Install-Finished.greenshot and b/screenshots/Install-Finished.greenshot differ diff --git a/screenshots/Install-Finished.png b/screenshots/Install-Finished.png index d9c1a98..ea6d630 100644 Binary files a/screenshots/Install-Finished.png and b/screenshots/Install-Finished.png differ diff --git a/screenshots/Install-Progress-Download-nodejs.greenshot b/screenshots/Install-Progress-Download-nodejs.greenshot index afa2881..64c2998 100644 Binary files a/screenshots/Install-Progress-Download-nodejs.greenshot and b/screenshots/Install-Progress-Download-nodejs.greenshot differ diff --git a/screenshots/Install-Progress-Download-nodejs.png b/screenshots/Install-Progress-Download-nodejs.png index f95cf7c..61472b9 100644 Binary files a/screenshots/Install-Progress-Download-nodejs.png and b/screenshots/Install-Progress-Download-nodejs.png differ diff --git a/screenshots/Install-Progress-NPM-SignalK.greenshot b/screenshots/Install-Progress-NPM-SignalK.greenshot index 011b43e..3b42ab0 100644 Binary files a/screenshots/Install-Progress-NPM-SignalK.greenshot and b/screenshots/Install-Progress-NPM-SignalK.greenshot differ diff --git a/screenshots/Install-Progress-NPM-SignalK.png b/screenshots/Install-Progress-NPM-SignalK.png index a680b62..1f43416 100644 Binary files a/screenshots/Install-Progress-NPM-SignalK.png and b/screenshots/Install-Progress-NPM-SignalK.png differ diff --git a/screenshots/Install-Progress-NPM-node-windows.greenshot b/screenshots/Install-Progress-NPM-node-windows.greenshot index 484b6a3..380a03f 100644 Binary files a/screenshots/Install-Progress-NPM-node-windows.greenshot and b/screenshots/Install-Progress-NPM-node-windows.greenshot differ diff --git a/screenshots/Install-Progress-NPM-node-windows.png b/screenshots/Install-Progress-NPM-node-windows.png index edc2892..ffacd32 100644 Binary files a/screenshots/Install-Progress-NPM-node-windows.png and b/screenshots/Install-Progress-NPM-node-windows.png differ diff --git a/screenshots/Install-Progress.greenshot b/screenshots/Install-Progress.greenshot index f8bcf63..c50288b 100644 Binary files a/screenshots/Install-Progress.greenshot and b/screenshots/Install-Progress.greenshot differ diff --git a/screenshots/Install-Progress.png b/screenshots/Install-Progress.png index c1028d9..6e1f5a7 100644 Binary files a/screenshots/Install-Progress.png and b/screenshots/Install-Progress.png differ diff --git a/screenshots/Install-SelectComponents.greenshot b/screenshots/Install-SelectComponents.greenshot index 3ce92e4..0aef18f 100644 Binary files a/screenshots/Install-SelectComponents.greenshot and b/screenshots/Install-SelectComponents.greenshot differ diff --git a/screenshots/Install-SelectComponents.png b/screenshots/Install-SelectComponents.png index 4878155..c1e1a55 100644 Binary files a/screenshots/Install-SelectComponents.png and b/screenshots/Install-SelectComponents.png differ diff --git a/screenshots/Install-SelectDir.greenshot b/screenshots/Install-SelectDir.greenshot index a24ba1e..19348ea 100644 Binary files a/screenshots/Install-SelectDir.greenshot and b/screenshots/Install-SelectDir.greenshot differ diff --git a/screenshots/Install-SelectDir.png b/screenshots/Install-SelectDir.png index 9a5323b..0a2837b 100644 Binary files a/screenshots/Install-SelectDir.png and b/screenshots/Install-SelectDir.png differ diff --git a/screenshots/Install-Welcome.greenshot b/screenshots/Install-Welcome.greenshot index 35b86a2..77d6439 100644 Binary files a/screenshots/Install-Welcome.greenshot and b/screenshots/Install-Welcome.greenshot differ diff --git a/screenshots/Install-Welcome.png b/screenshots/Install-Welcome.png index 5e14a63..bd903e0 100644 Binary files a/screenshots/Install-Welcome.png and b/screenshots/Install-Welcome.png differ diff --git a/src/NSISunzU.zip b/src/NSISunzU.zip new file mode 100644 index 0000000..b00005b Binary files /dev/null and b/src/NSISunzU.zip differ diff --git a/target/readme.html b/target/readme.html index f363a87..fbcc704 100644 --- a/target/readme.html +++ b/target/readme.html @@ -1,98 +1,175 @@ -

All in one Windows installer for Signal K server node http://signalk.org/

-
-

Prerequisite:

- -

What's provide with this installer:

- -

How to install Signal K server node:

- -

Your Signal K server is now installed.
If you have select Desktop shortcuts, you will find at least 1 icons on your desktop:
Desktop-shortcuts

- -

The Signal K server Windows service is in manual mode after installation, to prevent the Signal K server from starting every time you start your computer.
To start the Signal K server Windows service, use the shortcut on the desktop Start Signal K Service or by the script start-signalk-server-services.cmd in tools directory.
Caution, these commands must be Run as administrator.

-

When the Signal K server has started by service or CLI, wait 20 to 30 seconds for the server to finish booting.
Then open you web browser at URL: http://localhost:3000 or use the desktop shortcut SignalK GUI.

-

The very first thing to do after installing and starting the server, is to create an admin user in the web GUI.
Go to Security => User => Create an admin account -After that, restart the server by click on desktop icon Start Signal K Service.
This command will stop the Windows service and restart it with user security enabled.
Then reopen you web browser at URL: http://localhost:3000 and enter your admin account.

-

Then check out the website: http://signalk.org/ or https://github.com/SignalK/signalk-server-node for more informations.
Or ask for support at http://slack-invite.signalk.org/ in channel #support-windows

-

Software structure:

- -

The tools to manage server (located in tools directory):

- -

Delete all of your Signal K server:

- -

Rebuild install kit:

- -

Credits:

- + + + + + + readme.md + + + +

+ All in one Windows installer v1.0.0 for Signal K server node http://signalk.org/ +

+
+

Prerequisite

+ +

What's provide with this installer

+ +

How to install Signal K server node

+ +

Your Signal K server is now installed.
+If you have select Desktop shortcuts, you will find at least 1 icons on your desktop:
Desktop-shortcuts

+ +

The Signal K server Windows service is in manual mode after installation, to prevent the Signal K server from starting every time you start your computer.
+To start the Signal K server Windows service, use the shortcut on the desktop Start Signal K Service or by the script start-signalk-server-services.cmd in tools directory.
+Caution, these commands must be Run as administrator.

+

When the Signal K server has started by service or CLI, wait 20 to 30 seconds for the server to finish booting.
+Then open you web browser at URL: http://localhost:3000 or use the desktop shortcut SignalK GUI.

+

The very first thing to do after installing and starting the server, is to create an admin user in the web GUI.
+Go to Security => User => Create an admin account +After that, restart the server by click on desktop icon Start Signal K Service.
+This command will stop the Windows service and restart it with user security enabled.
+Then reopen you web browser at URL: http://localhost:3000 and enter your admin account.

+

Then check out the website: http://signalk.org/ or https://github.com/SignalK/signalk-server-node for more informations.
+Or ask for support at http://slack-invite.signalk.org/ in channel #support-windows

+

Software structure

+ +

The tools to manage server (located in "tools" directory)

+ +

Upgrade NodeJS

+

Since the installer in version 1.0.0, NodeJS is provided in version 16.
+If you have already installed Signal K with a previous version (with NodeJS version 10),
+it is recommended to make a new installation and then restore the configuration of your Signal K server later.

+ +

Delete all of your Signal K server

+ +

Rebuild install kit

+ +

Credits

+ + +