refact: msi, custom client props (#8913)
* refact: msi, custom client props Signed-off-by: fufesou <linlong1266@gmail.com> * format Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
a12969be30
commit
85604dee79
@ -17,7 +17,7 @@
|
||||
<CustomAction Id="RemoveFirewallRules.SetParam" Return="check" Property="RemoveFirewallRules" Value="0[INSTALLFOLDER]$(var.Product).exe" />
|
||||
<CustomAction Id="CreateStartService.SetParam" Return="check" Property="CreateStartService" Value="$(var.Product);"[INSTALLFOLDER]$(var.Product).exe" --service" />
|
||||
<CustomAction Id="TryStopDeleteService.SetParam" Return="check" Property="TryStopDeleteService" Value="$(var.Product)" />
|
||||
|
||||
|
||||
<CustomAction Id="LaunchApp" ExeCommand="" Return="asyncNoWait" FileRef="App.exe" />
|
||||
<CustomAction Id="LaunchAppTray" ExeCommand=" --tray" Return="asyncNoWait" FileRef="App.exe" />
|
||||
<Property Id="TerminateProcesses" Value="AppTest.exe" />
|
||||
@ -40,11 +40,11 @@
|
||||
<Custom Action="SetPropertyServiceStop.SetParam.ConfigFile" Before="SetPropertyServiceStop" Condition="NOT Installed" />
|
||||
<Custom Action="SetPropertyServiceStop.SetParam.ConfigKey" Before="SetPropertyServiceStop" Condition="NOT Installed" />
|
||||
<Custom Action="SetPropertyServiceStop.SetParam.PropertyName" Before="SetPropertyServiceStop" Condition="NOT Installed" />
|
||||
|
||||
|
||||
<!-- Do not call CreateStartService if is uninstalling. -->
|
||||
<!-- (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE) means uninstalling. -->
|
||||
<Custom Action="CreateStartService" Before="InstallFinalize" Condition="(NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) AND (NOT STOP_SERVICE="'Y'")" />
|
||||
<Custom Action="CreateStartService.SetParam" Before="CreateStartService" Condition="(NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) AND (NOT STOP_SERVICE="'Y'")" />
|
||||
<Custom Action="CreateStartService" Before="InstallFinalize" Condition="(NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) AND (NOT STOP_SERVICE="'Y'") AND (NOT CC_CONNECTION_TYPE="outgoing")" />
|
||||
<Custom Action="CreateStartService.SetParam" Before="CreateStartService" Condition="(NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) AND (NOT STOP_SERVICE="'Y'") AND (NOT CC_CONNECTION_TYPE="outgoing")" />
|
||||
|
||||
<Custom Action="CustomActionHello" Before="InstallFinalize" />
|
||||
|
||||
@ -54,14 +54,14 @@
|
||||
|
||||
<!-- Launch ClientLauncher if installing or already installed and not uninstalling -->
|
||||
<Custom Action="LaunchApp" After="InstallFinalize" Condition="NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)"/>
|
||||
<Custom Action="LaunchAppTray" After="InstallFinalize" Condition="(NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) AND (NOT STOP_SERVICE="'Y'")"/>
|
||||
<Custom Action="LaunchAppTray" After="InstallFinalize" Condition="(NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)) AND (NOT STOP_SERVICE="'Y'") AND (NOT CC_CONNECTION_TYPE="outgoing")"/>
|
||||
|
||||
<!--Workaround of "fire:FirewallException". If Outbound="Yes" or Outbound="true", the following error occurs.-->
|
||||
<!--ExecFirewallExceptions: Error 0x80070057: failed to add app to the authorized apps list-->
|
||||
<Custom Action="AddFirewallRules" Before="InstallFinalize" Condition="NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)"/>
|
||||
<Custom Action="AddFirewallRules.SetParam" Before="AddFirewallRules" Condition="NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)"/>
|
||||
|
||||
<Custom Action="AddRegSoftwareSASGeneration" Before="InstallFinalize" Condition="NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE)"/>
|
||||
<Custom Action="AddRegSoftwareSASGeneration" Before="InstallFinalize" Condition="NOT (Installed AND REMOVE AND NOT UPGRADINGPRODUCTCODE) AND (NOT CC_CONNECTION_TYPE="outgoing")"/>
|
||||
|
||||
<Custom Action="RemoveInstallFolder" Before="RemoveFiles"/>
|
||||
<Custom Action="RemoveInstallFolder.SetParam" Before="RemoveInstallFolder"/>
|
||||
@ -109,7 +109,7 @@
|
||||
</Component>
|
||||
</StandardDirectory>
|
||||
<StandardDirectory Id="StartupFolder">
|
||||
<Component Id="App.StartupFolder.ShortcutTray" Guid="B1D1E2BB-E53E-E159-DB7C-744D5C726A8C" Condition="STARTUPSHORTCUTS = 1">
|
||||
<Component Id="App.StartupFolder.ShortcutTray" Guid="B1D1E2BB-E53E-E159-DB7C-744D5C726A8C" Condition="STARTUPSHORTCUTS = 1 AND (NOT CC_CONNECTION_TYPE="outgoing")">
|
||||
<Shortcut Id="App.StartupFolder.ShortcutTray" Name="!(loc.SC_Client_Tray)" Description="!(loc.SC_Client_Tray_Desc)" Target="[!App.exe]" Arguments="--tray" Icon="AppIcon" WorkingDirectory="INSTALLFOLDER" />
|
||||
<RegistryValue Root="HKCU" Key="Software\$(var.Product)" Name="App.StartupFolder.ShortcutTray" Type="string" Value="1" KeyPath="yes" />
|
||||
</Component>
|
||||
|
@ -25,6 +25,9 @@
|
||||
<!--$ArpStart$-->
|
||||
<!--$ArpEnd$-->
|
||||
|
||||
<!--$CustomClientPropsStart$-->
|
||||
<!--$CustomClientPropsEnd$-->
|
||||
|
||||
<Property Id="APP_WINDOWS_INSTALLER">
|
||||
<RegistrySearch Id="AppWindowsInstallerFolderSearch" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\$(var.Product)" Name="WindowsInstaller" Type="raw" />
|
||||
</Property>
|
||||
|
@ -64,6 +64,12 @@ def make_parser():
|
||||
parser.add_argument(
|
||||
"-c", "--custom", action="store_true", help="Is custom client", default=False
|
||||
)
|
||||
parser.add_argument(
|
||||
"--custom-client-props",
|
||||
type=str,
|
||||
default="{}",
|
||||
help='Custom client properties, e.g. \'{"connection-type": "outgoing"}\'',
|
||||
)
|
||||
parser.add_argument(
|
||||
"--app-name", type=str, default="RustDesk", help="The app name."
|
||||
)
|
||||
@ -385,6 +391,33 @@ def gen_custom_ARPSYSTEMCOMPONENT(args, dist_dir):
|
||||
else:
|
||||
return gen_custom_ARPSYSTEMCOMPONENT_False(args)
|
||||
|
||||
def gen_custom_client_properties(args):
|
||||
try:
|
||||
props = json.loads(args.custom_client_props)
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Failed to decode custom props: {e}")
|
||||
return False
|
||||
|
||||
def func(lines, index_start):
|
||||
indent = g_indent_unit * 3
|
||||
|
||||
lines_new = []
|
||||
|
||||
if 'connection-type' in props:
|
||||
lines_new.append(
|
||||
f"""{indent}<Property Id="CC_CONNECTION_TYPE" Value="{props['connection-type']}" />\n"""
|
||||
)
|
||||
|
||||
for i, line in enumerate(lines_new):
|
||||
lines.insert(index_start + i + 1, line)
|
||||
return lines
|
||||
|
||||
return gen_content_between_tags(
|
||||
"Package/Fragments/AddRemoveProperties.wxs",
|
||||
"<!--$CustomClientPropsStart$-->",
|
||||
"<!--$CustomClientPropsEnd$-->",
|
||||
func,
|
||||
)
|
||||
|
||||
def gen_content_between_tags(filename, tag_start, tag_end, func):
|
||||
target_file = Path(sys.argv[0]).parent.joinpath(filename)
|
||||
@ -506,6 +539,9 @@ if __name__ == "__main__":
|
||||
if not gen_custom_ARPSYSTEMCOMPONENT(args, dist_dir):
|
||||
sys.exit(-1)
|
||||
|
||||
if not gen_custom_client_properties(args):
|
||||
sys.exit(-1)
|
||||
|
||||
if not gen_auto_component(app_name, dist_dir):
|
||||
sys.exit(-1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user