stefan-langenmaier / brother-overlay

Portage overlay for Brother printer and scanner software
GNU General Public License v3.0
34 stars 42 forks source link

net-print/brother-mfc7460dn-bin: Fix CUPS settings #53

Closed automorphism88 closed 6 years ago

automorphism88 commented 6 years ago

This fixes a few bugs in the ebuild I previously submitted. In particular, printing through the CUPS wrapper worked, but CUPS settings, e.g., for paper size, were not applied properly. This was due to two problems:

  1. The file /opt/brother/Printers/MFC7460DN/inf/brMFC7460DNrc needs to be owned by lp:lp instead of root:root. I also set the mode to 0600 to match the behavior of the upstream install script.
  2. The /usr/local paths need to be replaced in additional files, including the precompiled binaries. Luckily, this isn't a problem, since the /opt path is shorter, allowing strings to be padded at the end with null bytes.
automorphism88 commented 6 years ago

I made the new fix-paths-in-binary.sed script a little more robust than was strictly required for this ebuild, so that it can be more easily used with other ebuilds:

Note that the sed -z option is absolutely necessary with this script (as indicated by the shebang, though that's basically just a comment, since the script isn't executed directly, but via sed -f), to ensure that the padding null bytes are added in the correct location. To use these sed scripts with other ebuilds, just choose the appropriate one depending on the file being patched (fix-paths.sed for text files and fix-paths-in-binary.sed for binaries) and make sure to use the sed -z option when patching binaries. I envision eventually wrapping this in an eclass function to recursively search a directory (e.g. ${S}), automatically determine whether each file within is text or binary, and patch it accordingly.

stefan-langenmaier commented 6 years ago

Thanks for the pull request and again for the very informative explanation.