@@ -507,17 +507,31 @@ sub _tree2xml {
507
507
# see: http://stackoverflow.com/questions/10358989/wix-using-keypath-on-components-directories-files-registry-etc-etc
508
508
$result .= $ident ." " . qq[ <Component Id="$component_id " Guid="{$component_guid }" Feature="$this_feat ">\n ] ;
509
509
$result .= $ident ." " . qq[ <File Id="$file_id " Name="$file_basename " ShortName="$file_shortname " Source="$f ->{full_name}" KeyPath="yes"$vital />\n ] ;
510
- # Add service, registry and firewall definitions on feat_AGENT
510
+ # Only add service setup on feat_AGENT
511
511
if ($this_feat eq " feat_AGENT" ) {
512
512
my $servicename = $self -> global-> {service_name };
513
- my $installversion = $self -> global-> {agent_version };
514
- my $regpath = " Software\\ " .$self -> global-> {_provider }." -Agent" ;
515
513
$result .= $ident ." " . qq[ <ServiceInstall Name="$servicename " Start="auto"\n ] ;
516
514
$result .= $ident ." " . qq[ ErrorControl="normal" DisplayName="!(loc.ServiceDisplayName)" Description="!(loc.ServiceDescription)" Interactive="no"\n ] ;
517
515
$result .= $ident ." " . qq[ Type="ownProcess" Arguments='-I"[INSTALLDIR]perl\\ agent" -I"[INSTALLDIR]perl\\ site\\ lib" -I"[INSTALLDIR]perl\\ vendor\\ lib" -I"[INSTALLDIR]perl\\ lib" "[INSTALLDIR]perl\\ bin\\ glpi-win32-service"'>\n ] ;
518
516
$result .= $ident ." " . qq[ <util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="60" />\n ] ;
519
517
$result .= $ident ." " . qq[ </ServiceInstall>\n ] ;
520
518
$result .= $ident ." " . qq[ <ServiceControl Id="SetupService" Name="$servicename " Start="install" Stop="both" Remove="both" Wait="yes" />\n ] ;
519
+ } elsif ($file_id eq " f_agentmonitor_exe" ) {
520
+ my $regpath = " Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Run" ;
521
+ # Install GLPI-AgentMonitor only when required
522
+ $result .= $ident ." " . qq[ <Condition>AGENTMONITOR=1 AND EXECMODE=1</Condition>\n ] ;
523
+ # Add registry entry dedicated to GLPI-AgentMonitor autorun
524
+ $result .= $ident ." " . qq[ <RegistryValue Root="HKLM" Key="$regpath " Name="GLPI-AgentMonitor" Type="string" Value="[#f_agentmonitor_exe]" />\n ] ;
525
+ # Add Start menu shortcut for GLPI-AgentMonitor
526
+ $result .= $ident ." " . qq[ <Shortcut Id="AgentMonitorStartMenu" Advertise="yes" Directory="ProgramMenuFolder" Name="GLPI Agent Monitor" WorkingDirectory="d_perl_bin" Icon="agentmonitor.ico" />\n ] ;
527
+ }
528
+ # Add dedicated component for registry just after feat_AGENT
529
+ if ($this_feat eq " feat_AGENT" ) {
530
+ my $installversion = $self -> global-> {agent_version };
531
+ my $regpath = " Software\\ " .$self -> global-> {_provider }." -Agent" ;
532
+ ($component_id , $component_guid ) = $self -> _gen_component_id(" registry" );
533
+ $result .= $ident ." " . qq[ </Component>\n ] ;
534
+ $result .= $ident ." " . qq[ <Component Id="$component_id " Guid="{$component_guid }" Feature="$this_feat ">\n ] ;
521
535
$result .= $ident ." " . qq[ <RegistryKey Root="HKLM" Key="$regpath ">\n ] ;
522
536
$result .= $ident ." " . qq[ <RegistryValue Name="additional-content" Type="string" Value="[ADDITIONAL_CONTENT]" />\n ] ;
523
537
$result .= $ident ." " . qq[ <RegistryValue Name="debug" Type="string" Value="[DEBUG]" />\n ] ;
@@ -572,14 +586,6 @@ sub _tree2xml {
572
586
# Add registry entry dedicated to deployment vbs check
573
587
$result .= $ident ." " . qq[ <RegistryValue Name="Version" Type="string" Value="$installversion " />\n ] ;
574
588
$result .= $ident ." " . qq[ </RegistryKey>\n ] ;
575
- } elsif ($file_id eq " f_agentmonitor_exe" ) {
576
- my $regpath = " Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Run" ;
577
- # Install GLPI-AgentMonitor only when required
578
- $result .= $ident ." " . qq[ <Condition>AGENTMONITOR=1 AND EXECMODE=1</Condition>\n ] ;
579
- # Add registry entry dedicated to GLPI-AgentMonitor autorun
580
- $result .= $ident ." " . qq[ <RegistryValue Root="HKLM" Key="$regpath " Name="GLPI-AgentMonitor" Type="string" Value="[#f_agentmonitor_exe]" />\n ] ;
581
- # Add Start menu shortcut for GLPI-AgentMonitor
582
- $result .= $ident ." " . qq[ <Shortcut Id="AgentMonitorStartMenu" Advertise="yes" Directory="ProgramMenuFolder" Name="GLPI Agent Monitor" WorkingDirectory="d_perl_bin" Icon="agentmonitor.ico" />\n ] ;
583
589
}
584
590
$result .= $ident ." " . qq[ </Component>\n ] ;
585
591
}
0 commit comments