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);