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_link
for 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_link
in yourdebian/rules
, if it's not already there, depends on how you're making your package. If you're using Debhelper, then yourdebian/rules
probably already hasdh_link
taken care of (although if you're using classic Debhelper, then thedh_link
line 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_link
for you.But if you're not using Debhelper, and you don't want to start, then
dh_link
probably 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
'sbuild
target. Example: