Thursday, April 25, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 886  / 3 Years ago, sun, october 31, 2021, 7:26:32

I'm trying to a make a simple .deb package, which would basically edit a config of another package I listed as a dependency.



I added the required manipulations to the postinstall file.



The problem is I can't find a way to package an example config, which should be copied and edited from the postinstall script.



At the moment I just have a folder with the sample config, of which I'm creating a tar.gz and orig.tar.gz, then dh_make in that folder, edit the generated files and run debuild. However if I open the resulting .deb file with an archive manager, I can see that the sample file was not included at all.


More From » packaging

 Answers
6

For your use case you would not use a new package to modify your configuration. Rather, you should rebuild the package that you are modifying with a modified default config (via a patch). Then, you would upload that package to a PPA or similar repository system for easy installation.



Packaging a single file into a .deb just to change a different .deb's config file is not advised given that if that other .deb is modified and you ahve an explicit version in your debian/control, and the new version is too new, your system will reject the config-changing .deb.



Please comment on this answer with why you specifically want a .deb to do the conf changes, and I can elaborate on how you'd go about doing this, if at all.







Well, first is that I imagined that making such a .deb would be a no-brainer, secondly I don't expect the config to change a lot, and I think that if I repackage another package I will need to update my package as soon as an update arrives to the original one (?). I'd greatly appreciate your help, the package I'm trying to change the config of is collectd, and I just need to replace /etc/collectd/collectd.conf in the postinstall script – Fluffy




Making a .deb is not a no-brainer, you actually need substantial understanding of how packaging works among other things. You will have to update your package once an update arrives from the original one, but that can be partially decided based upon changelogs, including but not limited to what package currently exists in Ubuntu, and what is fixed in the differing version. But once you have the patch, you can apply it just as easily in the new version as it is to apply it to the old version, hence why I mentioned that.







Do I need to download the current .deb, unpack and edit it, or do I have to deal with the original source code? – Fluffy




This question is unanswerable in its current form, so let me elaborate on other questions i've seen:




What is a Source Package?




A source package is a package in which the binary installer packages (.debs) are built from. They contain the entire source code of a program, but with all applicable patches and Debian package information in them.




Does editing a source package mean i'm editing the source code of the program?




Not necessarily. The source code of the program is indeed what the package is built from, but unless you're changing that code, you could modify a package without even touching the code. Depending of course, on what you are trying to do.



So to explain simply, regardless of whichever you do here you'll need to edit either the source code of the program downloaded upstream, or the source code contained within the package. So the "Original Source Code" is going to be worked with regardless. The postinst scripts and other installation-related scripts though are stored in debian/* within the package, and are not part of the source code.






Patches to packages are touched upon in the packaging guide: http://developer.ubuntu.com/packaging/html/patches-to-packages.html



The complete Ubuntu Packaging Guide is here: http://developer.ubuntu.com/packaging/html/






After recieving additional information via email, the configuration is being updated for a specific package in order to include some type of restricted API that has a single-use key.



My method statement of using a PPA would not be recommended in this case given that API keys are usually specific to individual configurations, and such modified configurations should not be publicized, so that others don't try to hijack those configs.


[#37980] Sunday, October 31, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bunsistent

Total Points: 198
Total Questions: 108
Total Answers: 121

Location: Monaco
Member since Sun, Jan 16, 2022
2 Years ago
;