summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Severance2017-06-06 12:36:54 -0400
committerChris Severance2017-06-06 12:36:54 -0400
commitfa42a8e9679af97735badda40999f30ec6984857 (patch)
tree51d4d91b80892aa22c626bb144ef8f79cae1112f
downloadaur-fa42a8e9679af97735badda40999f30ec6984857.tar.gz
Initial Import
-rw-r--r--.SRCINFO31
-rw-r--r--PKGBUILD231
-rw-r--r--lpr-license.txt11
3 files changed, 273 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..47665c687c95
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,31 @@
+# Generated by mksrcinfo v8
+# Tue Jun 6 16:36:32 UTC 2017
+pkgbase = brother-mfc-290c
+ pkgdesc = LPR and CUPS driver for the Brother MFC-290C printer
+ pkgver = 1.1.2_2
+ pkgrel = 1
+ url = http://www.brother.com/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ license = custom
+ depends = cups
+ depends = ghostscript
+ depends = psutils
+ depends = a2ps
+ depends = sed
+ depends = grep
+ optdepends = ttf-dejavu: printing text files from lpr
+ optdepends = brscan3: Scanner support
+ source = http://www.brother.com/pub/bsc/linux/dlf/mfc290clpr-1.1.2-2.i386.rpm
+ source = http://www.brother.com/pub/bsc/linux/dlf/mfc290ccupswrapper-1.1.2-2.i386.rpm
+ source = http://www.brother.com/pub/bsc/linux/dlf/brcups_ink4_src_1.1.2-x.tar.gz
+ source = lpr-license.txt
+ sha256sums = 56b6aabe73b53e9e51ec8e19202637af0e8cafebe2c2a814de3584f2697ffdbe
+ sha256sums = 3e39488a517b69bfcd2a2964f1f7fae4dc4d0aa4a3e27a2850d4d577e105e281
+ sha256sums = ee009db6e216b23901704fc5a2bd7de7d48337f27c84adbc3e413d9bbe782ff3
+ sha256sums = 9d85a8aafdaac8fac80e04234ad2acf5642bbf0b91ee582d2a89519a55f6dd67
+ depends_x86_64 = lib32-glibc
+
+pkgname = brother-mfc-290c
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..e4ca0121de5f
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,231 @@
+# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
+# Contributor: libernux <dutchman55@gmx.com>
+
+# TODO: Test autodetect
+
+# The cups binary is 64 bit. Until Brother releases source for the 32 bit lpr
+# binary blobs, 64 bit users must enable multilib.
+
+# This has not been tested with non cups lprng.
+
+# NOTE 1: Remember to add user to lp group using
+# gpasswd -a USER lp
+# NOTE 2: Remember to logout after adding groups
+# NOTE 3: Set each printer default Media Size to Letter with
+# lpadmin -p BR7360 -o media=Letter
+
+set -u
+_brotheru='MFC-290C'
+_brotherl="${_brotheru,,}" # mfc-0000dw
+_brotherlnd="${_brotherl//-/}" # mfc0000dw
+_brotherund="${_brotheru//-/}" # MFC0000DW
+pkgname="brother-${_brotherl}"
+pkgver='1.1.2_2'
+pkgrel='1'
+pkgdesc="LPR and CUPS driver for the Brother ${_brotheru} printer"
+arch=('i686' 'x86_64')
+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.
+# gs: lpr rendering
+# pdf2ps: cups rendering
+# a2ps: rendering ascii text files
+# pstops: pdf resizing
+# psnup: printing n-up pages
+# 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'
+ 'brscan3: Scanner support'
+)
+_brsource="brcups_ink4_src_${pkgver%_*}-x"
+_dlf="http://www.brother.com/pub/bsc/linux/dlf"
+source=(
+ "${_dlf}/mfc290clpr-${pkgver//_/-}.i386.rpm"
+ "${_dlf}/mfc290ccupswrapper-${pkgver//_/-}.i386.rpm"
+ "${_dlf}/${_brsource}.tar.gz"
+ 'lpr-license.txt'
+)
+sha256sums=('56b6aabe73b53e9e51ec8e19202637af0e8cafebe2c2a814de3584f2697ffdbe'
+ '3e39488a517b69bfcd2a2964f1f7fae4dc4d0aa4a3e27a2850d4d577e105e281'
+ 'ee009db6e216b23901704fc5a2bd7de7d48337f27c84adbc3e413d9bbe782ff3'
+ '9d85a8aafdaac8fac80e04234ad2acf5642bbf0b91ee582d2a89519a55f6dd67')
+
+prepare() {
+ set -u
+ # Do not Install in '/usr/local'. Does not apply to all Brother models.
+ # This may modify binary blobs which only
+ # works when the old and new strings are exactly the same length.
+ if [ -d "${srcdir}/usr/local/Brother" ]; then
+ install -dm755 "${srcdir}/usr/share"
+ mv "${srcdir}/usr/local/Brother/" "${srcdir}/usr/share/brother"
+ rm -rf "${srcdir}/usr/local"
+ sed -e 's:/usr/local/Brother:/usr/share/brother:g' -i $(grep -lr '/usr/local/Brother' ./)
+ fi
+
+ # setup cups-directories
+ install -dm755 "${srcdir}/usr/lib/cups/filter"
+ install -dm755 "${srcdir}/usr/share/cups/model"
+ #install -dm755 "${srcdir}/usr/share/ppd" # For cups we don't need the ppd file here.
+
+ # Get the dirs and the name of the wrapper. Either in /opt or /usr.
+ # This is set up to adapt or crash. Unlike false, ${} shows the line number.
+ cd "${srcdir}/opt" 2>/dev/null || cd "${srcdir}/usr"
+ local _rcfile="$(find "`pwd`" -type f -ipath "*inf/br${_brotherund}rc")"
+ 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 "${}"
+ cd "${_basedir}/cupswrapper" 2>/dev/null || cd "${_basedir}/scripts" 2>/dev/null || cd "${_basedir}"
+ local _wrapdir="$(pwd)"
+ cd "${_wrapdir}"
+ local _wrapper_source="$(echo cupswrapper${_brotherund}*)"
+ if ! test -f "${_wrapper_source}"; then
+ _wrapper_source="$(echo cupswrapper*290*)"
+ test -f "${_wrapper_source}" || echo "${}"
+ bsdtar -xf "${_wrapper_source}"
+ cd cupswrapper*/
+ _basedir="${PWD}"
+ cd 'SCRIPT'
+ _wrapdir="${PWD}"
+ _wrapper_source=(cupswrapper*); _wrapper_source="${_wrapper_source[0]}"
+ cd ../..
+ fi
+ cd "${_basedir}"/brcups*
+ local _makedir="$(pwd)"
+ if cd "${_basedir}/PPD" 2>/dev/null || cd "${_basedir}/ppd" 2>/dev/null; then
+ local _ppddir="$(pwd)"
+ fi
+
+ # Source is available for the cups binary, not the lpr binaries so we can't
+ # get away from multilib. Any usage of /opt is hardcoded into some binaries
+ # for which we can't find an equal length replacement so we can't easily get
+ # rid of that either.
+ cd "${_makedir}"
+ if [ -s 'Makefile' ]; then
+ 'ma''ke' -s
+ cp -p 'brcupsconfpt1' "${_bindir}"
+ else
+ # gcc options are pulled from other Brother makefiles.
+ 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
+ cp -p "${_ppddir}"/*.ppd "${_bindir}/"
+ chmod 644 "${_bindir}"/*.ppd
+ fi
+
+ # Some Brother installers create files here
+ #mkdir -p "${srcdir}/var/tmp"
+
+ # Fix lpr driver.
+ true 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 -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 -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.
+ _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 -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 "${_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() {
+ set -u
+ local _dir
+ # /var/spool is not used anywhere in this package. Maybe it's needed for non cups lprng.
+ for _dir in 'usr' 'opt'; do # 'var'
+ if [ -d "${srcdir}/${_dir}" ]; then
+ cp -pR "${srcdir}/${_dir}" "${pkgdir}"
+ fi
+ done
+
+ # /etc/printcap is managed by cups. This eliminates any need for a printcap helper.
+ rm -f "`find "${pkgdir}" -type f -name 'setupPrintcap*'`"
+
+ # Ensure we got a ppd and a filter for CUPS
+ test "$(find "${pkgdir}/usr/share/cups/model" -type f -name '*.ppd')"
+ test "$(find "${pkgdir}/usr/lib/cups/filter/" -type f)"
+
+ # Ensure there are no forbidden paths
+ ! grep -alqr "/sbin" "${pkgdir}" || echo "${}"
+ ! grep -alqr "/usr/tmp" "${pkgdir}" || echo "${}"
+
+ 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 000000000000..0d32eb1475ce
--- /dev/null
+++ b/lpr-license.txt
@@ -0,0 +1,11 @@
+This Agreement provides terms and conditions for license grant from Brother Industries, Ltd ("Broher"). 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 cord 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 cord of the Software. \ No newline at end of file