feat(app): the Windows installer
- app/shell/installer.nsi with installer.sh: package.sh's folder into Jarvis-Setup-<version>.exe (NSIS, about 10 MB) and its .sha256; models and runtimes still come with the first-run wizard - Program Files with one administrator prompt, Korean pages, components (start menu and desktop shortcuts, the virtual monitor's driver off by default, installed through the app's elevated half), the WebView2 runtime only when missing, a wait for a running Jarvis, /S and /S /RUN for updates, the app started through Explorer so it never runs as administrator - uninstall removes this app's driver, only the files it installed, the shortcuts and its registry keys; the data folder stays - checked on the win-ci VM: silent install, start, update while running and start again, uninstall; and an install with the driver from the pages, whose uninstall leaves no device, driver package or registry key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
212
app/shell/installer.nsi
Normal file
212
app/shell/installer.nsi
Normal file
@@ -0,0 +1,212 @@
|
||||
; The Jarvis installer (admin.spec.md, "Installer"). Built on Linux by installer.sh with makensis:
|
||||
; makensis -DVERSION=0.1.0 -DSRC=<Jarvis folder> -DOUT=<setup.exe> -DICON=<icon.ico> -DWEBVIEW2=<bootstrapper> installer.nsi
|
||||
; Program Files, one administrator prompt; the data folder is chosen by the app's first-run wizard
|
||||
; and never touched here. /S installs silently (the app's updates: /S /RUN starts the app afterwards).
|
||||
|
||||
Unicode true
|
||||
SetCompressor /SOLID lzma
|
||||
!include "MUI2.nsh"
|
||||
!include "x64.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
|
||||
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\JarvisBot"
|
||||
!define WEBVIEW2_KEY "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"
|
||||
|
||||
Name "Jarvis"
|
||||
OutFile "${OUT}"
|
||||
InstallDir "$PROGRAMFILES64\Jarvis"
|
||||
InstallDirRegKey HKLM "Software\JarvisBot" "InstallDir"
|
||||
RequestExecutionLevel admin
|
||||
BrandingText "Jarvis ${VERSION}"
|
||||
VIProductVersion "${VERSION}.0"
|
||||
VIAddVersionKey /LANG=0 "ProductName" "Jarvis"
|
||||
VIAddVersionKey /LANG=0 "FileVersion" "${VERSION}"
|
||||
VIAddVersionKey /LANG=0 "FileDescription" "Jarvis 설치"
|
||||
VIAddVersionKey /LANG=0 "LegalCopyright" "MIT"
|
||||
|
||||
!define MUI_ICON "${ICON}"
|
||||
!define MUI_UNICON "${ICON}"
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_TEXT "Jarvis 실행"
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION RunAsUser
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_LANGUAGE "Korean"
|
||||
|
||||
; Whether jarvis.exe runs (any user's), from tasklist's answer: OUT = 1 or 0.
|
||||
!macro JarvisRuns PREFIX OUT
|
||||
nsExec::ExecToStack 'tasklist /FI "IMAGENAME eq jarvis.exe" /NH'
|
||||
Pop $0
|
||||
Call ${PREFIX}StrHasJarvis
|
||||
Pop ${OUT}
|
||||
!macroend
|
||||
|
||||
!macro StrHasJarvisFn PREFIX
|
||||
Function ${PREFIX}StrHasJarvis
|
||||
Exch $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
StrCpy $R1 0
|
||||
StrCpy $R2 0
|
||||
loop:
|
||||
StrCpy $R3 $R0 10 $R1
|
||||
StrCmp $R3 "" done
|
||||
StrCmp $R3 "jarvis.exe" found
|
||||
IntOp $R1 $R1 + 1
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $R2 1
|
||||
done:
|
||||
StrCpy $R0 $R2
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro StrHasJarvisFn ""
|
||||
!insertmacro StrHasJarvisFn "un."
|
||||
|
||||
; Wait until Jarvis has closed: silently up to 60 s (an update closes it itself), else ask.
|
||||
!macro WaitClosed PREFIX
|
||||
StrCpy $5 0
|
||||
${Do}
|
||||
!insertmacro JarvisRuns "${PREFIX}" $4
|
||||
${If} $4 == 0
|
||||
${Break}
|
||||
${EndIf}
|
||||
${If} ${Silent}
|
||||
${If} $5 >= 60
|
||||
Abort
|
||||
${EndIf}
|
||||
Sleep 1000
|
||||
IntOp $5 $5 + 1
|
||||
${Else}
|
||||
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Jarvis가 실행 중입니다. Jarvis 창을 닫은 뒤 다시 시도를 눌러 주세요." IDRETRY +2
|
||||
Abort
|
||||
${EndIf}
|
||||
${Loop}
|
||||
!macroend
|
||||
|
||||
Function .onInit
|
||||
${IfNot} ${RunningX64}
|
||||
MessageBox MB_ICONSTOP "Jarvis는 64비트 Windows 10/11에서만 실행됩니다."
|
||||
Abort
|
||||
${EndIf}
|
||||
SetRegView 64
|
||||
; Shortcuts for every user of the PC, like the Program Files install itself.
|
||||
SetShellVarContext all
|
||||
!insertmacro WaitClosed ""
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
SetRegView 64
|
||||
SetShellVarContext all
|
||||
!insertmacro WaitClosed "un."
|
||||
FunctionEnd
|
||||
|
||||
; Started from this elevated installer the app would run as administrator; Explorer starts it as
|
||||
; the signed-in user.
|
||||
Function RunAsUser
|
||||
Exec '"$WINDIR\explorer.exe" "$INSTDIR\jarvis.exe"'
|
||||
FunctionEnd
|
||||
|
||||
Section "Jarvis (필수)" SecMain
|
||||
SectionIn RO
|
||||
SetOutPath "$INSTDIR"
|
||||
File "${SRC}/jarvis.exe"
|
||||
File "${SRC}/WebView2Loader.dll"
|
||||
File /r "${SRC}/python-src"
|
||||
File /r "${SRC}/display-driver"
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
WriteRegStr HKLM "Software\JarvisBot" "InstallDir" "$INSTDIR"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "Jarvis"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "Jarvis"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\jarvis.exe"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "InstallLocation" "$INSTDIR"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
|
||||
WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
|
||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||
WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" $0
|
||||
; The window needs the WebView2 runtime (Windows 11 has it; an older Windows 10 may not).
|
||||
ReadRegStr $0 HKLM "${WEBVIEW2_KEY}" "pv"
|
||||
ReadRegStr $1 HKCU "${WEBVIEW2_KEY}" "pv"
|
||||
${If} $0 == ""
|
||||
${OrIf} $0 == "0.0.0.0"
|
||||
${If} $1 == ""
|
||||
${OrIf} $1 == "0.0.0.0"
|
||||
DetailPrint "WebView2 런타임 설치"
|
||||
SetOutPath "$PLUGINSDIR"
|
||||
File "/oname=webview2.exe" "${WEBVIEW2}"
|
||||
ExecWait '"$PLUGINSDIR\webview2.exe" /silent /install' $0
|
||||
DetailPrint "WebView2 설치 결과: $0"
|
||||
SetOutPath "$INSTDIR"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
; Silent updates (/S /RUN) start the app again when done.
|
||||
${GetParameters} $0
|
||||
ClearErrors
|
||||
${GetOptions} $0 "/RUN" $1
|
||||
${IfNot} ${Errors}
|
||||
Call RunAsUser
|
||||
${EndIf}
|
||||
SectionEnd
|
||||
|
||||
Section "시작 메뉴 바로 가기" SecStart
|
||||
CreateShortCut "$SMPROGRAMS\Jarvis.lnk" "$INSTDIR\jarvis.exe"
|
||||
SectionEnd
|
||||
|
||||
Section /o "바탕 화면 바로 가기" SecDesktop
|
||||
CreateShortCut "$DESKTOP\Jarvis.lnk" "$INSTDIR\jarvis.exe"
|
||||
SectionEnd
|
||||
|
||||
Section /o "가상 모니터 드라이버" SecDriver
|
||||
; The app's own elevated half (admin.spec.md, "Virtual monitor"); Windows asks once whether to
|
||||
; trust the SignPath Foundation. It can also be installed later from the features screen.
|
||||
ExecWait '"$INSTDIR\jarvis.exe" --display-driver install --result "$PLUGINSDIR\vdd.txt"' $0
|
||||
${If} $0 != 0
|
||||
FileOpen $1 "$PLUGINSDIR\vdd.txt" r
|
||||
FileRead $1 $2
|
||||
FileClose $1
|
||||
DetailPrint "가상 모니터 드라이버를 설치하지 못했습니다: $2"
|
||||
${IfNot} ${Silent}
|
||||
MessageBox MB_ICONEXCLAMATION "가상 모니터 드라이버를 설치하지 못했습니다. 나중에 기능 화면에서 다시 설치할 수 있습니다.$\r$\n$2"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
SectionEnd
|
||||
|
||||
LangString DESC_Main ${LANG_KOREAN} "관리 앱과 음성 워커·두뇌 소스입니다. 모델과 런타임은 첫 실행 때 고른 데이터 폴더에 받습니다."
|
||||
LangString DESC_Driver ${LANG_KOREAN} "봇용 크롬창을 실제 모니터에 보이지 않는 가상 모니터에 두어 디스코드 화면 공유에서 고를 수 있게 합니다. Windows가 장치 소프트웨어 설치를 한 번 묻습니다."
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_Main)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDriver} $(DESC_Driver)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
Section "Uninstall"
|
||||
; The virtual monitor's driver goes with the app when this app installed it (the elevated half
|
||||
; refuses another program's copy and does nothing when there is none).
|
||||
ExecWait '"$INSTDIR\jarvis.exe" --display-driver uninstall --result "$TEMP\jarvis-vdd-uninstall.txt"'
|
||||
Delete "$TEMP\jarvis-vdd-uninstall.txt"
|
||||
; Only what the installer put there: a folder the person chose may hold other things.
|
||||
Delete "$INSTDIR\jarvis.exe"
|
||||
Delete "$INSTDIR\WebView2Loader.dll"
|
||||
RMDir /r "$INSTDIR\python-src"
|
||||
RMDir /r "$INSTDIR\display-driver"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
Delete "$SMPROGRAMS\Jarvis.lnk"
|
||||
Delete "$DESKTOP\Jarvis.lnk"
|
||||
DeleteRegKey HKLM "${UNINST_KEY}"
|
||||
DeleteRegKey HKLM "Software\JarvisBot"
|
||||
DetailPrint "데이터 폴더(모델, 대화 기록, 설정)는 지우지 않았습니다."
|
||||
SectionEnd
|
||||
18
app/shell/installer.sh
Executable file
18
app/shell/installer.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# The Jarvis installer (admin.spec.md, "Installer"): package.sh's Jarvis/ folder into one NSIS setup.
|
||||
# app/shell/installer.sh <output folder> -> <output folder>/Jarvis-Setup-<version>.exe (+ .sha256)
|
||||
# Needs makensis 3 (NSISDIR set when it is not installed system-wide) and curl.
|
||||
set -eu
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
out=$(mkdir -p "${1:?output folder}" && cd "$1" && pwd)
|
||||
version=$(sed -n 's/^version = "\(.*\)"/\1/p' "$here/Cargo.toml" | head -1)
|
||||
target=${CARGO_TARGET_DIR:-$here/target}
|
||||
sh "$here/package.sh" "$out" >/dev/null
|
||||
# The WebView2 runtime's bootstrapper (Microsoft, about 2 MB), run only on a PC without the runtime.
|
||||
wv2="$target/MicrosoftEdgeWebview2Setup.exe"
|
||||
[ -s "$wv2" ] || curl -fsSL -o "$wv2" "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
|
||||
setup="$out/Jarvis-Setup-$version.exe"
|
||||
makensis -V2 -DVERSION="$version" -DSRC="$out/Jarvis" -DOUT="$setup" -DICON="$here/icons/icon.ico" \
|
||||
-DWEBVIEW2="$wv2" "$here/installer.nsi"
|
||||
(cd "$out" && sha256sum "Jarvis-Setup-$version.exe" > "Jarvis-Setup-$version.exe.sha256")
|
||||
echo "$setup"
|
||||
@@ -559,7 +559,31 @@ URL), so other local programs cannot drive it.
|
||||
out `Jarvis/`: `jarvis.exe`, `WebView2Loader.dll`, `python-src/` (the `voice_worker` and
|
||||
`jarvis` packages, no caches or specs) and `display-driver/` (the virtual monitor's driver). The worker's default sources are `python-src` next to the
|
||||
executable when it is there, else the repository's `src/`; the install reads its requirement
|
||||
files from the same place. The installer (NSIS) comes later; the folder runs as it is.
|
||||
files from the same place. The folder also runs as it is.
|
||||
|
||||
## Installer (`app/shell/installer.nsi`, `app/shell/installer.sh`)
|
||||
|
||||
`docs/v2/architecture.md` ("설치 파일: NSIS"). `installer.sh <folder>` runs `package.sh` and makensis
|
||||
3 (on Linux; `NSISDIR` when it is not installed system-wide) and writes
|
||||
`Jarvis-Setup-<version>.exe` with its `.sha256`. The installer is about 10 MB; models and runtimes
|
||||
come with the first-run wizard into the data folder, which the installer never touches.
|
||||
|
||||
- Program Files (`Jarvis`), one administrator prompt, 64-bit Windows 10/11 only; Korean pages:
|
||||
folder, components, progress, finish ("Jarvis 실행", started through Explorer so the app runs as
|
||||
the signed-in user, not as administrator).
|
||||
- Components: Jarvis (always), start menu shortcut (on), desktop shortcut (off), the virtual
|
||||
monitor's driver (off; the app's elevated half, `jarvis.exe --display-driver install`, so Windows
|
||||
asks the SignPath question once; a failure says it can be installed later from the features
|
||||
screen). Shortcuts are for every user of the PC.
|
||||
- The WebView2 runtime is installed with Microsoft's bootstrapper (inside the installer) only when
|
||||
the PC has none.
|
||||
- Before installing or removing, the installer waits for `jarvis.exe` to close: it asks with a
|
||||
retry, or silently waits up to 60 s (an update closes the app itself), then gives up.
|
||||
- `/S` installs silently with the default components; `/S /RUN` starts the app again afterwards
|
||||
(the app's updates). The uninstall entry has the version, size and a quiet uninstall string.
|
||||
- Uninstall: the driver goes too when this app installed it (the elevated half refuses another
|
||||
program's copy), then only what the installer put there (a folder the person chose may hold
|
||||
other things), the shortcuts and the registry keys. The data folder stays.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user