Monday, October 22, 2007

dh_fixperms headaches

If you ever wondered why lines such as

install/mypackage:
chmod 4511 debian/tmp/usr/bin/my_setuid_binary

in your debian/rules file seem to be magically ignored in the resulting package, then look no further. It took me some time to figure it out, after trying all kind of combinations of post-install, pre-finalize and pre-install routines. In the end it was quite obvious.
By including the standard debhelper rules (/usr/share/cdbs/1/rules/debhelper.mk) there're a whole bunch of scripts being unleashed on your package and one of them is dh_fixperms(1) which "removes the setuid and setgid bits from all files in the package".
That's fine, but we want to override this with a statement in debian/rules

DEB_FIXPERMS_EXCLUDE := regex

where the regex excludes each file which matches. Good to know.

0 comments: