Update service paths and installer registry keys

Service executable paths in installService.bat and uninstallService.bat now use %APPDATA% for improved portability. The setup.iss installer script updates registry keys to use the application name macro, adjusts file and icon paths to user appdata, and changes PowerShell execution flags. afterInstall.ps1 now downloads and extracts WelsonJS binary artifacts from a remote URL.
This commit is contained in:
Namhyeon Go 2025-11-21 10:50:31 +09:00
parent 54a76f7078
commit ca8bd275bf
4 changed files with 48 additions and 47 deletions

View File

@ -181,10 +181,13 @@ function Extract-TarGz {
# ================================ # ================================
# SET DOWNLOAD URLS BASED ON ARCH # SET DOWNLOAD URLS BASED ON ARCH
# ================================ # ================================
$PythonUrl = $null $PythonUrl = $null
$CurlUrl = $null $CurlUrl = $null
$YaraUrl = $null $YaraUrl = $null
$WamrUrl = $null $WamrUrl = $null
# WelsonJS binary artifacts
$ArtifactsUrl = "https://catswords.blob.core.windows.net/welsonjs/artifacts.zip"
switch ($arch) { switch ($arch) {
"x64" { "x64" {
@ -227,40 +230,44 @@ switch ($arch) {
} }
} }
Write-Host "[*] Python URL: $PythonUrl" Write-Host "[*] Python URL : $PythonUrl"
Write-Host "[*] curl URL : $CurlUrl" Write-Host "[*] curl URL : $CurlUrl"
if ($YaraUrl) { if ($YaraUrl) {
Write-Host "[*] YARA URL : $YaraUrl" Write-Host "[*] YARA URL : $YaraUrl"
} else { } else {
Write-Host "[*] YARA : skipped on this architecture" Write-Host "[*] YARA : skipped on this architecture"
} }
if ($WamrUrl) { if ($WamrUrl) {
Write-Host "[*] WAMR URL : $WamrUrl" Write-Host "[*] WAMR URL : $WamrUrl"
} else { } else {
Write-Host "[*] WAMR : skipped on this architecture" Write-Host "[*] WAMR : skipped on this architecture"
} }
Write-Host "[*] artifacts URL: $ArtifactsUrl"
Write-Host "" Write-Host ""
# ================================ # ================================
# DOWNLOAD FILES # DOWNLOAD FILES
# ================================ # ================================
$PythonZip = Join-Path $TmpDir "python.zip" $PythonZip = Join-Path $TmpDir "python.zip"
$CurlZip = Join-Path $TmpDir "curl.zip" $CurlZip = Join-Path $TmpDir "curl.zip"
$YaraZip = Join-Path $TmpDir "yara.zip" $YaraZip = Join-Path $TmpDir "yara.zip"
$WamrTgz = Join-Path $TmpDir "wamr.tar.gz" $WamrTgz = Join-Path $TmpDir "wamr.tar.gz"
$ArtifactsZip = Join-Path $TmpDir "artifacts.zip"
try { try {
Download-File -Url $PythonUrl -Destination $PythonZip Download-File -Url $PythonUrl -Destination $PythonZip
Download-File -Url $CurlUrl -Destination $CurlZip Download-File -Url $CurlUrl -Destination $CurlZip
if ($YaraUrl) { if ($YaraUrl) {
Download-File -Url $YaraUrl -Destination $YaraZip Download-File -Url $YaraUrl -Destination $YaraZip
} }
if ($WamrUrl) { if ($WamrUrl) {
Download-File -Url $WamrUrl -Destination $WamrTgz Download-File -Url $WamrUrl -Destination $WamrTgz
} }
Download-File -Url $ArtifactsUrl -Destination $ArtifactsZip
} }
catch { catch {
Write-Host "[FATAL] Download phase failed." Write-Host "[FATAL] Download phase failed."
@ -272,16 +279,18 @@ catch {
# EXTRACT FILES # EXTRACT FILES
# ================================ # ================================
try { try {
Extract-Zip -ZipPath $PythonZip -DestDir (Join-Path $TargetDir "python") Extract-Zip -ZipPath $PythonZip -DestDir (Join-Path $TargetDir "python")
Extract-Zip -ZipPath $CurlZip -DestDir (Join-Path $TargetDir "curl") Extract-Zip -ZipPath $CurlZip -DestDir (Join-Path $TargetDir "curl")
if ($YaraUrl) { if ($YaraUrl) {
Extract-Zip -ZipPath $YaraZip -DestDir (Join-Path $TargetDir "yara") Extract-Zip -ZipPath $YaraZip -DestDir (Join-Path $TargetDir "yara")
} }
if ($WamrUrl) { if ($WamrUrl) {
Extract-TarGz -TarGzPath $WamrTgz -DestDir (Join-Path $TargetDir "wamr") Extract-TarGz -TarGzPath $WamrTgz -DestDir (Join-Path $TargetDir "wamr")
} }
Extract-Zip -ZipPath $ArtifactsZip -DestDir (Join-Path $TargetDir "bin")
} }
catch { catch {
Write-Host "[FATAL] Extraction phase failed." Write-Host "[FATAL] Extraction phase failed."

View File

@ -6,12 +6,8 @@ REM https://github.com/gnh1201/welsonjs
REM Set the service name REM Set the service name
set SERVICE_NAME=WelsonJS.Service set SERVICE_NAME=WelsonJS.Service
REM Get the current directory
set CURRENT_DIR=%~dp0
set CURRENT_DIR=%CURRENT_DIR:~0,-1%
REM Set the paths REM Set the paths
set EXE_PATH=%CURRENT_DIR%\bin\x86\WelsonJS.Service.exe set EXE_PATH=%APPDATA%\WelsonJS\bin\WelsonJS.Service.exe
set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
REM Uninstall the service REM Uninstall the service

View File

@ -1,5 +1,5 @@
; @created_on 2020-06-26 ; @created_on 2020-06-26
; @updated_on 2025-03-21 ; @updated_on 2025-11-21
; @author Namhyeon Go <gnh1201@catswords.re.kr> ; @author Namhyeon Go <gnh1201@catswords.re.kr>
[Setup] [Setup]
@ -32,17 +32,17 @@ ChangesAssociations=yes
; Root: HKCR; Subkey: "welsonjs"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: "" ; Root: HKCR; Subkey: "welsonjs"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: ""
; Root: HKCR; Subkey: "welsonjs\DefaultIcon"; ValueType: "string"; ValueData: "{app}\app\favicon.ico,0" ; Root: HKCR; Subkey: "welsonjs\DefaultIcon"; ValueType: "string"; ValueData: "{app}\app\favicon.ico,0"
; Root: HKCR; Subkey: "welsonjs\shell\open\command"; ValueType: "string"; ValueData: "cscript ""{app}\app.js"" uriloader ""%1""" ; Root: HKCR; Subkey: "welsonjs\shell\open\command"; ValueType: "string"; ValueData: "cscript ""{app}\app.js"" uriloader ""%1"""
Root: HKCR; Subkey: "WelsonJS.Script"; ValueType: string; ValueData: "WelsonJS Script"; Flags: uninsdeletekey Root: HKCR; Subkey: "{cm:AppName}.Script"; ValueType: string; ValueData: "{cm:AppName} Script"; Flags: uninsdeletekey
Root: HKCR; Subkey: "WelsonJS.Script\DefaultIcon"; ValueType: string; ValueData: "{app}\app\favicon.ico,0"; Flags: uninsdeletekey Root: HKCR; Subkey: "{cm:AppName}.Script\DefaultIcon"; ValueType: string; ValueData: "{app}\app\favicon.ico,0"; Flags: uninsdeletekey
Root: HKCR; Subkey: "WelsonJS.Script\shell"; ValueType: string; ValueData: "open"; Flags: uninsdeletevalue Root: HKCR; Subkey: "{cm:AppName}.Script\shell"; ValueType: string; ValueData: "open"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "WelsonJS.Script\shell\open"; ValueType: string; ValueData: "Run with WelsonJS"; Flags: uninsdeletevalue Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open"; ValueType: string; ValueData: "Run with {cm:AppName}"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "WelsonJS.Script\shell\open\command"; ValueType: string; ValueData: """{app}\bin\x86\WelsonJS.Launcher.exe"" --file ""%1"""; Flags: uninsdeletevalue Root: HKCR; Subkey: "{cm:AppName}.Script\shell\open\command"; ValueType: string; ValueData: """{app}\bin\x86\WelsonJS.Launcher.exe"" --file ""%1"""; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".js"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".js"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".ts"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".ts"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".re"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".re"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".res"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".res"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".ls"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".ls"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".coffee"; ValueType: string; ValueData: "WelsonJS.Script"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".coffee"; ValueType: string; ValueData: "{cm:AppName}.Script"; Flags: uninsdeletevalue
[Files] [Files]
Source: "app.js"; DestDir: "{app}"; Source: "app.js"; DestDir: "{app}";
@ -64,7 +64,7 @@ Source: "afterInstall.ps1"; DestDir: "{app}";
Source: "helloworld.*"; DestDir: "{app}"; Source: "helloworld.*"; DestDir: "{app}";
Source: "app\*"; Excludes: "assets\img\_templates,assets\tessdata\*,assets\tessdata_best\*,assets\tessdata_fast\*"; DestDir: "{app}/app"; Flags: ignoreversion recursesubdirs; Source: "app\*"; Excludes: "assets\img\_templates,assets\tessdata\*,assets\tessdata_best\*,assets\tessdata_fast\*"; DestDir: "{app}/app"; Flags: ignoreversion recursesubdirs;
Source: "lib\*"; DestDir: "{app}/lib"; Flags: ignoreversion recursesubdirs; Source: "lib\*"; DestDir: "{app}/lib"; Flags: ignoreversion recursesubdirs;
Source: "bin\*"; Excludes: "installer\*"; DestDir: "{app}/bin"; Flags: ignoreversion recursesubdirs; ; Source: "bin\*"; Excludes: "installer\*"; DestDir: "{app}/bin"; Flags: ignoreversion recursesubdirs;
Source: "data\*"; Excludes: "*-apikey.txt"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs; Source: "data\*"; Excludes: "*-apikey.txt"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs;
; Source: "node_modules\*"; DestDir: "{app}/node_modules"; Flags: ignoreversion recursesubdirs; ; Source: "node_modules\*"; DestDir: "{app}/node_modules"; Flags: ignoreversion recursesubdirs;
; Source: "bower_components\*"; DestDir: "{app}/node_modules"; Flags: ignoreversion recursesubdirs; ; Source: "bower_components\*"; DestDir: "{app}/node_modules"; Flags: ignoreversion recursesubdirs;
@ -77,7 +77,7 @@ Type: files; Name: "{app}\settings.ini"
Type: files; Name: "{app}\defaultService.js" Type: files; Name: "{app}\defaultService.js"
[Icons] [Icons]
Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{app}\bin\x86\WelsonJS.Launcher.exe"; AfterInstall: SetElevationBit('{group}\Start {cm:AppName} Launcher.lnk'); Name: "{group}\Start {cm:AppName} Launcher"; Filename: "{userappdata}\{cm:AppName}\WelsonJS.Launcher.exe"; AfterInstall: SetElevationBit('{group}\Start {cm:AppName} Launcher.lnk');
Name: "{group}\Test {cm:AppName}"; Filename: "{app}\bootstrap.bat"; AfterInstall: SetElevationBit('{group}\Test {cm:AppName}.lnk'); Name: "{group}\Test {cm:AppName}"; Filename: "{app}\bootstrap.bat"; AfterInstall: SetElevationBit('{group}\Test {cm:AppName}.lnk');
Name: "{group}\Uninstall {cm:AppName}"; Filename: "{uninstallexe}"; AfterInstall: SetElevationBit('{group}\Uninstall {cm:AppName}.lnk'); Name: "{group}\Uninstall {cm:AppName}"; Filename: "{uninstallexe}"; AfterInstall: SetElevationBit('{group}\Uninstall {cm:AppName}.lnk');
@ -85,9 +85,9 @@ Name: "{group}\Uninstall {cm:AppName}"; Filename: "{uninstallexe}"; AfterInstall
; Filename: {app}\bin\gtk2-runtime-2.24.33-2021-01-30-ts-win64.exe; ; Filename: {app}\bin\gtk2-runtime-2.24.33-2021-01-30-ts-win64.exe;
; Filename: {app}\bin\nmap-7.92\VC_redist.x86.exe; ; Filename: {app}\bin\nmap-7.92\VC_redist.x86.exe;
; Filename: {app}\bin\nmap-7.92\npcap-1.50.exe; ; Filename: {app}\bin\nmap-7.92\npcap-1.50.exe;
Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -NoProfile -File ""{app}\afterInstall.ps1"""; WorkingDir: "{app}"; Flags: nowait Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -NoProfile -File ""{app}\afterInstall.ps1"""; WorkingDir: "{app}"; Flags: waituntilterminated
Filename: {app}\installService.bat; Flags: nowait Filename: {app}\installService.bat; Flags: nowait
Filename: {app}\bin\x86\WelsonJS.Launcher.exe; Flags: nowait Filename: "{userappdata}\{cm:AppName}\bin\WelsonJS.Launcher.exe"; Flags: nowait
[UninstallRun] [UninstallRun]
Filename: {app}\uninstallService.bat; Filename: {app}\uninstallService.bat;

View File

@ -6,12 +6,8 @@ REM https://github.com/gnh1201/welsonjs
REM Set the service name REM Set the service name
set SERVICE_NAME=WelsonJS.Service set SERVICE_NAME=WelsonJS.Service
REM Get the current directory
set CURRENT_DIR=%~dp0
set CURRENT_DIR=%CURRENT_DIR:~0,-1%
REM Set the paths REM Set the paths
set EXE_PATH=%CURRENT_DIR%\bin\x86\WelsonJS.Service.exe set EXE_PATH=%APPDATA%\WelsonJS\bin\WelsonJS.Service.exe
set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe set INSTALL_UTIL_PATH=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
REM Uninstall the service REM Uninstall the service