From 71e16016d5776d0b822612ff3dff355176dd6e1d Mon Sep 17 00:00:00 2001 From: xcz1997 Date: Thu, 14 Mar 2024 14:33:05 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8DDEBIAN=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=8B=E8=84=9A=E6=9C=AC=E6=96=87=E4=BB=B6=E5=B7=B2?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BD=86=E6=9C=AA=E5=8A=A0=E5=85=A5=E5=88=B0?= =?UTF-8?q?=E5=8C=85=E9=A1=B9=E4=B8=AD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Build/package.targets | 20 +++++++++++++++++++ DebUOS/Packaging.DebUOS.Tool/Program.cs | 2 +- .../Packaging.DebUOS/DebUOSPackageCreator.cs | 16 +++++++++++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/DebUOS/Packaging.DebUOS.NuGet/Build/package.targets b/DebUOS/Packaging.DebUOS.NuGet/Build/package.targets index 094356f..b93e68e 100644 --- a/DebUOS/Packaging.DebUOS.NuGet/Build/package.targets +++ b/DebUOS/Packaging.DebUOS.NuGet/Build/package.targets @@ -48,6 +48,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/DebUOS/Packaging.DebUOS.Tool/Program.cs b/DebUOS/Packaging.DebUOS.Tool/Program.cs index d194608..9527173 100644 --- a/DebUOS/Packaging.DebUOS.Tool/Program.cs +++ b/DebUOS/Packaging.DebUOS.Tool/Program.cs @@ -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 { diff --git a/DebUOS/Packaging.DebUOS/DebUOSPackageCreator.cs b/DebUOS/Packaging.DebUOS/DebUOSPackageCreator.cs index b97bbbc..78cce3a 100644 --- a/DebUOS/Packaging.DebUOS/DebUOSPackageCreator.cs +++ b/DebUOS/Packaging.DebUOS/DebUOSPackageCreator.cs @@ -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);