summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorKarol Babioch2021-04-13 10:16:15 +0200
committerKarol Babioch2021-04-13 10:16:17 +0200
commit768dac28b3df6db5184d5b57e56aeab318e04414 (patch)
tree4955b005a156b4ac0d94fa0f657b937a75afd3b2 /PKGBUILD
parent0aa5bb7c5cd9444f32ceb26329abf2c3e5103351 (diff)
downloadaur-768dac28b3df6db5184d5b57e56aeab318e04414.tar.gz
Update PKGBUILD based on input from lkamp
lkamp updated the package and got it working again. This is based on this comment from [1]. [1]: https://aur.archlinux.org/packages/brother-ql1100/#comment-801368
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD98
1 files changed, 61 insertions, 37 deletions
diff --git a/PKGBUILD b/PKGBUILD
index f5e5ef3e5343..f5b483955fcb 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,5 +1,5 @@
# Maintainer: Karol Babioch <karol@babioch.de>
-# Inspired by package brother-dcp130c
+# Conributer: Laurenz Kamp <laurenz.kamp@gmx.de>
pkgname='brother-ql1100'
pkgver=2.1.4r0
@@ -20,47 +20,71 @@ sha256sums=('4523ee178173b11f9a66bd31a1ef03ecf2d933a0900f3dfc2fc1ffab07fffd26'
prepare()
{
- # do not install in '/usr/local'
- if [ -d $srcdir/usr/local/Brother ]; then
- install -d $srcdir/usr/share
- mv $srcdir/usr/local/Brother/ $srcdir/usr/share/brother
- rm -rf $srcdir/usr/local
- sed -i 's|/usr/local/Brother|/usr/share/brother|g' `grep -lr '/usr/local/Brother' ./`
- fi
+ # Create necessary CUPS directories
+ install -d "${srcdir}/usr/share/cups/model"
+ install -d "${srcdir}/usr/lib/cups/filter"
+ install -d "${srcdir}/usr/bin"
- # setup cups directories
- install -d "$srcdir/usr/share/cups/model"
- install -d "$srcdir/usr/lib/cups/filter"
+ # Locate cupswrapper script
+ _cupswrapper=$(find "${srcdir}/opt/brother/PTouch/" -type f -name 'cupswrapper*')
+ echo "cupswrapper: ${_cupswrapper}"
- # go to the cupswrapper directory and find the source file from wich to generate a ppd- and wrapper-file
- cd `find . -type d -name 'cupswrapper'`
- if [ -f cupswrapper* ]; then
- _wrapper_source=`ls cupswrapper*`
- sed -i '/^\/etc\/init.d\/cups/d' $_wrapper_source
- sed -i '/^sleep/d' $_wrapper_source
- sed -i '/^echo lpadmin/d' $_wrapper_source
- sed -i '/^lpadmin/d' $_wrapper_source
- sed -i 's|/usr|$srcdir/usr|g' $_wrapper_source
- sed -i 's|/opt|$srcdir/opt|g' $_wrapper_source
- sed -i 's|/model/Brother|/model|g' $_wrapper_source
- sed -i 's|lpinfo|echo|g' $_wrapper_source
- export srcdir=$srcdir
- ./$_wrapper_source
- sed -i 's|$srcdir||' $srcdir/usr/lib/cups/filter/*lpdwrapper*
- sed -i "s|$srcdir||" $srcdir/usr/lib/cups/filter/*lpdwrapper*
- rm $_wrapper_source
- fi
+ # Locate lpdwrapper script / symlink
+ _lpdwrapper=$(find "${srcdir}/opt/brother/PTouch/" -name "brother_lpdwrapper_*")
+ echo "lpdwrapper: ${_lpdwrapper}"
- # /etc/printcap is managed by cups
- rm `find $srcdir -type f -name 'setupPrintcap*'`
-}
+ # 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}
+ sed -i '/^echo lpadmin/d' ${_cupswrapper}
+ sed -i '/^lpadmin/d' ${_cupswrapper}
+ sed -i "s|/usr|${srcdir}/usr|g" ${_cupswrapper}
+ sed -i "s|/opt|${srcdir}/opt|g" ${_cupswrapper}
+ 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}
-package() {
- cd "$srcdir"
+ # Patch resulting filter
+ sed -i "s|${srcdir}||" "${_lpdwrapper}"
- cp -R usr $pkgdir
- if [ -d opt ]; then cp -R opt $pkgdir; fi
+ # Remove unneeded script (i.e. /etc/printcap is managed by CUPS)
+ rm $(find "${srcdir}" -type f -name 'setupPrintcap*')
- install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ # 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}"
}
+package()
+{
+ # Install actual content
+ cp -R "${srcdir}/usr" "${pkgdir}"
+ cp -R "${srcdir}/opt" "${pkgdir}"
+
+ # 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}" {} +
+}