Is it possible to reference an external file as a content file? #125

Closed
opened 2026-01-29 16:30:08 +00:00 by claunia · 4 comments
Owner

Originally created by @stephen-swensen on GitHub (Aug 2, 2022).

Let's say I have buillt a package like myapp.deb and distribute it to customers along with a customer-specific config file like myapp.cfg... when installing myapp.deb from a directory with myapp.cfg placed along side of it, is it possible for myapp.deb to reference the external file (relative to the directory being installed from, like a home directory) so that it is copied to the application installation directory (like /usr/share/myapp/myapp.cfg)? Bonus if installation aborts if the file is missing.

Thanks!

Originally created by @stephen-swensen on GitHub (Aug 2, 2022). Let's say I have buillt a package like `myapp.deb` and distribute it to customers along with a customer-specific config file like `myapp.cfg`... when installing `myapp.deb` from a directory with `myapp.cfg` placed along side of it, is it possible for `myapp.deb` to reference the external file (relative to the directory being installed from, like a home directory) so that it is copied to the application installation directory (like `/usr/share/myapp/myapp.cfg`)? Bonus if installation aborts if the file is missing. Thanks!
Author
Owner

@atauenis commented on GitHub (Aug 2, 2022):

Made a separate package, say, myapp-company-branding, which will install brand configuration to /etc/myapp.conf.d/ directory (myapp should read configuration from it). This is correct UNIX-way, and this is used by some Linux distributions to apply branding.

@atauenis commented on GitHub (Aug 2, 2022): Made a separate package, say, `myapp-company-branding`, which will install brand configuration to `/etc/myapp.conf.d/` directory (`myapp` should read configuration from it). This is correct UNIX-way, and this is used by some Linux distributions to apply branding.
Author
Owner

@stephen-swensen commented on GitHub (Aug 2, 2022):

Hmm, I see - I'll think on that, thanks. I am a bit hesitant to go down that road because the work I am doing is extending Linux support to an app that currently just supports Windows. I want to minimize code and distribution differences (the Windows app is distributed as an MSI like myapp.msi which picks up the external myapp.cfg and copies it to the installation directory, so I was wanting to replicate that as near as possible; the app also expects the configuration file to be present from the directory path of the executable, so I'd rather avoid platform specific differences there too).

@stephen-swensen commented on GitHub (Aug 2, 2022): Hmm, I see - I'll think on that, thanks. I am a bit hesitant to go down that road because the work I am doing is extending Linux support to an app that currently just supports Windows. I want to minimize code and distribution differences (the Windows app is distributed as an MSI like `myapp.msi` which picks up the external `myapp.cfg` and copies it to the installation directory, so I was wanting to replicate that as near as possible; the app also expects the configuration file to be present from the directory path of the executable, so I'd rather avoid platform specific differences there too).
Author
Owner

@stephen-swensen commented on GitHub (Aug 3, 2022):

Maybe debconf could be used somehow to prompt the user for the location of the config file and use it in a preinstall script to copy the file 🤔

Anyways, I'll go ahead and close this Issue if there is no direct way to do this through dotnet deb. Thanks for your insight!

@stephen-swensen commented on GitHub (Aug 3, 2022): Maybe debconf could be used somehow to prompt the user for the location of the config file and use it in a preinstall script to copy the file 🤔 Anyways, I'll go ahead and close this Issue if there is no direct way to do this through dotnet deb. Thanks for your insight!
Author
Owner

@stephen-swensen commented on GitHub (Aug 3, 2022):

It's definitely hacky / fragile, but I was able to do what I was looking for with a preinstall script like:

  <PropertyGroup>
    <PreInstallScript>
      <![CDATA[mkdir -p /usr/share/myapp && find /home -type f -name 'myapp.cfg' | xargs cp -t /usr/share/myapp/]]>
    </PreInstallScript>
  </PropertyGroup>
@stephen-swensen commented on GitHub (Aug 3, 2022): It's definitely hacky / fragile, but I was able to do what I was looking for with a preinstall script like: ``` <PropertyGroup> <PreInstallScript> <![CDATA[mkdir -p /usr/share/myapp && find /home -type f -name 'myapp.cfg' | xargs cp -t /usr/share/myapp/]]> </PreInstallScript> </PropertyGroup> ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#125