I'm creating a small deb package to install a few files. Some of them will be located in /usr/lib/mypackage/ and I want to create a symlink from /usr/lib/mypackage/mybin to /usr/bin/mybin
For the /usr/lib/mypackage folder I'm using mypackage.install and copy the files over there. This seems to work fine.
However, in order to create my symlink I understand I need to use the debian rules file in there, and I'm not sure how to proceed, here is the line I need to add, where should it be added and how? Thanks
ln -s /usr/lib/mypackage/mybin /usr/bin/mybin
The best way is to use
dh_link, part of the debhelper suite. Seeman dh_linkfor details of its operation. As you can see from that, that you probably want something like the following in a file calleddebian/$mypackage.links:Where you should put
dh_linkin yourdebian/rules, if it's not already there, depends on how you're making your package. If you're using Debhelper, then yourdebian/rulesprobably already hasdh_linktaken care of (although if you're using classic Debhelper, then thedh_linkline might be commented out, and you need to uncomment it). Using newer-style Debhelper (dh) or CDBS-plus-debhelper (include /usr/share/cdbs/1/rules/debhelper.mk) also count here; they'll take care ofdh_linkfor you.But if you're not using Debhelper, and you don't want to start, then
dh_linkprobably isn't an option. In that case, you just need to make sure that you conform to Debian Policy on the subject (meaning your symlink there should be relative, not absolute). You'd probably want to make the link in yourdebian/rules'sbuildtarget. Example: