Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
I can also explain how to patch the package's default configs, and possibly even do taht for you within one of my PPAs. –  Thomas W. May 31 '12 at 15:03
    
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 May 31 '12 at 15:14
    
Do I need to download the current .deb, unpack and edit it, or do I have to deal with the original source code? –  Fluffy May 31 '12 at 15:15
    
I'd advise not messing with the postinst scripts, but have your modifications take place in the default conf, change what it says to match what you need, or manually replace the collectd.conf, or provide it separately without including it in any package. I'd need to see what change(s) you were doing first, though, before I can possibly help out, so a copy of what exactly you're trying to put into the file can be provided to my email address (send me an email via launchpad: launchpad.net/~trekcaptainusa-tw or at trekcaptainusa-tw AT ubuntu DOT com) –  Thomas W. May 31 '12 at 15:31
    
Relevant Package (info on LP) launchpad.net/ubuntu/+source/collectd –  Thomas W. May 31 '12 at 15:41
show 1 more comment

If you are packaging this for Ubuntu, the the best place for finding out information on how to do get it done, of course Ubuntu. See Ubuntu wiki

share|improve this answer
    
That's the page I used in the first place, but it deals with a directory of an unpacked source code, while in my situation that is just a single text file. –  Fluffy May 31 '12 at 12:06
    
Also, their use case (see last part of my answer) prevents it from existing in Ubuntu or the repositories (or even a PPA) because of the use of a private API key (which can have all sorts of hell when publicized). –  Thomas W. May 31 '12 at 20:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.