; Proxy Suite's setup program. It unpacks the release into its temporary folder and runs the ; release's own `proxy-suite-service.exe install` from there, as install.cmd does from the zip: ; that stops what runs, copies the release into Program Files, registers the service, PATH, the ; Start Menu entry, the app at sign-in and the entry in Settings > Apps, and starts it all. ; Unpacked straight into Program Files instead, an upgrade would find its files in use. ; The uninstaller is that entry's: uninstall.cmd, which the release carries. ; ; makensis -INPUTCHARSET UTF8 -DVERSION=0.2.0-pre.1 -DVERSION4=0.2.0.0 -DRELEASE= ; -DICON=crates/ps-gui/assets/proxy-suite.ico -DOUT= tools/installer.nsi ; ; Everything the programs need is in the release: the C runtime is linked in, WinDivert, wintun, ; Python and the rest are components. Windows' OpenSSH Client (the SSH tunnel) is Windows' own: ; offered, unchecked, for a Windows that had it removed. Unicode true ManifestDPIAware true RequestExecutionLevel admin ; Solid, with a dictionary that keeps the build's memory modest: the release is ~600 MB of ; programs, many alike (whitelist-bypass's nine). SetCompressor /SOLID /FINAL lzma SetCompressorDictSize 32 !include MUI2.nsh !include LogicLib.nsh !include x64.nsh !include WinVer.nsh Name "Proxy Suite" OutFile "${OUT}" InstallDir "$PROGRAMFILES64\ProxySuite" BrandingText "Proxy Suite ${VERSION}" ShowInstDetails show VIProductVersion "${VERSION4}" VIAddVersionKey /LANG=0 "ProductName" "Proxy Suite" VIAddVersionKey /LANG=0 "ProductVersion" "${VERSION}" VIAddVersionKey /LANG=0 "FileVersion" "${VERSION}" VIAddVersionKey /LANG=0 "FileDescription" "Proxy Suite setup" VIAddVersionKey /LANG=0 "LegalCopyright" "MIT License" !define MUI_ICON "${ICON}" !define MUI_ABORTWARNING !define MUI_FINISHPAGE_TITLE "$(FinishTitle)" !define MUI_FINISHPAGE_TEXT "$(FinishText)" !define MUI_FINISHPAGE_NOAUTOCLOSE !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "${RELEASE}/LICENSE" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ; The first is the default; Windows' own language picks among them. !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "Russian" LangString NeedX64 ${LANG_ENGLISH} "Proxy Suite needs 64-bit Windows." LangString NeedX64 ${LANG_RUSSIAN} "Для Proxy Suite нужна 64-битная Windows." LangString NeedBuild ${LANG_ENGLISH} "Proxy Suite needs Windows 10 version 1903 or later, or Windows 11." LangString NeedBuild ${LANG_RUSSIAN} "Для Proxy Suite нужна Windows 10 версии 1903 или новее либо Windows 11." LangString Failed ${LANG_ENGLISH} "Setup did not finish: the details are in the list above. Nothing that was installed before is lost." LangString Failed ${LANG_RUSSIAN} "Установка не завершена: подробности в списке выше. Установленное ранее не потеряно." LangString MainName ${LANG_ENGLISH} "Proxy Suite" LangString MainName ${LANG_RUSSIAN} "Proxy Suite" LangString MainDesc ${LANG_ENGLISH} "The service, the app, proxy-ctl and every component (sing-box, XRay, zapret, zapret2, Tor, tg-ws-proxy, wireproxy-awg, whitelist-bypass), into Program Files. Settings already made are kept." LangString MainDesc ${LANG_RUSSIAN} "Служба, приложение, proxy-ctl и все компоненты (sing-box, XRay, zapret, zapret2, Tor, tg-ws-proxy, wireproxy-awg, whitelist-bypass) в Program Files. Сделанные ранее настройки сохраняются." LangString SshName ${LANG_ENGLISH} "Windows OpenSSH Client" LangString SshName ${LANG_RUSSIAN} "Клиент OpenSSH Windows" LangString SshDesc ${LANG_ENGLISH} "For the SSH tunnel only. Windows 10 1809 and later have it already; this adds it from Windows Update where it was removed." LangString SshDesc ${LANG_RUSSIAN} "Нужен только для SSH-туннеля. В Windows 10 1809 и новее он уже есть; здесь он добавляется из Центра обновления, если его удалили." LangString SshThere ${LANG_ENGLISH} "The OpenSSH Client is there already." LangString SshThere ${LANG_RUSSIAN} "Клиент OpenSSH уже установлен." LangString SshFailed ${LANG_ENGLISH} "The OpenSSH Client could not be added (is Windows Update reachable?). Everything else works without it; add it later in Settings > System > Optional features." LangString SshFailed ${LANG_RUSSIAN} "Не удалось добавить клиент OpenSSH (доступен ли Центр обновления?). Всё остальное работает без него; его можно добавить позже: Параметры > Система > Дополнительные компоненты." LangString FinishTitle ${LANG_ENGLISH} "Proxy Suite is installed" LangString FinishTitle ${LANG_RUSSIAN} "Proxy Suite установлен" LangString FinishText ${LANG_ENGLISH} "Its service runs, and the app is in the tray (the shield) and the Start Menu; it starts at every sign-in.$\r$\n$\r$\nIn a new terminal: proxy-ctl status.$\r$\n$\r$\nTo remove it: Settings > Apps > Proxy Suite." LangString FinishText ${LANG_RUSSIAN} "Служба запущена, приложение в трее (щит) и в меню «Пуск»; оно запускается при каждом входе в систему.$\r$\n$\r$\nВ новом терминале: proxy-ctl status.$\r$\n$\r$\nУдаление: Параметры > Приложения > Proxy Suite." Function .onInit ${IfNot} ${RunningX64} MessageBox MB_ICONSTOP "$(NeedX64)" /SD IDOK Abort ${EndIf} ${IfNot} ${AtLeastBuild} 18362 MessageBox MB_ICONSTOP "$(NeedBuild)" /SD IDOK Abort ${EndIf} InitPluginsDir FunctionEnd Section "$(MainName)" SecMain SectionIn RO SetOutPath "$PLUGINSDIR\release" File /r "${RELEASE}/*" DetailPrint "proxy-suite-service install" nsExec::ExecToLog '"$PLUGINSDIR\release\proxy-suite-service.exe" install' Pop $0 ; Out of the folder, so that it goes with $PLUGINSDIR when setup ends. SetOutPath "$TEMP" ${If} $0 != 0 DetailPrint "$(Failed)" MessageBox MB_ICONSTOP "$(Failed)" /SD IDOK SetErrorLevel 2 Abort ${EndIf} SectionEnd Section /o "$(SshName)" SecSsh ; This setup runs as a 32-bit program: Sysnative is the real System32. ${If} ${FileExists} "$WINDIR\Sysnative\OpenSSH\ssh.exe" DetailPrint "$(SshThere)" ${Else} nsExec::ExecToLog '"$WINDIR\Sysnative\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NonInteractive -Command "Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 | Out-Null; if (-not (Test-Path $$env:SystemRoot\System32\OpenSSH\ssh.exe)) { exit 1 }"' Pop $0 ${If} $0 != 0 DetailPrint "$(SshFailed)" MessageBox MB_ICONEXCLAMATION "$(SshFailed)" /SD IDOK ${EndIf} ${EndIf} SectionEnd !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecMain} "$(MainDesc)" !insertmacro MUI_DESCRIPTION_TEXT ${SecSsh} "$(SshDesc)" !insertmacro MUI_FUNCTION_DESCRIPTION_END