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.


1 Answer 1


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.

  • 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. Feb 23, 2014 at 14:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .