-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(install.bat): run in elevate cmd; detach WeaselServer process
- Loading branch information
Showing
3 changed files
with
58 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,57 @@ | ||
@echo off | ||
|
||
rem argument 1: [ /s | /t ] register ime as zh_CN | zh_TW keyboard layout | ||
set WEASEL_INSTALL_OPTION=/s | ||
if /i "%1" == "/t" set WEASEL_INSTALL_OPTION=/t | ||
set install_option=/s | ||
if /i "%1" == "/t" set install_option=/t | ||
|
||
set CD_BACK=%CD% | ||
cd "%~dp0" | ||
|
||
if /i "%2" == "/register" goto register | ||
|
||
echo stopping service from an older version. | ||
call stop_service.bat | ||
|
||
echo configuring preset input schemas... | ||
WeaselDeployer.exe /install | ||
|
||
echo administrative permissions required. detecting permissions... | ||
net session >nul 2>&1 | ||
if not %errorlevel% == 0 ( | ||
echo elevating command prompt... | ||
cscript sudo.js "%~nx0" %install_option% /register | ||
exit /b | ||
) | ||
|
||
:register | ||
echo registering Weasel IME to your system. | ||
echo install_option=%install_option% | ||
|
||
wscript check_windows_version.js | ||
cscript check_windows_version.js | ||
if errorlevel 2 goto win7_x64_install | ||
if errorlevel 1 goto xp_install | ||
|
||
:win7_install | ||
wscript sudo.js WeaselSetup.exe %WEASEL_INSTALL_OPTION% | ||
rem wscript sudo.js regsvr32.exe /s "%CD%\weasel.dll" | ||
goto exit | ||
WeaselSetup.exe %install_option% | ||
rem regsvr32.exe /s "%CD%\weasel.dll" | ||
goto next | ||
|
||
:win7_x64_install | ||
wscript sudo.js WeaselSetupx64.exe %WEASEL_INSTALL_OPTION% | ||
rem wscript sudo.js regsvr32.exe /s "%CD%\weasel.dll" | ||
rem wscript sudo.js regsvr32.exe /s "%CD%\weaselx64.dll" | ||
goto exit | ||
WeaselSetupx64.exe %install_option% | ||
rem regsvr32.exe /s "%CD%\weasel.dll" | ||
rem regsvr32.exe /s "%CD%\weaselx64.dll" | ||
goto next | ||
|
||
:xp_install | ||
WeaselSetup.exe %WEASEL_INSTALL_OPTION% | ||
goto exit | ||
WeaselSetup.exe %install_option% | ||
goto next | ||
|
||
:exit | ||
:next | ||
reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" /v WeaselServer /t REG_SZ /d "%CD%\WeaselServer.exe" /f | ||
WeaselServer.exe | ||
|
||
:done | ||
start WeaselServer.exe | ||
|
||
if /i "%2" == "/register" pause | ||
echo installed. | ||
cd "%CD_BACK%" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters