mirror of
https://github.com/hansjone/netx.git
synced 2026-10-10 11:20:48 +08:00
Release 0.4.11: Setup-only updates that preserve existing DB config.
Offline Setup and check_update now upgrade in place without the database wizard; zip packages are no longer published. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
7b5dd3eada
commit
a9c9d17550
11 changed files with 250 additions and 164 deletions
|
|
@ -1,11 +1,11 @@
|
|||
; NetX Windows installer (Inno Setup 6+)
|
||||
; NetX Windows installer (Inno Setup 6+)
|
||||
; Compile after: packaging\build_release.ps1
|
||||
; ISCC.exe packaging\installer\netx.iss
|
||||
; Encoding: UTF-8 with BOM (required for Chinese CustomMessages)
|
||||
|
||||
#define MyAppName "NetX"
|
||||
#ifndef MyAppVersion
|
||||
#define MyAppVersion "0.4.10"
|
||||
#define MyAppVersion "0.4.11"
|
||||
#endif
|
||||
#define MyAppPublisher "NetX"
|
||||
#define MyAppURL "https://github.com/hansjone/netx"
|
||||
|
|
@ -39,7 +39,7 @@ ArchitecturesAllowed=x64compatible
|
|||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
PrivilegesRequired=admin
|
||||
; Data lives under {commonappdata}\NetX - not overwritten by upgrades.
|
||||
; Do NOT use CloseApplications=yes — it can freeze/beep on the Tasks/Ready
|
||||
; Do NOT use CloseApplications=yes — it can freeze/beep on the Tasks/Ready
|
||||
; pages while scanning locked NetX tray/service processes with no visible dialog.
|
||||
CloseApplications=no
|
||||
ShowLanguageDialog=yes
|
||||
|
|
@ -66,45 +66,47 @@ english.DbUser=User
|
|||
english.DbPassword=Password
|
||||
english.DbName=Database
|
||||
english.CredKey=Credential key
|
||||
english.CredKeyHint=NETX_CREDENTIAL_SECRET_KEY (optional — empty = auto-generate)
|
||||
english.CredKeyHint=NETX_CREDENTIAL_SECRET_KEY (optional — empty = auto-generate)
|
||||
english.DbFieldsRequired=Please fill in host, port, user, password, and database name.
|
||||
english.DbTesting=Testing PostgreSQL connection, please wait…
|
||||
english.DbTesting=Testing PostgreSQL connection, please wait…
|
||||
english.DbTestFailed=Cannot connect to PostgreSQL with these settings.%n%n%1%n%nFix the settings and try again.
|
||||
english.DbTestExtractFailed=Could not extract PostgreSQL client tools for connection test.
|
||||
english.DbSilentExternalMissing=Silent install with external DB requires /DbHost /DbUser /DbPassword /DbName (optional /DbPort).
|
||||
english.DbApplyFailed=Database configuration failed after file install (exit %1).%n%nLog: %2%n%nFix the problem, then use Start Menu → Reconfigure database — or reinstall.
|
||||
english.DbApplyFailed=Database configuration failed after file install (exit %1).%n%nLog: %2%n%nFix the problem, then use Start Menu → Reconfigure database — or reinstall.
|
||||
english.DbApplyExecFailed=Could not start database configuration script.
|
||||
english.DbBundledMissing=Built-in PostgreSQL files are missing from the install folder:%n%1%n%nThe Setup package is incomplete. Re-download NetX-Setup and install again.
|
||||
english.DbEnvMissing=Database configuration did not write %ProgramData%\NetX\.env.
|
||||
english.ReconfigureDb=Reconfigure database
|
||||
chinesesimplified.CreateDesktopIcon=创建桌面快捷方式
|
||||
chinesesimplified.SetupOptions=安装完成后:
|
||||
chinesesimplified.StartTrayNow=立即启动 NetX 托盘
|
||||
chinesesimplified.EnableAutostart=开机时自动启动 NetX 托盘
|
||||
chinesesimplified.EnableAutoUpdate=启用每日静默自动更新(以后需要联网)
|
||||
chinesesimplified.InstallService=安装为 Windows 服务(使用已捆绑的 WinSW,可离线)
|
||||
chinesesimplified.UninstallDeleteData=是否同时删除 NetX 数据(%ProgramData%\NetX)?%n%n是 = 删除数据库、配置和密钥%n否 = 保留数据以便以后重装
|
||||
chinesesimplified.DbPageCaption=数据库
|
||||
chinesesimplified.DbPageDescription=选择内置或外置 PostgreSQL。可选粘贴已有 NETX_CREDENTIAL_SECRET_KEY;留空则自动生成。
|
||||
chinesesimplified.DbBundled=内置 PostgreSQL(便携,可离线)
|
||||
chinesesimplified.DbExternal=外置 PostgreSQL(已有服务器)
|
||||
chinesesimplified.DbHost=主机
|
||||
chinesesimplified.DbPort=端口
|
||||
chinesesimplified.DbUser=用户
|
||||
chinesesimplified.DbPassword=密码
|
||||
chinesesimplified.DbName=数据库名
|
||||
chinesesimplified.CredKey=凭据密钥
|
||||
chinesesimplified.CredKeyHint=NETX_CREDENTIAL_SECRET_KEY(可选,留空=自动生成)
|
||||
chinesesimplified.DbFieldsRequired=请填写主机、端口、用户、密码和数据库名。
|
||||
chinesesimplified.DbTesting=正在测试 PostgreSQL 连接,请稍候…
|
||||
chinesesimplified.DbTestFailed=无法用当前设置连接 PostgreSQL。%n%n%1%n%n请改正后重试。
|
||||
chinesesimplified.DbTestExtractFailed=无法解压 PostgreSQL 客户端以测试连接。
|
||||
chinesesimplified.DbSilentExternalMissing=静默安装外置库需要参数 /DbHost /DbUser /DbPassword /DbName(可选 /DbPort)。
|
||||
chinesesimplified.DbApplyFailed=文件安装后数据库自动配置失败(退出码 %1)。%n%n日志: %2%n%n请处理后使用开始菜单 → 重新配置数据库,或重新安装。
|
||||
chinesesimplified.DbApplyExecFailed=无法启动数据库配置脚本。
|
||||
chinesesimplified.DbBundledMissing=安装目录中缺少内置 PostgreSQL 文件:%n%1%n%n安装包不完整,请重新下载 NetX-Setup 后再装。
|
||||
chinesesimplified.DbEnvMissing=数据库配置未写入 %ProgramData%\NetX\.env。
|
||||
chinesesimplified.ReconfigureDb=重新配置数据库
|
||||
english.UpgradeKeepDb=Existing NetX data found - database settings will be kept (no wizard).
|
||||
chinesesimplified.CreateDesktopIcon=创建桌面快捷方式
|
||||
chinesesimplified.SetupOptions=安装完成后:
|
||||
chinesesimplified.StartTrayNow=立即启动 NetX 托盘
|
||||
chinesesimplified.EnableAutostart=开机时自动启动 NetX 托盘
|
||||
chinesesimplified.EnableAutoUpdate=启用每日静默自动更新(以后需要联网)
|
||||
chinesesimplified.InstallService=安装为 Windows 服务(使用已捆绑的 WinSW,可离线)
|
||||
chinesesimplified.UninstallDeleteData=是否同时删除 NetX 数据(%ProgramData%\NetX)?%n%n是 = 删除数据库、配置和密钥%n否 = 保留数据以便以后重装
|
||||
chinesesimplified.DbPageCaption=数据库
|
||||
chinesesimplified.DbPageDescription=选择内置或外置 PostgreSQL。可选粘贴已有 NETX_CREDENTIAL_SECRET_KEY;留空则自动生成。
|
||||
chinesesimplified.DbBundled=内置 PostgreSQL(便携,可离线)
|
||||
chinesesimplified.DbExternal=外置 PostgreSQL(已有服务器)
|
||||
chinesesimplified.DbHost=主机
|
||||
chinesesimplified.DbPort=端口
|
||||
chinesesimplified.DbUser=用户
|
||||
chinesesimplified.DbPassword=密码
|
||||
chinesesimplified.DbName=数据库名
|
||||
chinesesimplified.CredKey=凭据密钥
|
||||
chinesesimplified.CredKeyHint=NETX_CREDENTIAL_SECRET_KEY(可选,留空=自动生成)
|
||||
chinesesimplified.DbFieldsRequired=请填写主机、端口、用户、密码和数据库名。
|
||||
chinesesimplified.DbTesting=正在测试 PostgreSQL 连接,请稍候…
|
||||
chinesesimplified.DbTestFailed=无法用当前设置连接 PostgreSQL。%n%n%1%n%n请改正后重试。
|
||||
chinesesimplified.DbTestExtractFailed=无法解压 PostgreSQL 客户端以测试连接。
|
||||
chinesesimplified.DbSilentExternalMissing=静默安装外置库需要参数 /DbHost /DbUser /DbPassword /DbName(可选 /DbPort)。
|
||||
chinesesimplified.DbApplyFailed=文件安装后数据库自动配置失败(退出码 %1)。%n%n日志: %2%n%n请处理后使用开始菜单 → 重新配置数据库,或重新安装。
|
||||
chinesesimplified.DbApplyExecFailed=无法启动数据库配置脚本。
|
||||
chinesesimplified.DbBundledMissing=安装目录中缺少内置 PostgreSQL 文件:%n%1%n%n安装包不完整,请重新下载 NetX-Setup 后再装。
|
||||
chinesesimplified.DbEnvMissing=数据库配置未写入 %ProgramData%\NetX\.env。
|
||||
chinesesimplified.ReconfigureDb=重新配置数据库
|
||||
chinesesimplified.UpgradeKeepDb=检测到已有 NetX 数据 - 将保留数据库配置(跳过向导)。
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkedonce
|
||||
|
|
@ -140,7 +142,7 @@ Name: "{commonappdata}\NetX\backups"; Permissions: users-modify
|
|||
; Remove legacy desktop shortcuts from older Setup builds (keep a single NetX icon).
|
||||
Type: files; Name: "{commondesktop}\NetX Start.lnk"
|
||||
Type: files; Name: "{commondesktop}\NetX First-time setup.lnk"
|
||||
Type: files; Name: "{commondesktop}\首次配置(内置或外置数据库).lnk"
|
||||
Type: files; Name: "{commondesktop}\首次配置(内置或外置数据库).lnk"
|
||||
|
||||
[Icons]
|
||||
; Prefer .cmd targets so Server 2012 / classic Start Menu shows normal program entries.
|
||||
|
|
@ -200,6 +202,7 @@ var
|
|||
GDbName: String;
|
||||
GCredKey: String;
|
||||
GSkipDbPage: Boolean;
|
||||
GIsUpgrade: Boolean;
|
||||
GDbConfigured: Boolean;
|
||||
GPgToolsReady: Boolean;
|
||||
GDbConnOk: Boolean;
|
||||
|
|
@ -248,6 +251,37 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function ParamIsTruthy(const ParamName: String): Boolean;
|
||||
var
|
||||
V: String;
|
||||
begin
|
||||
V := LowerCase(Trim(ExpandConstant('{param:' + ParamName + '|}')));
|
||||
Result := (V = '1') or (V = 'true') or (V = 'yes') or (V = 'on');
|
||||
end;
|
||||
|
||||
function DetectExistingConfiguredInstall(): Boolean;
|
||||
begin
|
||||
{ Configured install = ProgramData\.env already has NETX_DB_MODE. }
|
||||
Result := EnvHasDbMode();
|
||||
end;
|
||||
|
||||
procedure StopNetxBeforeFileReplace();
|
||||
var
|
||||
ResultCode: Integer;
|
||||
StopScript: String;
|
||||
Params: String;
|
||||
begin
|
||||
StopScript := ExpandConstant('{app}\packaging\stop_netx_app.ps1');
|
||||
if not FileExists(StopScript) then
|
||||
Exit;
|
||||
Params :=
|
||||
'-NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File "' + StopScript + '"' +
|
||||
' -ProgramRoot "' + ExpandConstant('{app}') + '"' +
|
||||
' -DataRoot "' + ExpandConstant('{commonappdata}\NetX') + '"' +
|
||||
' -KillTray';
|
||||
Exec('powershell.exe', Params, ExpandConstant('{app}'), SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||
end;
|
||||
|
||||
function NetxShouldStartTray(): Boolean;
|
||||
begin
|
||||
Result := GDbConfigured or
|
||||
|
|
@ -504,10 +538,16 @@ begin
|
|||
GDbConfigured := False;
|
||||
GPgToolsReady := False;
|
||||
GDbConnOk := False;
|
||||
{ Always show DB page so choosing built-in always re-runs auto-configure.
|
||||
Skipping when .env exists caused upgrades/reinstalls to keep a broken or
|
||||
external config and still launch tray → confusing "first-time" prompts. }
|
||||
GSkipDbPage := False;
|
||||
{ Upgrade / reinstall over a configured install: skip DB wizard and keep
|
||||
ProgramData\.env / pgdata. Fresh install still shows the Database page.
|
||||
Force wizard: /ForceDbPage=1 Force skip: /SkipDbPage=1 }
|
||||
GIsUpgrade := DetectExistingConfiguredInstall();
|
||||
if ParamIsTruthy('ForceDbPage') then
|
||||
GSkipDbPage := False
|
||||
else if ParamIsTruthy('SkipDbPage') then
|
||||
GSkipDbPage := True
|
||||
else
|
||||
GSkipDbPage := GIsUpgrade;
|
||||
|
||||
DbPage := CreateCustomPage(wpSelectDir,
|
||||
ExpandConstant('{cm:DbPageCaption}'),
|
||||
|
|
@ -679,7 +719,7 @@ begin
|
|||
end;
|
||||
|
||||
{ Connection test here so bad settings never reach Tasks/Ready.
|
||||
Show busy state — ExtractTemporaryFile + psql can take a few seconds. }
|
||||
Show busy state — ExtractTemporaryFile + psql can take a few seconds. }
|
||||
SetWizardBusy(True, ExpandConstant('{cm:DbTesting}'));
|
||||
try
|
||||
Result := ValidateExternalDbSaved(ErrMsg);
|
||||
|
|
@ -863,7 +903,11 @@ var
|
|||
begin
|
||||
if CurStep = ssPostInstall then
|
||||
begin
|
||||
ApplyDatabaseConfig();
|
||||
{ Upgrade keeps existing .env / pgdata - do not re-run DB wizard. }
|
||||
if not GSkipDbPage then
|
||||
ApplyDatabaseConfig()
|
||||
else
|
||||
GDbConfigured := FileExists(ExpandConstant('{commonappdata}\NetX\.env'));
|
||||
|
||||
UninstallKey :=
|
||||
'Software\Microsoft\Windows\CurrentVersion\Uninstall\{A7E3C2D1-9F40-4B8E-9C1A-NETXWIN64001}_is1';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue