niumasoftware/installer/niumasoftware.generated.iss

78 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#define AppVersion "0.0.4"
; Inno Setup 安装脚本(全局安装)
; 产物约定(统一放在 dist\niumasoftware 下):
; - dist\niumasoftware\niumasoftware.exe 主程序PyInstaller onedir
; - dist\niumasoftware\update_helper.exe 更新助手PyInstaller onefile
;
; 安装时会创建一个“按需运行”的计划任务(最高权限)用于静默覆盖更新:
; CleanDesktopOrganizer\Update
;
; 同时创建 ProgramData 目录并赋予 Users Modify 权限,主程序把下载与请求文件写进去:
; {commonappdata}\CleanDesktopOrganizer\
[Setup]
AppName=牛马软件柜
; 由 build_installer.py 生成时注入(不要手改)
AppVersion={#AppVersion}
; 安装包自身图标
SetupIconFile=..\logo.ico
DefaultDirName={autopf}\牛马软件柜
DefaultGroupName=牛马软件柜
OutputBaseFilename=牛马软件柜安装包_{#AppVersion}
Compression=lzma2
SolidCompression=yes
PrivilegesRequired=admin
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\niumasoftware.exe
[Tasks]
Name: desktopicon; Description: "创建桌面快捷方式"; GroupDescription: "附加图标:"; Flags: unchecked
[Dirs]
; ProgramData给普通用户写入下载包与请求文件更新计划任务读取
Name: "{commonappdata}\CleanDesktopOrganizer"; Permissions: users-modify
Name: "{commonappdata}\CleanDesktopOrganizer\updates"; Permissions: users-modify
[Files]
; PyInstaller onedir直接复制整个目录包含 _internal、dll、资源等
Source: "..\dist\niumasoftware\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 更新助手PyInstaller onefile 也输出到 dist\niumasoftware 目录
Source: "..\dist\niumasoftware\update_helper.exe"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\牛马软件柜"; Filename: "{app}\niumasoftware.exe"; IconFilename: "{app}\niumasoftware.exe"
Name: "{autodesktop}\牛马软件柜"; Filename: "{app}\niumasoftware.exe"; Tasks: desktopicon; IconFilename: "{app}\niumasoftware.exe"
[Run]
Filename: "{app}\niumasoftware.exe"; Description: "运行 牛马软件柜"; Flags: nowait postinstall skipifsilent
[UninstallRun]
Filename: "{sys}\schtasks.exe"; Parameters: "/Delete /TN ""\CleanDesktopOrganizer\Update"" /F"; Flags: runhidden
[Code]
procedure CreateUpdateTask();
var
ResultCode: Integer;
Cmd: string;
begin
// 计划任务:以 SYSTEM 运行,按需触发(/SC ONDEMAND
// 注意TR 不带参数update_helper.exe 会读取 ProgramData 请求文件
Cmd :=
'/Create /F /TN "\CleanDesktopOrganizer\Update" ' +
'/RU "SYSTEM" /RL HIGHEST /SC ONDEMAND ' +
'/TR "' + ExpandConstant('{app}\update_helper.exe') + '"';
Exec(ExpandConstant('{sys}\schtasks.exe'), Cmd, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
CreateUpdateTask();
end;
end;