Ancora update logica script install servizi
This commit is contained in:
+16
-62
@@ -4,8 +4,6 @@
|
||||
<?define Manufacturer="EgalWare"?>
|
||||
<?define ProductName="Maat.Runner" ?>
|
||||
|
||||
|
||||
|
||||
<Package Name="$(var.ProductName)" Manufacturer="$(var.Manufacturer)" UpgradeCode="35ff92c1-54b7-4b9a-8a96-97c8f18fa126" Version="!(bind.FileVersion.MaatRunner)" >
|
||||
|
||||
<!--Licenza d'uso (EULA)-->
|
||||
@@ -34,18 +32,6 @@
|
||||
Condition="WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed"/>-->
|
||||
</UI>
|
||||
|
||||
<!-- Checkbox checked by default -->
|
||||
<!--<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>-->
|
||||
|
||||
<!-- Checkbox text message -->
|
||||
<!--<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.LaunchOnExit)"/>-->
|
||||
|
||||
<!-- Set our executable (its ID) as custom action target -->
|
||||
<!--<Property Id="WixShellExecTarget" Value="SERVICE_ADD"/>-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!--Componenti sw-->
|
||||
<Feature Id="Main" Title="MaatRunner" Level="1">
|
||||
<ComponentGroupRef Id="AppSettings" />
|
||||
@@ -55,63 +41,33 @@
|
||||
<ComponentGroupRef Id="MaatRunner" />
|
||||
</Feature>
|
||||
|
||||
|
||||
|
||||
<!--<CustomAction Id="SimplePSRun"
|
||||
Directory='InstallPath'
|
||||
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
|
||||
DllEntry="WixShellExecBinary"
|
||||
Execute="immediate"
|
||||
Impersonate="no"
|
||||
Return="ignore" />-->
|
||||
|
||||
<!--Esempio OK-->
|
||||
<!--Esempio OK licenza-->
|
||||
<!--<Binary Id="License.rtf" SourceFile="License.rtf" />
|
||||
<Property Id="WixShellExecBinaryId" Value="License.rtf" />
|
||||
<CustomAction Id="LaunchReadmeCustomAction" BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" DllEntry="WixShellExecBinary" Execute="immediate" Return="check" />
|
||||
|
||||
<CustomAction Id="LaunchReadmeCustomAction" BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" DllEntry="WixShellExecBinary" Execute="immediate" Return="check" />
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="LaunchReadmeCustomAction" Before="AppSearch" />
|
||||
</InstallExecuteSequence>-->
|
||||
|
||||
|
||||
<!--<Property Id="POWERSHELLVERSION">
|
||||
<RegistrySearch Id="POWERSHELLVERSION"
|
||||
Type="raw"
|
||||
Root="HKLM"
|
||||
Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine"
|
||||
Name="PowerShellVersion" />
|
||||
</Property>
|
||||
<Property Id="POWERSHELLEXE">
|
||||
<RegistrySearch Id="POWERSHELLEXE"
|
||||
Type="raw"
|
||||
Root="HKLM"
|
||||
Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
|
||||
Name="Path" />
|
||||
</Property>-->
|
||||
|
||||
<!-- My custom actions install scripts-->
|
||||
<!--<CustomAction Id="RegisterPSCmd"
|
||||
Property="RegisterPowerShellProperty"
|
||||
Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -InputFormat None -NoProfile -File "$(var.ProjectDir)\service-add.ps1" "$(var.ProjectDir)""
|
||||
Execute="immediate" />
|
||||
<!--
|
||||
<CustomAction Id="RegisterPSCmd"
|
||||
Property="RegisterPowerShellProperty"
|
||||
Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -InputFormat None -NoProfile -File "$(var.ProjectDir)\service-add.ps1" "$(var.ProjectDir)""
|
||||
Execute="immediate" />
|
||||
<CustomAction Id="RegisterPowerShellProperty"
|
||||
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
|
||||
DllEntry="WixQuietExec"
|
||||
Execute="deferred"
|
||||
Return="check"
|
||||
Impersonate="no" />
|
||||
|
||||
<CustomAction Id="RegisterPSCmdUninstall"
|
||||
Property="RegisterPowerShellPropertyUninstall"
|
||||
Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -InputFormat None -NoProfile -File "$(var.ProjectDir)\service-remove.ps1" "$(var.ProjectDir)""
|
||||
Execute="immediate" />
|
||||
|
||||
<CustomAction Id="RegisterPowerShellProperty" BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />
|
||||
|
||||
<CustomAction Id="RegisterPowerShellPropertyUninstall" BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />-->
|
||||
|
||||
<!--<InstallExecuteSequence>
|
||||
<Custom Action="RegisterPSCmd" After="CostFinalize"></Custom>
|
||||
<Custom Action="RegisterPowerShellProperty" After="InstallFiles"></Custom>
|
||||
<Custom Action='RegisterPSCmdUninstall' Before='CostInitialize'></Custom>
|
||||
<Custom Action='RegisterPowerShellPropertyUninstall' Before='RemoveFiles'></Custom>
|
||||
</InstallExecuteSequence>-->
|
||||
|
||||
<!--<InstallExecuteSequence>
|
||||
<Custom Action="RegisterPSCmd" After="CostFinalize"></Custom>
|
||||
<Custom Action="RegisterPowerShellProperty" After="InstallFiles"></Custom>
|
||||
@@ -128,7 +84,7 @@
|
||||
Name="Path" />
|
||||
</Property>
|
||||
|
||||
<SetProperty Id="RunPSscript"
|
||||
<SetProperty Id="RunPSscript"
|
||||
After="InstallFiles"
|
||||
Sequence="execute"
|
||||
Value=""[POWERSHELLEXE]" -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '[#ServiceAdd.ps1]' ; exit $$($Error.Count)"" />
|
||||
@@ -138,8 +94,7 @@
|
||||
DllEntry="WixQuietExec"
|
||||
Execute="deferred"
|
||||
Return="check"
|
||||
Impersonate="no"
|
||||
/>
|
||||
Impersonate="no" />
|
||||
|
||||
|
||||
<SetProperty Id="RunPSscriptUninstall"
|
||||
@@ -152,8 +107,7 @@
|
||||
DllEntry="WixQuietExec"
|
||||
Execute="deferred"
|
||||
Return="check"
|
||||
Impersonate="no"
|
||||
/>
|
||||
Impersonate="no" />
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="RunPSscript" After="InstallFiles"></Custom>
|
||||
|
||||
@@ -1,8 +1,36 @@
|
||||
param([string]$InstallDir="C:\Program Files\EgalWare\Maat.Runner");
|
||||
|
||||
# funzione verifica servizi
|
||||
function Confirm-WindowsServiceExists($name)
|
||||
{
|
||||
$server="localhost"
|
||||
if (Get-Service -Name $name -Computername $server -ErrorAction SilentlyContinue -ErrorVariable WindowsServiceExistsError)
|
||||
{
|
||||
Write-Host "$name Exists on $server"
|
||||
return $true
|
||||
}
|
||||
|
||||
if ($WindowsServiceExistsError)
|
||||
{
|
||||
Write-Host "$server" $WindowsServiceExistsError[0].exception.message
|
||||
}
|
||||
|
||||
return $false
|
||||
}
|
||||
|
||||
# mi sposto nella directory
|
||||
CD $InstallDir
|
||||
|
||||
# verifico se ci fosse già il servizio e lo disinstallo nel caso
|
||||
if(Confirm-WindowsServiceExists("Maat.Runner"))
|
||||
{
|
||||
# stop servizio
|
||||
./nssm.exe stop Maat.Runner
|
||||
|
||||
## elimino servizio installazione
|
||||
#./nssm.exe remove Maat.Runner confirm
|
||||
}
|
||||
|
||||
# avvio installazione
|
||||
./nssm.exe install Maat.Runner "$InstallDir\Maat.Runner.exe"
|
||||
|
||||
|
||||
@@ -1,10 +1,33 @@
|
||||
param([string]$InstallDir="C:\Program Files\EgalWare\Maat.Runner");
|
||||
|
||||
|
||||
# funzione verifica servizi
|
||||
function Confirm-WindowsServiceExists($name)
|
||||
{
|
||||
$server="localhost"
|
||||
if (Get-Service -Name $name -Computername $server -ErrorAction SilentlyContinue -ErrorVariable WindowsServiceExistsError)
|
||||
{
|
||||
Write-Host "$name Exists on $server"
|
||||
return $true
|
||||
}
|
||||
|
||||
if ($WindowsServiceExistsError)
|
||||
{
|
||||
Write-Host "$server" $WindowsServiceExistsError[0].exception.message
|
||||
}
|
||||
|
||||
return $false
|
||||
}
|
||||
|
||||
# mi sposto nella directory
|
||||
CD $InstallDir
|
||||
|
||||
# stop servizio
|
||||
./nssm.exe stop Maat.Runner
|
||||
# verifico se ci fosse già il servizio e lo disinstallo
|
||||
if(Confirm-WindowsServiceExists("Maat.Runner"))
|
||||
{
|
||||
# stop servizio
|
||||
./nssm.exe stop Maat.Runner
|
||||
|
||||
# elimino servizio installazione
|
||||
./nssm.exe remove Maat.Runner confirm
|
||||
# elimino servizio installazione
|
||||
./nssm.exe remove Maat.Runner confirm
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>1.0.2404.911</Version>
|
||||
<Version>1.0.2404.918</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user