mirror of http://192.168.10.5:8099/sane/release
生产工具打包脚本,覆盖安装更改为卸载安装
This commit is contained in:
parent
3a259fe837
commit
d8ab54234b
|
@ -30,7 +30,15 @@ PrivilegesRequired=admin
|
||||||
DisableWelcomePage=no
|
DisableWelcomePage=no
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: "zn"; MessagesFile: "compiler:Languages/ChineseSimp.isl"
|
Name: "chinese_simp"; MessagesFile: "compiler:Languages/ChineseSimp.isl"; LicenseFile:HGProductionTool_App_License.txt
|
||||||
|
|
||||||
|
[CustomMessages]
|
||||||
|
chinese_simp.MyAppName=华高生产工具
|
||||||
|
chinese_simp.MyAppPublisher=宁波华高信息科技有限公司
|
||||||
|
chinese_simp.MyStr1=软件已安装,是否卸载原版本?
|
||||||
|
chinese_simp.MyStr2=请先关闭旧版软件!
|
||||||
|
chinese_simp.MyStr3=卸载旧版软件失败,停止安装!
|
||||||
|
chinese_simp.MyStr4=请先关闭软件!
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
|
|
||||||
|
@ -64,16 +72,101 @@ Source: "..\..\usb\huagao\hgscannerusball.cat"; DestDir: "{app}\driver\"; Flags
|
||||||
Source: "..\..\x86\Release\DPInst32.exe"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs; Check: not IsWin64
|
Source: "..\..\x86\Release\DPInst32.exe"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs; Check: not IsWin64
|
||||||
Source: "..\..\x64\Release\DPInst64.exe"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs; Check: IsWin64
|
Source: "..\..\x64\Release\DPInst64.exe"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs; Check: IsWin64
|
||||||
|
|
||||||
|
; 临时使用
|
||||||
|
Source: "..\..\x86\Release\RemoveOldApp.exe"; DestDir: "{tmp}\"; Flags: ignoreversion
|
||||||
|
Source: "..\..\x86\Release\CheckNewApp.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
|
||||||
|
Source: "..\..\x64\Release\CheckNewApp.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
|
||||||
|
|
||||||
[INI]
|
[INI]
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\ProductionTool.exe"
|
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\ProductionTool.exe"
|
||||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\ProductionTool.exe"
|
Name: "{group}\{#MyAppName}"; Filename: "{app}\ProductionTool.exe"
|
||||||
Name: "{group}\{cm:UninstallProgram, {#MyAppName}}"; Filename: "{uninstallexe}";
|
Name: "{group}\卸载 {cm:UninstallProgram, {#MyAppName}}"; Filename: "{uninstallexe}";
|
||||||
|
|
||||||
|
[Registry]
|
||||||
|
Root: HKLM; Subkey: "Software\ProductionTool"; ValueType: string; ValueName: "AppDirectory"; ValueData: "{app}"; Flags: uninsdeletekey
|
||||||
|
Root: HKLM; Subkey: "Software\ProductionTool"; ValueType: string; ValueName: "Application"; ValueData: "{app}\ProductionTool.exe"; Flags: uninsdeletekey
|
||||||
|
Root: HKLM; Subkey: "Software\ProductionTool"; ValueType: string; ValueName: "AppVersion"; ValueData: "{#MyAppVersion}"; Flags: uninsdeletekey
|
||||||
|
Root: HKLM; Subkey: "Software\ProductionTool"; ValueType: string; ValueName: "DriverPath"; ValueData: "{app}"; Flags: uninsdeletekey; Check: not Is64BitInstallMode
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
|
|
||||||
|
|
||||||
|
var
|
||||||
|
globalInstallPath: String;
|
||||||
|
|
||||||
|
procedure InitializeWizard;
|
||||||
|
begin
|
||||||
|
WizardForm.DirEdit.Text := globalInstallPath;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetInstallString(): String;
|
||||||
|
var
|
||||||
|
InstallPath: String;
|
||||||
|
begin
|
||||||
|
InstallPath := ExpandConstant('{pf}\{#MyAppDefSetupDir}');
|
||||||
|
if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{52021EA6-BCE5-4E07-8766-B6DC7C61FB51}_is1', 'Inno Setup: App Path') then
|
||||||
|
begin
|
||||||
|
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{52021EA6-BCE5-4E07-8766-B6DC7C61FB51}_is1', 'Inno Setup: App Path', InstallPath)
|
||||||
|
end
|
||||||
|
result := InstallPath;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function InitializeSetup(): boolean;
|
||||||
|
var
|
||||||
|
ErrorCode: Integer;
|
||||||
|
ResultCode: Integer;
|
||||||
|
ResultStr: String;
|
||||||
|
UninstallContinue: Boolean;
|
||||||
|
CmdStr: String;
|
||||||
|
begin
|
||||||
|
Result := false;
|
||||||
|
globalInstallPath := GetInstallString();
|
||||||
|
CmdStr := GetCmdTail();
|
||||||
|
ExtractTemporaryFile('RemoveOldApp.exe');
|
||||||
|
if Exec(ExpandConstant('{tmp}\RemoveOldApp.exe'), '', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode) then
|
||||||
|
begin
|
||||||
|
if 0 = ErrorCode then
|
||||||
|
begin
|
||||||
|
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{52021EA6-BCE5-4E07-8766-B6DC7C61FB51}_is1', 'UninstallString', ResultStr) then
|
||||||
|
begin
|
||||||
|
UninstallContinue := true;
|
||||||
|
if Pos('/verysilent', CmdStr) = 0 then
|
||||||
|
begin
|
||||||
|
if MsgBox(ExpandConstant('{cm:MyStr1}'), mbConfirmation, MB_YESNO) <> IDYES then
|
||||||
|
begin
|
||||||
|
UninstallContinue := false;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if UninstallContinue then
|
||||||
|
begin
|
||||||
|
ResultStr := RemoveQuotes(ResultStr);
|
||||||
|
if Exec(ResultStr, '/verysilent', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
|
||||||
|
begin
|
||||||
|
if 0 = ResultCode then
|
||||||
|
begin
|
||||||
|
Sleep(1000)
|
||||||
|
Result := true;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Result := true;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else if 2 = ErrorCode then
|
||||||
|
begin
|
||||||
|
MsgBox(ExpandConstant('{cm:MyStr2}'), mbInformation, MB_OK);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
MsgBox(ExpandConstant('{cm:MyStr3}'), mbInformation, MB_OK);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end;
|
||||||
function SetUninstallIcon(iconPath:string): Boolean;
|
function SetUninstallIcon(iconPath:string): Boolean;
|
||||||
var
|
var
|
||||||
InstalledVersion,SubKeyName: String;
|
InstalledVersion,SubKeyName: String;
|
||||||
|
@ -82,6 +175,24 @@ begin
|
||||||
RegWriteStringValue(HKLM,SubKeyName,'DisplayIcon',iconPath);
|
RegWriteStringValue(HKLM,SubKeyName,'DisplayIcon',iconPath);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function InitializeUninstall(): Boolean;
|
||||||
|
var
|
||||||
|
ErrorCode: Integer;
|
||||||
|
begin
|
||||||
|
Result := false;
|
||||||
|
if Exec(ExpandConstant('{app}\CheckNewApp.exe'), '', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode) then
|
||||||
|
begin
|
||||||
|
if 0 = ErrorCode then
|
||||||
|
begin
|
||||||
|
Result := true;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
MsgBox(ExpandConstant('{cm:MyStr4}'), mbInformation, MB_OK);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
procedure CurPageChanged(CurPageID: Integer);
|
procedure CurPageChanged(CurPageID: Integer);
|
||||||
begin
|
begin
|
||||||
if CurPageID = wpFinished then
|
if CurPageID = wpFinished then
|
||||||
|
|
Loading…
Reference in New Issue