diff options
author | Karol Babioch | 2019-07-21 23:53:25 +0200 |
---|---|---|
committer | Karol Babioch | 2019-07-21 23:53:25 +0200 |
commit | e1a30b85487db095a791da8248130c26c554f448 (patch) | |
tree | 6ca7fa4ac4b5635a34a66ffb743c2e9173961f64 /PKGBUILD | |
parent | 174af5853dc0cd7b8583bf6a4991f311395fe8c2 (diff) | |
download | aur-e1a30b85487db095a791da8248130c26c554f448.tar.gz |
Bump version to 3.1.5r0
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 136 |
1 files changed, 78 insertions, 58 deletions
@@ -1,73 +1,93 @@ # Maintainer: Karol Babioch <karol@babioch.de> -# Inspired by package brother-dcp130c -pkgname='brother-ql820nwb' -pkgver=1.1.4r0 -pkgrel=2 +pkgname=brother-ql820nwb +pkgver=3.1.5r0 +pkgrel=1 pkgdesc='LPR and CUPS driver for Brother QL-820NWB label printer' url='http://solutions.brother.com/linux/en_us/' arch=('i686' 'x86_64') license=('custom') depends=('cups') -if [ "$CARCH" = 'x86_64' ]; then - depends+=('lib32-glibc') -fi -install="$pkgname.install" -source=("http://download.brother.com/welcome/dlfp100344/ql820nwblpr-${pkgver/r/-}.i386.rpm" - "http://download.brother.com/welcome/dlfp100346/ql820nwbcupswrapper-${pkgver/r/-}.i386.rpm" - 'LICENSE') -sha256sums=('512edabbac5563805b387cabfe1dbed506947d87c6d40375c0afaca9473a5880' - 'd2134f1aaa0bd923a2142c153d136b4dd053b07613c39865a008b5667e3060c6' - 'cdd1955a9996bc246ba54e84f0a5ccbfdf6623962b668188762389aa79ef9811') +install="${pkgname}.install" +source=("https://download.brother.com/welcome/dlfp100344/ql820nwbpdrv-${pkgver/r/-}.i386.rpm") +sha256sums=('f19291f1d54fa1c7b932d06362067948bc6b0852315e64915a09450a81d1fbbc') 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 - - # setup cups directories - install -d "$srcdir/usr/share/cups/model" - install -d "$srcdir/usr/lib/cups/filter" - - # 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 - - # /etc/printcap is managed by cups - rm `find $srcdir -type f -name 'setupPrintcap*'` - - # /usr/lib/cups/filter/brother_lpdwrapper_ql820nwb should be an absolute symlink - rm $srcdir/usr/lib/cups/filter/brother_lpdwrapper_ql820nwb - ln -s /opt/brother/PTouch/ql820nwb/cupswrapper/brother_lpdwrapper_ql820nwb \ - $srcdir/usr/lib/cups/filter/brother_lpdwrapper_ql820nwb -} + # 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 + _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} + 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}" -package() { - cd "$srcdir" + # Invoke cupswrapper script + export srcdir=${srcdir} + ${_cupswrapper} - cp -R usr $pkgdir - if [ -d opt ]; then cp -R opt $pkgdir; fi + # Patch resulting filter + sed -i "s|${srcdir}||" "${_lpdwrapper}" - install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + # Remove unneeded script (i.e. /etc/printcap is managed by CUPS) + rm $(find "${srcdir}" -type f -name 'setupPrintcap*') + + # 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() +{ + # 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}" {} + +} |