I am building a Debian package for deployment on Raspbian. Everything so far is looking good - I have libs going into /usr/libs, headers into /usr/include and changelogs into /usr/share/doc. I will also have a few utilities going into /usr/bin in the long run.

However, I also have some code examples I want to include. For most Raspbian users I could put them into /home/pi/some-examples-we-all-love. However, the installer may not be the pi user, and the default pi account could have been removed. Seems like a terrible idea.

One alternative would be install the examples into /tmp/some-examples-we-all-love and then try to find the name of the user who called sudo to install the package and use a postinst script to copy into their home directory and then clean up. But I don't know if that's actually possible.

Another alternative would be to put the examples somewhere else in the tree and then install a utility script into /usr/bin called "install-the-lovely-examples" or similar, and ask the user to run this in whatever directory they want the examples installed. The script would then copy the examples into whichever folder they like, whenever and however often they like. It also has the advantage of acting as a pseudo-backup in case the user hoses the examples and wants to try again from scratch.

I feel like the third option is probably best, but where should the example files be stored?

1 Answer 1


Examples should go in /usr/share/doc/${package}/examples. This is documented in Policy section 12.6, and you'll find such examples on most Debian-derived systems.


You must log in to answer this question.

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