HIRS/HIRS_Provisioner.NET/hirs/Directory.Build.targets
2023-06-08 13:56:01 -04:00

62 lines
2.7 KiB
XML

<Project>
<Target Name="RenameBeforePublishLinux" BeforeTargets="CreatePackageProperties" Condition="$(RuntimeIdentifier.Contains('linux'))">
<PropertyGroup>
<SymlinkAppHostInBin Condition="'$(SymlinkAppHostInBin)' == ''">false</SymlinkAppHostInBin> <!-- If true, this will place a symlink in /usr/local/bin/, which is not on $PATH for root by default. We need the symlink in /bin or /sbin -->
</PropertyGroup>
<Move SourceFiles="$(OUTDIR)publish\$(AssemblyName)" DestinationFiles="$(OUTDIR)publish\tpm_aca_provision" />
<Message Text="Renamed linux binary file." Importance="high" />
</Target>
<Target Name="RenameBeforePublishWindows" BeforeTargets="SetWixPath" Condition="$(RuntimeIdentifier.Contains('win'))">
<Move SourceFiles="$(OUTDIR)publish\$(AssemblyName).exe" DestinationFiles="$(OUTDIR)publish\tpm_aca_provision.exe" />
<Message Text="Renamed exe binary file." Importance="high" />
</Target>
<PropertyGroup>
<PostInstallScript>"/bin/sh -c \"chmod 664 /usr/share/hirs/appsettings.json\""</PostInstallScript>
</PropertyGroup>
<Target Name="SetWixPath" BeforeTargets="Msi">
<PropertyGroup>
<ProductSourceFilePath>$(MSBuildThisFileDirectory)\Resources\Product.wxs</ProductSourceFilePath>
<WixInstallPath>$(NuGetPackageRoot)wix\3.11.2\tools\</WixInstallPath>
<Heat>$(WixInstallPath)heat.exe</Heat>
<Candle>$(WixInstallPath)candle.exe</Candle>
<Light>$(WixInstallPath)light.exe</Light>
</PropertyGroup>
</Target>
<Target Name="DeletePDB" AfterTargets="RenameBeforePublishLinux;RenameBeforePublishWindows">
<ItemGroup>
<PDBToDelete Include="$(PublishDir)*.pdb"/>
</ItemGroup>
<Delete Files="@(PDBToDelete)" />
<Message Text="Deleted PDB files." Importance="high" />
</Target>
<Target Name="CopyFiles" AfterTargets="DeletePDB">
<ItemGroup>
<PaccorScriptsDll Include="$(OUTDIR)paccor_scripts.dll"/>
</ItemGroup>
<Copy
SourceFiles="@(PaccorScriptsDll)"
DestinationFolder="$(PublishDir)plugins"
/>
<ItemGroup>
<PaccorScriptsLinux Include="$(PublishDir)scripts\*"/>
<PaccorScriptsWindows Include="$(PublishDir)scripts\windows\*"/>
</ItemGroup>
<Move
SourceFiles="@(PaccorScriptsLinux)"
DestinationFolder="$(PublishDir)plugins/scripts"
/>
<Move
SourceFiles="@(PaccorScriptsWindows)"
DestinationFolder="$(PublishDir)plugins/scripts/windows"
/>
<RemoveDir Directories="$(PublishDir)scripts" />
</Target>
<ItemGroup>
<Content Include="plugins\**\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>
</Project>