diff options
author | Karol Babioch | 2019-07-21 23:42:59 +0200 |
---|---|---|
committer | Karol Babioch | 2019-07-21 23:42:59 +0200 |
commit | ae534020d0b98ec4d19d045e9a4302b6d82fa0c3 (patch) | |
tree | de5da77c3f220c359a2192e9852f350d700e2f4b | |
parent | 211abc45373832f48974d273c6562807eef42c28 (diff) | |
download | aur-ae534020d0b98ec4d19d045e9a4302b6d82fa0c3.tar.gz |
Fix build for latest release of driver
This fixes the packaging for the latest release of the Brother driver.
The details are outlined in a comment [1]. This is a generalized version
of the PKGBUILD specific to a particular model [2].
[1]: https://aur.archlinux.org/packages/brother-ql710w/#comment-695987
[2]: https://pastebin.com/xXnw256Y
-rw-r--r-- | PKGBUILD | 57 |
1 files changed, 43 insertions, 14 deletions
@@ -17,10 +17,23 @@ prepare() # Create necessary CUPS directories install -d "${srcdir}/usr/share/cups/model" install -d "${srcdir}/usr/lib/cups/filter" + install -d "${srcdir}/usr/bin" # Locate cupswrapper script - cd $(find -type d -name 'cupswrapper') - _cupswrapper=$(ls cupswrapper*) + _cupswrapper=$(find "${srcdir}/opt/brother/PTouch/" -type f -name 'cupswrapper*') + echo "cupswrapper: ${_cupswrapper}" + + # Locate lpdwrapper script / symlink + _lpdwrapper=$(find "${srcdir}/opt/brother/PTouch/" -name "brother_lpdwrapper_*") + echo "lpdwrapper: ${_lpdwrapper}" + + # Basename of lpdwrapper script + _lpdwrapper_basename="$(basename "${_lpdwrapper}")" + echo "lpdwrapper_basename: ${_lpdwrapper_basename}" + + # Get model name of driver based on name from lpdwrapper script (e.g. brother_lpdwrapper_ql720nw -> ql720nw) + _model="${_lpdwrapper_basename##brother_lpdwrapper_}" + echo "model: ${_model}" # Patch cupswrapper script sed -i '/^sleep/d' ${_cupswrapper} @@ -31,25 +44,31 @@ prepare() sed -i "s|/model/Brother|/model|g" ${_cupswrapper} sed -i 's|lpinfo|echo|g' ${_cupswrapper} + # Remove potential symlink (from previous runs) + rm -f "${srcdir}/usr/lib/cups/filter/${_lpdwrapper_basename}" + # Invoke cupswrapper script export srcdir=${srcdir} - ./${_cupswrapper} + ${_cupswrapper} # Patch resulting filter - sed -i "s|${srcdir}||" ${srcdir}/usr/lib/cups/filter/*lpdwrapper* - - # Remove cupswrapper script and templates - find "${srcdir}" -type d -name 'cupswrapper' -exec rm -rf {} + + sed -i "s|${srcdir}||" "${_lpdwrapper}" # Remove unneeded script (i.e. /etc/printcap is managed by CUPS) rm $(find "${srcdir}" -type f -name 'setupPrintcap*') - # Remove binaries for different architectures - if [ "${CARCH}" = 'x86_64' ]; then - find "${srcdir}" -type d -name 'i686' -exec rm -rf {} + - elif [ "${CARCH}" = 'i686' ]; then - find "${srcdir}" -type d -name 'x86_64' -exec rm -rf {} + - fi + # Make symlink absolute + rm "${srcdir}/usr/lib/cups/filter/${_lpdwrapper_basename}" + ln -s "/opt/brother/PTouch/${_model}/cupswrapper/${_lpdwrapper_basename}" "${srcdir}/usr/lib/cups/filter/${_lpdwrapper_basename}" + + # Move arch-specific binaries into the correct locations + mv "${srcdir}/opt/brother/PTouch/${_model}/lpd/${CARCH}/brpapertoolcups" "${srcdir}/opt/brother/PTouch/${_model}/lpd" + mv "${srcdir}/opt/brother/PTouch/${_model}/lpd/${CARCH}/rastertobrpt1" "${srcdir}/opt/brother/PTouch/${_model}/lpd" + mv "${srcdir}/opt/brother/PTouch/${_model}/lpd/${CARCH}/brpapertoollpr_${_model}" "${srcdir}/usr/bin" + mv "${srcdir}/opt/brother/PTouch/${_model}/lpd/${CARCH}/brprintconfpt1_${_model}" "${srcdir}/usr/bin" + + # Remove unneeded binaries / directories (for other architectures, etc.) + rm -r "${srcdir}/opt/brother/PTouch/${_model}/lpd/"{i686,x86_64} } package() @@ -58,7 +77,17 @@ package() cp -R "${srcdir}/usr" "${pkgdir}" cp -R "${srcdir}/opt" "${pkgdir}" - # Handle license + # Set some file ownerships and permissions + # infdir, e.g. /opt/brother/PTouch/ql720nw/inf/ + _infdir=$(find "${pkgdir}/opt/brother/PTouch/" -type d -name 'inf') + chown root:lp ${_infdir} + chmod 775 ${_infdir} + # rcfile, e.g. /opt/brother/PTouch/ql720nw/inf/brql720nwrc + _rcfile=$(find "${pkgdir}/opt/brother/PTouch/" -type f -name '*rc') + chown daemon:lp ${_rcfile} + chmod 664 ${_rcfile} + + # Handle licenses install -d "${pkgdir}/usr/share/licenses/${pkgname}" find "${pkgdir}" -type f -name 'LICENSE*.txt' -exec mv -t "${pkgdir}/usr/share/licenses/${pkgname}" {} + } |