summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Severance2017-06-05 20:08:48 -0400
committerChris Severance2017-06-05 20:08:48 -0400
commit2705d6424b92678bc4c0228d7b393beae732ff91 (patch)
tree462783145b54ed5afd2f7ba9c966b370f7ee1bf5
parent5699028a906683dc14fe4d1d56e63097cc3d0c60 (diff)
downloadaur-2705d6424b92678bc4c0228d7b393beae732ff91.tar.gz
Update printer name to fix autodetect
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD140
-rw-r--r--lpr-license.txt11
3 files changed, 109 insertions, 64 deletions
diff --git a/.SRCINFO b/.SRCINFO
index db2ca86dc9a..90cfda90b36 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,14 @@
# Generated by mksrcinfo v8
-# Wed Jan 13 00:41:45 UTC 2016
+# Tue Jun 6 00:08:34 UTC 2017
pkgbase = brother-mfc7340
pkgdesc = LPR and CUPS driver for the Brother MFC-7340 printer
- pkgver = 2.0.2
- pkgrel = 2
- url = http://solutions.brother.com/linux/en_us/
+ pkgver = 2.0.2_1
+ pkgrel = 1
+ url = http://www.brother.com/
arch = i686
arch = x86_64
- license = custom:Brother Industries
+ license = GPL
+ license = custom
depends = cups
depends = ghostscript
depends = psutils
@@ -15,12 +16,15 @@ pkgbase = brother-mfc7340
depends = sed
depends = grep
optdepends = ttf-dejavu: printing text files from lpr
- source = http://download.brother.com/welcome/dlf006677/brother-laser2-cups-driver-2.0.2-1.tar.gz
- source = http://download.brother.com/welcome/dlf006230/cupswrapperMFC7340-2.0.2-1.i386.rpm
- source = http://download.brother.com/welcome/dlf006228/brmfc7340lpr-2.0.2-1.i386.rpm
- sha256sums = d303e86b9143bd6d2ac27294a33cb9676efd9e968b57912e496dac6e97e90641
+ optdepends = brscan3: Scanner support
+ source = http://www.brother.com/pub/bsc/linux/dlf/cupswrapperMFC7340-2.0.2-1.i386.rpm
+ source = http://www.brother.com/pub/bsc/linux/dlf/brmfc7340lpr-2.0.2-1.i386.rpm
+ source = http://www.brother.com/pub/bsc/linux/dlf/brother-laser2-cups-driver-2.0.2-1.tar.gz
+ source = lpr-license.txt
sha256sums = f32246c7e7366ef0e3cccf4984c08a3988102df11a06b449a9ae7a3ed2521623
sha256sums = 1510def42605919864f4118143c617e0bf9d5f0d71d354b241219f01467b638a
+ sha256sums = d303e86b9143bd6d2ac27294a33cb9676efd9e968b57912e496dac6e97e90641
+ sha256sums = 576f8d52351b450f417322885106490cdf7b97b45c7f6262f5eafaddf63adf29
depends_x86_64 = lib32-glibc
pkgname = brother-mfc7340
diff --git a/PKGBUILD b/PKGBUILD
index fdd6aa7fa55..a2463365d2e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,5 @@
# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
# Contributor: ctarwater gmail
-# Category: system
# There's a new generic lpr driver 3.1.0-1 available but it looks like some
# work to get it compatible with the cups driver.
@@ -25,15 +24,13 @@ pkgname="brother-${_brotherlnd}"
# I'd like to add a dash to the package name and the printer driver but that
# could invalidate a lot of cups settings and documents and make us different
# from other distros.
-pkgver='2.0.2'
-pkgrel='2'
-_cuppkgrel='1'
-_lprpkgver='2.0.2'
-_lprpkgrel='1'
+pkgver='2.0.2_1'
+pkgrel='1'
+_lprpkgver='2.0.2_1'
pkgdesc="LPR and CUPS driver for the Brother ${_brotheru} printer"
arch=('i686' 'x86_64')
-url='http://solutions.brother.com/linux/en_us/'
-license=('custom:Brother Industries')
+url='http://www.brother.com/'
+license=('GPL' 'custom')
depends=('cups' 'ghostscript' 'psutils' 'a2ps' 'sed' 'grep')
depends_x86_64=('lib32-glibc')
# We look at the scripts and find these programs from which we decide on the depends above.
@@ -45,20 +42,24 @@ depends_x86_64=('lib32-glibc')
# sed grep awk
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670055
# Printing a text file fails when Liberation is the only TrueType font available
-optdepends=('ttf-dejavu: printing text files from lpr')
-#install="${pkgname}.install"
-# The cups wrapper uses the lpr driver.
+optdepends=(
+ 'ttf-dejavu: printing text files from lpr'
+ 'brscan3: Scanner support'
+)
_brsource='brother-laser2-cups-driver-2.0.2-1'
+_dlf="http://www.brother.com/pub/bsc/linux/dlf"
source=(
- "http://download.brother.com/welcome/dlf006677/${_brsource}.tar.gz"
- "http://download.brother.com/welcome/dlf006230/cupswrapper${_brotherund}-${pkgver}-${_cuppkgrel}.i386.rpm"
- "http://download.brother.com/welcome/dlf006228/br${_brotherlnd}lpr-${_lprpkgver}-${_lprpkgrel}.i386.rpm"
+ "${_dlf}/cupswrapper${_brotherund}-${pkgver//_/-}.i386.rpm"
+ "${_dlf}/br${_brotherlnd}lpr-${_lprpkgver//_/-}.i386.rpm"
+ "${_dlf}/${_brsource}.tar.gz"
+ 'lpr-license.txt'
)
-sha256sums=('d303e86b9143bd6d2ac27294a33cb9676efd9e968b57912e496dac6e97e90641'
- 'f32246c7e7366ef0e3cccf4984c08a3988102df11a06b449a9ae7a3ed2521623'
- '1510def42605919864f4118143c617e0bf9d5f0d71d354b241219f01467b638a')
+sha256sums=('f32246c7e7366ef0e3cccf4984c08a3988102df11a06b449a9ae7a3ed2521623'
+ '1510def42605919864f4118143c617e0bf9d5f0d71d354b241219f01467b638a'
+ 'd303e86b9143bd6d2ac27294a33cb9676efd9e968b57912e496dac6e97e90641'
+ '576f8d52351b450f417322885106490cdf7b97b45c7f6262f5eafaddf63adf29')
-build() {
+prepare() {
set -u
# Do not Install in '/usr/local'. Does not apply to all Brother models.
# This may modify binary blobs which only
@@ -67,7 +68,7 @@ build() {
install -dm755 "${srcdir}/usr/share"
mv "${srcdir}/usr/local/Brother/" "${srcdir}/usr/share/brother"
rm -rf "${srcdir}/usr/local"
- sed -i -e 's:/usr/local/Brother:/usr/share/brother:g' $(grep -lr '/usr/local/Brother' ./)
+ sed -e 's:/usr/local/Brother:/usr/share/brother:g' -i $(grep -lr '/usr/local/Brother' ./)
fi
# setup cups-directories
@@ -82,6 +83,9 @@ build() {
test -f "${_rcfile}" || echo "${}"
local _bindir="$(find "`pwd`" -type d -name 'cupswrapper')"
test -d "${_bindir}" || echo "${}" # die if blank or invalid before we rm something we don't want to
+ pushd "${_bindir}" > /dev/null
+ local _brcupsconf=(brcupsconf*); _brcupsconf="${_brcupsconf[0]}"
+ test -x "${_brcupsconf}" || echo "${}"
rm -f "${_bindir}"/* # We download the cups driver only to throw it all away. All I want is the dir name without hunting for it in the installer.
local _basedir="${srcdir}/${_brsource}"
test -d "${_basedir}" || echo "${}"
@@ -106,23 +110,22 @@ build() {
cd "${_makedir}"
# allow cooexist with AUR package brother-lpr-drivers-laser
- sed -i -e 's:brprintconflsr2:brprint7340lsr2:g' 'brcups_commands.h' "${srcdir}/usr/bin/brprintconfiglpr2"
+ sed -e 's:brprintconflsr2:brprint7340lsr2:g' -i 'brcups_commands.h' "${srcdir}/usr/bin/brprintconfiglpr2"
mv "${srcdir}/usr/bin/brprintconflsr2" "${srcdir}/usr/bin/brprint7340lsr2"
mv "${srcdir}/usr/bin/brprintconfiglpr2" "${srcdir}/usr/bin/brprint7340iglpr2"
# Editing a binary file requires the search and replace string to be the same size
- sed -i -e 's:libbrcomplpr2.so:libbr7340lpr2.so:g' "${srcdir}/usr/share/brother/lpd/rawtobr2"
+ sed -e 's:libbrcomplpr2.so:libbr7340lpr2.so:g' -i "${srcdir}/usr/share/brother/lpd/rawtobr2"
mv "${srcdir}/usr/lib/libbrcomplpr2.so" "${srcdir}/usr/lib/libbr7340lpr2.so"
if [ -s 'Makefile' ]; then
- make -s
+ 'ma''ke' -s
cp -p 'brcupsconfpt1' "${_bindir}"
else
- # Not sure why it's called brcupsconfig3 some places and brcupsconfig4 in others.
- # The version in their binary matches the version in the source so it looks good to me.
# gcc options are pulled from other Brother makefiles.
- gcc -pipe -Wall -W -O2 -s -o "${_bindir}/brcupsconfig3" 'brcupsconfig.c'
+ gcc -pipe -Wall -W -O2 -s -o "${_bindir}/${_brcupsconf}" "brcupsconfig.c"
fi
+ # Some models supply the ppd in the install script
cd "${_bindir}"
if [ ! -z "${_ppddir:-}" ]; then
# Use the ppd supplied in the source
@@ -133,44 +136,78 @@ build() {
# Some Brother installers create files here
mkdir -p "${srcdir}/var/tmp"
- # Fix any sbin reference in the lpr driver. The cups driver uses bin.
- sed -i -e 's:/sbin/:/bin/:g' $(find "${srcdir}/usr" -type f -name 'psconvert2')
+ # Fix lpr driver.
+ sed -e '# Fix sbin reference' \
+ -e 's:/sbin/:/bin/:g' \
+ -e '#Fix hash bang' \
+ -e 's:#/bin/sh:#!/bin/sh:g' \
+ -i $(find "${srcdir}/usr" -type f -name 'psconvert2')
# Fix page shifted off center that affects some printers
# Letter prints off center shifted down and right with PaperType=A4
# I can only test printing A4 on Letter paper. A4 appears to print correctly with PaperType=Letter
- sed -i -e 's:^\(PaperType\)=.\+$:\1=Letter:g' "${_rcfile}"
+ sed -e 's:^\(PaperType\)=.\+$:\1=Letter:g' -i "${_rcfile}"
# Modify the installer so we can finish the install here in PKGBUILD.
cp -p "${_wrapdir}/${_wrapper_source}" "${_bindir}/"
#cp -p "${_wrapper_source}" "${_wrapper_source}.Arch" # debug: diff compare with Total Commander
- sed -i -e '# Install to _srcdir. Some folders may not apply to this model.' \
- -e 's:/usr:${_srcdir}&:g' \
- -e 's:/opt:${_srcdir}&:g' \
- -e 's:/var:${_srcdir}&:g' \
- -e "# Stop the Install script after the files are generated. cups doesn't require a reload to see the printer driver." \
- -e 's:^if \[ -e /etc/init:exit 0 #Arch Linux Compatible\n&:g' \
- "${_wrapper_source}"
- grep -lq "#Arch Linux Compatible" "${_wrapper_source}" || echo "${}"
+ sed -e '# Install to _srcdir. Some folders may not apply to this model.' \
+ -e 's:/usr:"${_srcdir}"&:g' \
+ -e 's:/opt:"${_srcdir}"&:g' \
+ -e 's:/var:"${_srcdir}"&:g' \
+ -e 's:/etc:"${_srcdir}"&:g' \
+ -e 's:""${_srcdir}":"${_srcdir}:g' \
+ -e "# Stop the Install script after the files are generated. cups doesn't require a reload to see the printer driver." \
+ -e 's:^sleep.*$:exit 0 # & #Arch Linux Compatible:g' \
+ -e '# not using set -u allows bugs like this to slip by' \
+ -e '#/Nup=/ s:`:\\`:g' \
+ -e 's: $errorcode: \\$errorcode:g' \
+ -e '# This printer requires the permissions fix that isnt multi user compatible.' \
+ -e 's:/usr/local/Brother:/usr/share/brother:g' \
+ -i "${_wrapper_source}"
+ grep -lq "#Arch Linux Compatible$" "${_wrapper_source}" || echo "${}"
test -f "${_wrapper_source}.Arch" && echo "${}" # Halt for debugging
# Generate PPD and wrapper. Use sh -x to debug
# Possible bug: copying to /usr/share/ppd is disabled.
- export _srcdir="${srcdir}"
- sh -e "${_wrapper_source}" -i
- unset _srcdir
-
+ _srcdir="${srcdir}" \
+ sh -u -e "${_wrapper_source}" -i
+ chmod 644 "${srcdir}/usr/share/cups/model"/*.ppd # Some installers make ppd executable
rm -rf "${srcdir}/var"
# Remove srcdir from the generated wrapper file.
# No paths in the generated ppd.
- sed -i -e '# Remove the ${_srcdir} variety' \
- -e 's:${_srcdir}::' \
- -e '# Remove the /home/... variety' \
- -e "s:${srcdir}::" "${srcdir}/usr/lib/cups/filter"/*lpdwrapper*
+ sed -e '# Remove the ${_srcdir} variety' \
+ -e 's:${_srcdir}::' \
+ -e '# Remove the /home/... variety' \
+ -e "s:${srcdir}::" \
+ -e '# Remove surplus quotes' \
+ -e 's:""/:/:g' \
+ -i "${srcdir}/usr/lib/cups/filter"/*lpdwrapper*
# We did everything in the installer so we can get rid of it.
- rm -f "${_wrapper_source}"
- set +u
+ rm "${_wrapper_source}"
+
+ cd "${srcdir}"
+ # Misnamed printer does not sort or autodetect properly
+ sed -e "s:Brother ${_brotherund} :Brother ${_brotheru} :g" -i 'usr/share/cups/model'/*.ppd
+
+ # Check to see if the lpd wrapper is referenced by the ppd
+ # Check to see if our compiled code is referenced by the lpd wrapper
+ local _nppdfound=0
+ local _ncodefound=0
+ local _lwrapper
+ for _lwrapper in 'usr/lib/cups/filter'/*; do
+ if grep -q "$(basename "${_lwrapper}")" 'usr/share/cups/model'/*.ppd; then
+ _nppdfound=$((_nppdfound+1))
+ fi
+ if grep -q "${_brcupsconf}" "${_lwrapper}"; then
+ _ncodefound=$((_ncodefound+1))
+ fi
+ done
+ test "${_nppdfound}" -ne 0 || echo "${}"
+ test "${_ncodefound}" -ne 0 || echo "${}"
+
+ set +u
}
package() {
@@ -194,15 +231,8 @@ package() {
! grep -alqr "/sbin" "${pkgdir}" || echo "${}"
! grep -alqr "/usr/tmp" "${pkgdir}" || echo "${}"
- #install -Dm644 'cupswrapper-license.txt' "${pkgdir}/usr/share/licenses/${pkgname}/cupswrapper-licence.txt"
- #install -Dm644 'lpr-license.txt' "${pkgdir}/usr/share/licenses/${pkgname}/lpr-licence.txt"
-
- # Change mode to avoid warning on reinstall
- # This is no longer necessary. Running the installer here in PKGBUILD sets
- # the proper permissions for the package.
- #install -d -m777 "${pkgdir}/usr/local/Brother/inf/"
- # It looks like this is so everyone can write to brMFC7360Nrc (brPRINTERrc)
- # I suspect this isn't safe for multiple users.
+ install -Dpm644 <(sed -e 's:\r::g' "${_brsource}/Copying") "${pkgdir}/usr/share/licenses/${pkgname}/cupswrapper-licence.txt"
+ install -Dpm644 'lpr-license.txt' "${pkgdir}/usr/share/licenses/${pkgname}/lpr-licence.txt"
set +u
}
set +u
diff --git a/lpr-license.txt b/lpr-license.txt
new file mode 100644
index 00000000000..2955b4c0040
--- /dev/null
+++ b/lpr-license.txt
@@ -0,0 +1,11 @@
+License Agreement
+
+This Agreement provides terms and conditions for license grant from Brother Industries, Ltd ("Brother"). Brother, who owns all copyrights to the software that is distributed with this Agreement ("Software") to recipients thereof ("User"), for use of the Software. User shall have the right to use the Software only in accordance with the terms and conditions of this Agreement. Any use by User of the Software shall be deemed as its agreement hereto.
+Note:
+Please click on "I Accept" while holding down "Shift" or right click on "I Accept" and select "Save Target As,,," from the menu.
+
+Brother retains any and all copyrights to the Software. In no case this Agreement shall be construed to assign or otherwise transfer from Brother to User any copyrights or other intellectual property rights to whole or any part of the Software.
+
+Brother grants User a non-exclusive license: to reproduce and/or distribute (via Internet or in any other manner) the Software. Further, Brother grants User a non-exclusive license to modify, alter, translate or otherwise prepare derivative works of the Software and to reproduce and distribute (via Internet or in any other manner) such modification, alteration, translation or other derivative works for any purpose.
+
+The license of the Software from Brother hereunder is granted "AS IS." BROTHER HEREBY DISCLAIMS ANY WARRANTIES WITH RESPECT TO THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTY FOR THE QUALITY, MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE OR NON-INFRINGEMENT. Brother shall have no liability in contract, tort (including negligence or breach of statutory duty) or otherwise for any interruption of use, loss of data, or for any indirect, incidental, punitive or consequential loss or damage, or for any loss of profit, revenue, data, goodwill or anticipated savings that arises under, out of, or in contemplation of this Agreement or otherwise arises due to any error, inaccuracy or defect in the Software even if Brother has been advised of the possibility of such loss or damage. Further, Brother shall have no liability to disclose and/or distribute the source code of the Software to User under any circumstances. In no case shall the above license by Brother to modify, alter, translate or otherwise prepare derivative works of the Software be construed as Brother's implied agreement or undertakings to disclose and/or distribute the source code of the Software.