fix(app): installer drops its lock before starting the app and refuses a second setup
- The lock is closed in a last hidden section once every change is done, so /S /RUN and the finish page's "Jarvis 실행" start the app instead of its "installing" message. - An installer or uninstaller that finds the lock taken (or cannot make it) stops at once, silently with exit code 5, so two never run together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,9 +99,32 @@ FunctionEnd
|
||||
!macroend
|
||||
|
||||
; The installer's lock: Jarvis does not start while it is held (app/src/setup_lock.rs); taken
|
||||
; before waiting for a running Jarvis, held until the installer ends.
|
||||
; before waiting for a running Jarvis, closed once every change is done (before the app is started
|
||||
; again). Another installer or uninstaller holding it (or a lock that cannot be made) means this
|
||||
; one stops at once: silently with exit code 5.
|
||||
!macro TakeLock
|
||||
System::Call 'kernel32::CreateMutexW(p 0, i 1, w "Global\JarvisBotSetup") p .r9'
|
||||
System::Call 'kernel32::CreateMutexW(p 0, i 1, w "Global\JarvisBotSetup") p .r9 ?e'
|
||||
Pop $8
|
||||
${If} $9 == 0
|
||||
${OrIf} $8 == 183 ; ERROR_ALREADY_EXISTS
|
||||
${If} $9 != 0
|
||||
System::Call 'kernel32::CloseHandle(p r9)'
|
||||
${EndIf}
|
||||
${IfNot} ${Silent}
|
||||
MessageBox MB_ICONSTOP "다른 Jarvis 설치나 제거가 진행 중입니다. 끝난 뒤 다시 실행해 주세요."
|
||||
${EndIf}
|
||||
SetErrorLevel 5
|
||||
Abort
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
; Closing the only handle removes the lock (the sections run on another thread than .onInit, so
|
||||
; ReleaseMutex would not be allowed there; the handle count is what counts).
|
||||
!macro DropLock
|
||||
${If} $9 != 0
|
||||
System::Call 'kernel32::CloseHandle(p r9)'
|
||||
StrCpy $9 0
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
Function .onInit
|
||||
@@ -196,13 +219,6 @@ Section "Jarvis (필수)" SecMain
|
||||
WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" 1
|
||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||
WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" $0
|
||||
; 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
|
||||
@@ -228,6 +244,18 @@ Section /o "가상 모니터 드라이버" SecDriver
|
||||
${EndIf}
|
||||
SectionEnd
|
||||
|
||||
; Last: every change is done, so the lock goes before the app starts again (silent updates with
|
||||
; /RUN here, the finish page's "Jarvis 실행" after this).
|
||||
Section "-Done"
|
||||
!insertmacro DropLock
|
||||
${GetParameters} $0
|
||||
ClearErrors
|
||||
${GetOptions} $0 "/RUN" $1
|
||||
${IfNot} ${Errors}
|
||||
Call RunAsUser
|
||||
${EndIf}
|
||||
SectionEnd
|
||||
|
||||
LangString DESC_Main ${LANG_KOREAN} "관리 앱과 음성 워커·두뇌 소스입니다. 모델과 런타임은 첫 실행 때 고른 데이터 폴더에 받습니다."
|
||||
LangString DESC_Driver ${LANG_KOREAN} "봇용 크롬창을 실제 모니터에 보이지 않는 가상 모니터에 두어 디스코드 화면 공유에서 고를 수 있게 합니다. Windows가 장치 소프트웨어 설치를 한 번 묻습니다."
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
@@ -268,4 +296,5 @@ Section "Uninstall"
|
||||
DeleteRegKey HKLM "${UNINST_KEY}"
|
||||
DeleteRegKey HKLM "Software\JarvisBot"
|
||||
DetailPrint "데이터 폴더(모델, 대화 기록, 설정)는 지우지 않았습니다."
|
||||
!insertmacro DropLock
|
||||
SectionEnd
|
||||
|
||||
Reference in New Issue
Block a user