Create symbolic link deb package #14

Closed
opened 2026-01-29 16:27:13 +00:00 by claunia · 11 comments
Owner

Originally created by @franklupo on GitHub (Oct 15, 2017).

Hi,
great work.
How to make symbolic link from /usr/share/myprog to /usr/bin/myprog?

Best regards

Originally created by @franklupo on GitHub (Oct 15, 2017). Hi, great work. How to make symbolic link from /usr/share/**myprog** to /usr/bin/**myprog**? Best regards
Author
Owner

@qmfrederik commented on GitHub (Oct 15, 2017):

One way to enable this could be to expose MSBuild properties which allow you to add additional contents to the pre/post installation scripts.

@kekekeks What do you think?

@qmfrederik commented on GitHub (Oct 15, 2017): One way to enable this could be to expose MSBuild properties which allow you to add additional contents to the pre/post installation scripts. @kekekeks What do you think?
Author
Owner

@kekekeks commented on GitHub (Oct 15, 2017):

In case of deb-packages symlinks can be placed directly into data.tar.xz. deb packages are designed to handle everything that make install DESTDIR=debian/{packagename} can possibly create in that directory (that's the main way of populating package contents, actually).

I have no idea what to do with RPM.

@kekekeks commented on GitHub (Oct 15, 2017): In case of `deb`-packages symlinks can be placed directly into `data.tar.xz`. `deb` packages are designed to handle everything that `make install DESTDIR=debian/{packagename}` can possibly create in that directory (that's the main way of populating package contents, actually). I have no idea what to do with RPM.
Author
Owner

@kekekeks commented on GitHub (Oct 15, 2017):

BTW, @franklupo I'm not sure that it will even work with .NET Core, since binary might try to look for myprog.dll in /usr/bin instead of /usr/share/myprog, which will fail. And the common way of adding your program to /usr/bin with Mono was to create a shell script there. So I'd suggest to add

#!/bin/sh
exec /usr/share/myprog/myprog

and place it to /usr/bin/myprog using LinuxPath, see example here

@kekekeks commented on GitHub (Oct 15, 2017): BTW, @franklupo I'm not sure that it will even work with .NET Core, since binary might try to look for `myprog.dll` in `/usr/bin` instead of `/usr/share/myprog`, which will fail. And the common way of adding your program to `/usr/bin` with Mono was to create a shell script there. So I'd suggest to add ``` #!/bin/sh exec /usr/share/myprog/myprog ``` and place it to `/usr/bin/myprog` using `LinuxPath`, see [example](https://github.com/qmfrederik/dotnet-packaging/blob/master/demo/demo.csproj#L15) here
Author
Owner

@franklupo commented on GitHub (Oct 15, 2017):

Possible use PostInstallScripte?

@franklupo commented on GitHub (Oct 15, 2017): Possible use PostInstallScripte?
Author
Owner

@qmfrederik commented on GitHub (Oct 16, 2017):

@franklupo I think that @kekekeks 's suggestion to use a shell script and place it in /usr/bin/myprog using LinuxPath is actually the best way to implement this.

Can you give that a try and let us know if that works?

@qmfrederik commented on GitHub (Oct 16, 2017): @franklupo I think that @kekekeks 's suggestion to use a shell script and place it in `/usr/bin/myprog` using `LinuxPath` is actually the best way to implement this. Can you give that a try and let us know if that works?
Author
Owner

@franklupo commented on GitHub (Oct 16, 2017):

@qmfrederik Yes work. But i have new problem see issues #35

@franklupo commented on GitHub (Oct 16, 2017): @qmfrederik Yes work. But i have new problem see issues #35
Author
Owner

@qmfrederik commented on GitHub (Oct 17, 2017):

@franklupo Just wanted to check: with all the fixes that just went in, did you manage to create a .deb package for your project that is installable?

@qmfrederik commented on GitHub (Oct 17, 2017): @franklupo Just wanted to check: with all the fixes that just went in, did you manage to create a `.deb` package for your project that is installable?
Author
Owner

@franklupo commented on GitHub (Oct 18, 2017):

Ok, the problem is to keep permissions execution on the file.

<Content Include="myprog.sh" CopyToPublishDirectory="PreserveNewest">
    <LinuxPath>/usr/sbin/myprog</LinuxPath>
</Content>
@franklupo commented on GitHub (Oct 18, 2017): Ok, the problem is to keep permissions execution on the file. > <Content Include="myprog.sh" CopyToPublishDirectory="PreserveNewest"> > <LinuxPath>/usr/sbin/myprog</LinuxPath> > </Content>
Author
Owner

@qmfrederik commented on GitHub (Oct 19, 2017):

I'd need to double check but I believe we determine whether a file is executable or not in the ArchiveBuilder:

883187b384/Packaging.Targets/ArchiveBuilder.cs (L280-L281)

We should be able to modify that code so that it either:

  • Checks for the sh extension and sets the file to executable if that extension is found
  • Allows you to set a LinuxPermissions attribute on the Content item in the proj file and allow you to override the permissions that way.
@qmfrederik commented on GitHub (Oct 19, 2017): I'd need to double check but I believe we determine whether a file is executable or not in the ArchiveBuilder: https://github.com/qmfrederik/dotnet-packaging/blob/883187b3848267c6eb83533b566b017761a3b235/Packaging.Targets/ArchiveBuilder.cs#L280-L281 We should be able to modify that code so that it either: - Checks for the `sh` extension and sets the file to executable if that extension is found - Allows you to set a `LinuxPermissions` attribute on the `Content` item in the `proj` file and allow you to override the permissions that way.
Author
Owner

@kekekeks commented on GitHub (Oct 20, 2017):

Checks for the sh extension and sets the file to executable if that extension is found

I think we need to check for #! signature (e. g. #!/bin/sh) in files. Linux loader uses that to determine if file needs an interpreter, so we should do the same.

Overriding permissions manually would also be useful for setting stuff like suid-bit (we should NOT allow to set it for .NET Core binaries, since it will cause major security issues).

@kekekeks commented on GitHub (Oct 20, 2017): >Checks for the sh extension and sets the file to executable if that extension is found I think we need to check for `#!` signature (e. g. `#!/bin/sh`) in files. Linux loader uses that to determine if file needs an interpreter, so we should do the same. Overriding permissions manually would also be useful for setting stuff like suid-bit (we should NOT allow to set it for .NET Core binaries, since it **will cause major security issues**).
Author
Owner

@franklupo commented on GitHub (Oct 20, 2017):

@qmfrederik The best solution is to manually set permissions with LinuxPermissions.

Overriding permissions manually would also be useful for setting stuff like suid-bit (we should NOT allow to set it for .NET Core binaries, since it will cause major security issues).

@kekekeks The same problem you have with manual creation of a package.

@franklupo commented on GitHub (Oct 20, 2017): @qmfrederik The best solution is to manually set permissions with LinuxPermissions. > Overriding permissions manually would also be useful for setting stuff like suid-bit (we should NOT allow to set it for .NET Core binaries, since it **will cause major security issues**). @kekekeks The same problem you have with manual creation of a package.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#14