Skip to content

Commit

Permalink
fix 修复DEBIAN目录下脚本文件已配置但未加入到包项中的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xcz1997 committed Mar 14, 2024
1 parent 8516168 commit 71e1601
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
20 changes: 20 additions & 0 deletions DebUOS/Packaging.DebUOS.NuGet/Build/package.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@
<DebUOSPackingWriteArgLine Include="$(DebControlFile)"/>
<DebUOSPackingWriteArgLine Include=">"/>

<DebUOSPackingWriteArgLine Include=">"/>
<DebUOSPackingWriteArgLine Include="DebPostinstFile" Condition="$(DebPostinstFile)!=''"/>
<DebUOSPackingWriteArgLine Include="$(DebPostinstFile)"/>
<DebUOSPackingWriteArgLine Include=">"/>

<DebUOSPackingWriteArgLine Include=">"/>
<DebUOSPackingWriteArgLine Include="DebPrermFile" Condition="$(DebPrermFile)!=''"/>
<DebUOSPackingWriteArgLine Include="$(DebPrermFile)"/>
<DebUOSPackingWriteArgLine Include=">"/>

<DebUOSPackingWriteArgLine Include=">"/>
<DebUOSPackingWriteArgLine Include="DebPostrmFile" Condition="$(DebPostrmFile)!=''"/>
<DebUOSPackingWriteArgLine Include="$(DebPostrmFile)"/>
<DebUOSPackingWriteArgLine Include=">"/>

<DebUOSPackingWriteArgLine Include=">"/>
<DebUOSPackingWriteArgLine Include="DebPreinstFile" Condition="$(DebPreinstFile)!=''"/>
<DebUOSPackingWriteArgLine Include="$(DebPreinstFile)"/>
<DebUOSPackingWriteArgLine Include=">"/>

<DebUOSPackingWriteArgLine Include=">"/>
<DebUOSPackingWriteArgLine Include="DebInfoFile" Condition="$(DebInfoFile)!=''"/>
<DebUOSPackingWriteArgLine Include="$(DebInfoFile)"/>
Expand Down
2 changes: 1 addition & 1 deletion DebUOS/Packaging.DebUOS.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
var workingFolder = new DirectoryInfo(configuration.WorkingFolder!);

var debUosPackageCreator = new DebUOSPackageCreator(logger);
debUosPackageCreator.PackageDeb(packingFolder, outputDebFile,workingFolder);
debUosPackageCreator.PackageDeb(packingFolder, outputDebFile, workingFolder);
}
else
{
Expand Down
16 changes: 12 additions & 4 deletions DebUOS/Packaging.DebUOS/DebUOSPackageCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,19 @@ private void WriteControl(DirectoryInfo packingFolder, Stream targetStream)
{
var controlTar = new MemoryStream();
WriteControlEntry(controlTar, "./");
foreach (var file in new[] { "control", "preinst", "postinst", "prerm", "postrm" })
{
var filePath = Path.Combine(packingFolder.FullName, "DEBIAN", file);
if (File.Exists(filePath))
{
var fileText = File.ReadAllText(filePath);
var mode = file == "control"
? LinuxFileMode.S_IRUSR | LinuxFileMode.S_IWUSR | LinuxFileMode.S_IRGRP | LinuxFileMode.S_IROTH
: LinuxFileMode.S_IRUSR | LinuxFileMode.S_IWUSR | LinuxFileMode.S_IXUSR;
WriteControlEntry(controlTar, $"./{file}", fileText, mode);
}
}

var controlFile = Path.Combine(packingFolder.FullName, "DEBIAN", "control");
var controlFileText = File.ReadAllText(controlFile);

WriteControlEntry(controlTar, "./control", controlFileText);
TarFileCreator.WriteTrailer(controlTar);
controlTar.Seek(0, SeekOrigin.Begin);

Expand Down

0 comments on commit 71e1601

Please sign in to comment.