Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently after performing an upgrade, and hence having to redo some of the manual configuration changes I'd performed, e.g. to configs in /etc or /usr/share, I decided I'd be more strict with myself this time and put all changes I make to my system into packages, so on the next upgrade I can just install my packages and have everything ready to go.

My first package is for my custom keymap. Following this post: create a .deb Package from scripts or binaries I have created a folder for the package and have my keymap listed in the debian/install file, to be installed in /usr/share/X11/xkb/symbols. I'm also going to need to add the symbols to /usr/share/X11/xkb/evdev.xml for them to be recognised, and thought that it would be better to use patch for this rather than overwriting the file.

To reiterate, I want to use patch as the installation method for my alterations to evdev.xml, not to patch package source code using quilt (which is what I've found through Internet searching)

So I have my keymap in the install file, and a patch command in the postinst file. My problem is that I don't know how to include the patch files into the package; after running debuild, the script and keymap are in the deb file, but the diffs aren't, so the postinst script won't be able to run.

Is there a way I can get my patches (or better, a folder called Patches) into the package, for use during the installatoin? If possible, I don't want to install these patches anywhere as they're only necessary during the installation process.


share|improve this question

Short of installing them somewhere like /usr/share/$package/patches/, there isn't a way that I know of to have those files available during the postinst script's run. More importantly, while this is a package just for your use, it is bad practice for one package to change files owned by another package. It also means that your changes will just get blown away when the other package gets updated. You'd be much better using dpkg-divert. See also this question.

share|improve this answer
Thanks, sorry for not replying earlier, I'm suddenly really busy but I looked into dpkg-divert and will try it properly when I have the time and post the results. Thanks again. – stellarpower Feb 23 '14 at 14:54

Your Answer


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.