Advertisement
Guest User

PKGBUILD brother-ql710w (3.1.5)

a guest
Jun 4th, 2019
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.41 KB | None | 0 0
  1. # Maintainer: Karol Babioch <karol@babioch.de>
  2.  
  3. pkgname=brother-ql710w
  4. pkgver=3.1.5r0
  5. pkgrel=1
  6. pkgdesc='LPR and CUPS driver for Brother QL-710W label printer'
  7. url='https://support.brother.com'
  8. arch=('i686' 'x86_64')
  9. license=('custom')
  10. depends=('cups')
  11. install="${pkgname}.install"
  12. source=("https://download.brother.com/welcome/dlfp002197/ql710wpdrv-${pkgver/r/-}.i386.rpm")
  13. sha256sums=('00b881cea1668553fe40887375d72188f42e03893b73619e231893564b609721')
  14.  
  15. prepare()
  16. {
  17.   # Create necessary CUPS directories
  18.   install -d "${srcdir}/usr/share/cups/model"
  19.   install -d "${srcdir}/usr/lib/cups/filter"
  20.   install -d "${srcdir}/usr/bin"
  21.  
  22.   # Locate cupswrapper script
  23.   cd $(find -type d -name 'cupswrapper')
  24.   _cupswrapper=$(ls cupswrapper*)
  25.   echo '_cupswrapper = ' ${_cupswrapper}
  26.  
  27.   # Patch cupswrapper script
  28.   sed -i '/^sleep/d' ${_cupswrapper}
  29.   sed -i '/^echo lpadmin/d' ${_cupswrapper}
  30.   sed -i '/^lpadmin/d' ${_cupswrapper}
  31.   sed -i "s|/usr|${srcdir}/usr|g" ${_cupswrapper}
  32.   sed -i "s|/opt|${srcdir}/opt|g" ${_cupswrapper}
  33.   sed -i "s|/model/Brother|/model|g" ${_cupswrapper}
  34.   sed -i 's|lpinfo|echo|g' ${_cupswrapper}
  35.  
  36.   # Invoke cupswrapper script
  37.   export srcdir=${srcdir}
  38.   ./${_cupswrapper}
  39.  
  40.   # Patch resulting filter
  41.   sed -i "s|${srcdir}||" ${srcdir}/usr/lib/cups/filter/*lpdwrapper*
  42.  
  43.   # Remove cupswrapper script and templates
  44.   #find "${srcdir}" -type d -name 'cupswrapper' -exec rm -rf {} +
  45.  
  46.   # Remove unneeded script (i.e. /etc/printcap is managed by CUPS)
  47.   rm $(find "${srcdir}" -type f -name 'setupPrintcap*')
  48.  
  49.   # /usr/lib/cups/filter/brother_lpdwrapper_ql710w should be an absolute symlink
  50.   rm $srcdir/usr/lib/cups/filter/brother_lpdwrapper_ql710w
  51.   ln -s /opt/brother/PTouch/ql710w/cupswrapper/brother_lpdwrapper_ql710w  $srcdir/usr/lib/cups/filter/brother_lpdwrapper_ql710w
  52.  
  53.   # Remove binaries for different architectures
  54.   if [ "${CARCH}" = 'x86_64' ]; then
  55.     find "${srcdir}" -type d -name 'i686' -exec rm -rf {} +
  56.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/x86_64/brpapertoolcups ${srcdir}/opt/brother/PTouch/ql710w/lpd/brpapertoolcups
  57.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/x86_64/brpapertoollpr_ql710w ${srcdir}/usr/bin/brpapertoollpr_ql710w
  58.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/x86_64/brprintconfpt1_ql710w ${srcdir}/usr/bin/brprintconfpt1_ql710w
  59.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/x86_64/rastertobrpt1 ${srcdir}/opt/brother/PTouch/ql710w/lpd/rastertobrpt1
  60.     rmdir ${srcdir}/opt/brother/PTouch/ql710w/lpd/x86_64/
  61.   elif [ "${CARCH}" = 'i686' ]; then
  62.     find "${srcdir}" -type d -name 'x86_64' -exec rm -rf {} +
  63.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/i686/brpapertoolcups ${srcdir}/opt/brother/PTouch/ql710w/lpd/brpapertoolcups
  64.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/i686/brpapertoollpr_ql710w ${srcdir}/usr/bin/brpapertoollpr_ql710w
  65.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/i686/brprintconfpt1_ql710w ${srcdir}/usr/bin/brprintconfpt1_ql710w
  66.     mv ${srcdir}/opt/brother/PTouch/ql710w/lpd/i686/rastertobrpt1 ${srcdir}/opt/brother/PTouch/ql710w/lpd/rastertobrpt1
  67.     rmdir ${srcdir}/opt/brother/PTouch/ql710w/lpd/i686/
  68.   fi
  69. }
  70.  
  71. package()
  72. {
  73.   # Install actual content
  74.   cp -R "${srcdir}/usr" "${pkgdir}"
  75.   cp -R "${srcdir}/opt" "${pkgdir}"
  76.  
  77.   # Handle license
  78.   install -d "${pkgdir}/usr/share/licenses/${pkgname}"
  79.   find "${pkgdir}" -type f -name 'LICENSE*.txt' -exec mv -t "${pkgdir}/usr/share/licenses/${pkgname}" {} +
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement