You are not logged in.

#1 2016-07-12 21:44:43

farc
Member
Registered: 2014-03-05
Posts: 17

Adapting Package for Brother MFC-J5920DW

Hey,
I bought the brother MFC-j5920DW and in order to install the drivers, I'm trying to adapt this package:
https://aur.archlinux.org/packages/brother-mfc-j6920dw/

This is my current PKGBUILD:

# Maintainer: Jnogueira <jnogueira at yandex dot com>
# Based on the brother-mfc-j6920dw PKGBUILD
# Contributor farc
pkgver=1
pkgrel=1
_Btype=mfc
_Bmodel=j5920dw
DriverVersion=3.0.1
DriverRelease=1
PrinterName=${_Btype}${_Bmodel}
pkgname=brother-${_Btype}-${_Bmodel}
pkgdesc="Driver for the Brother ${_Btype^^}-${_Bmodel^^} printer"
url="http://solutions.brother.com/linux/en_us/index.html"
license=('custom:brother')
depends=('a2ps' 'cups')
makedepends=('rpmextract')
arch=('i686' 'x86_64')

md5sums=(
	'd5e57a9bfdc9255089fa4b487b5f5b8f'
	'05d03b1586dd25a45e2d0f3a375d9858'
)

source=(
	"http://download.brother.com/welcome/dlf102069/${PrinterName}lpr-${DriverVersion}-${DriverRelease}.i386.rpm"
	"http://download.brother.com/welcome/dlf102070/${PrinterName}cupswrapper-${DriverVersion}-${DriverRelease}.i386.rpm"
)

cat <<EOF > "${startdir}/${pkgname}.install"
post_install() {
	/opt/brother/Printers/${PrinterName}/inf/setupPrintcapij ${PrinterName} -i
	/opt/brother/Printers/${PrinterName}/cupswrapper/cupswrapper${PrinterName}
}

post_upgrade() {
	/bin/true
}

pre_remove() {
	/opt/brother/Printers/${PrinterName}/inf/setupPrintcapij ${PrinterName} -e
	/opt/brother/Printers/${PrinterName}/cupswrapper/cupswrapper${PrinterName} -e
}
EOF

install="${pkgname}.install"

build() {
	sed -i -r -e 's@(/etc/init\.d/lprng stop\s*)$@\1\nfi\nif [ -e /usr/lib/systemd/system/org.cups.cups-lpd.socket ]; then\n\tsystemctl stop org.cups.cups-lpd.socket@gi' \
		-e 's@(/etc/init\.d/cupsys restart\s*)$@\1\nelif [ -e /usr/lib/systemd/system/org.cups.cupsd.service ]; then\n\tsystemctl restart org.cups.cupsd@gi' \
		$srcdir/opt/brother/Printers/${PrinterName}/cupswrapper/cupswrapper${PrinterName}

	if [[ ! $LANG =~ [a-z]{2}_(US|CA) ]]; then
		sed -i -r -e 's@(PaperType\s*=\s*\{?)Letter(\}?\s*)$@\1A4\2@gi' $srcdir/opt/brother/Printers/${PrinterName}/inf/br${PrinterName}{func,rc}
		sed -i -r -e 's@(\*Default[a-z]+:\s+)Letter\s*$@\1A4@gi' $srcdir/opt/brother/Printers/${PrinterName}/cupswrapper/brother_${PrinterName}_printer_en.ppd
	fi

	sed -i -e 's@chown lp $SPOOLER_NAME@chown root $SPOOLER_NAME@g' $srcdir/opt/brother/Printers/${PrinterName}/inf/setupPrintcapij
}

package() {
	install -d "$pkgdir"/usr/bin
	install -d "$pkgdir"/var/spool/lpd
	install -m 644 -D ppd "$pkgdir/usr/share/cups/model/brother_${PrinterName}_printer_en.ppd"
	install -m 755 -D filter "$pkgdir/usr/lib/cups/filter/brmfcj5920dwfilter"
	cp -R "$srcdir"/opt "$pkgdir"/opt
}

Error message

==> Making package: brother-mfc-j5920dw 1-1 (Di 12. Jul 23:33:55 CEST 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found mfcj5920dwlpr-3.0.1-1.i386.rpm
  -> Found mfcj5920dwcupswrapper-3.0.1-1.i386.rpm
==> Validating source files with md5sums...
    mfcj5920dwlpr-3.0.1-1.i386.rpm ... Passed
    mfcj5920dwcupswrapper-3.0.1-1.i386.rpm ... Passed
==> Extracting sources...
  -> Extracting mfcj5920dwlpr-3.0.1-1.i386.rpm with bsdtar
  -> Extracting mfcj5920dwcupswrapper-3.0.1-1.i386.rpm with bsdtar
==> Removing existing $pkgdir/ directory...
==> Starting build()...
==> Entering fakeroot environment...
==> Starting package()...
install: cannot stat 'ppd': No such file or directory
==> ERROR: A failure occurred in package().
    Aborting...

My files / directory

$ tree
.
├── brother-mfc-j5920dw-3.0.1-1-x86_64.pkg.tar.xz
├── brother-mfc-j5920dw.install
├── mfcj5920dwcupswrapper-3.0.1-1.i386.rpm
├── mfcj5920dwlpr-3.0.1-1.i386.rpm
├── pkg
│   └── brother-mfc-j5920dw
│       ├── usr
│       │   ├── bin
│       │   └── share
│       │       └── cups
│       │           └── model
│       └── var
│           └── spool
│               └── lpd
├── PKGBUILD
└── src
    ├── mfcj5920dwcupswrapper-3.0.1-1.i386.rpm
    ├── mfcj5920dwlpr-3.0.1-1.i386.rpm
    ├── opt
    │   └── brother
    │       └── Printers
    │           └── mfcj5920dw
    │               ├── cupswrapper
    │               │   ├── brcupsconfpt1
    │               │   ├── brother_mfcj5920dw_printer_en.ppd
    │               │   └── cupswrappermfcj5920dw
    │               ├── inf
    │               │   ├── brmfcj5920dwfunc
    │               │   ├── brmfcj5920dwrc
    │               │   ├── ImagingArea
    │               │   ├── lut
    │               │   │   ├── BRPRI14AA.BCM
    │               │   │   ├── BRPRI14AC.BCM
    │               │   │   ├── BRPRI14AD.BCM
    │               │   │   ├── BRPRI14AE.BCM
    │               │   │   ├── BRPRI14AF.BCM
    │               │   │   ├── BRPRI14AG.BCM
    │               │   │   ├── BRPRI14AH.BCM
    │               │   │   ├── BRPRI14AI.BCM
    │               │   │   ├── BRPRI14AK.BCM
    │               │   │   ├── BRPRI14AL.BCM
    │               │   │   └── BRPRI14AM.BCM
    │               │   ├── PaperDimension
    │               │   ├── paperinfij2
    │               │   └── setupPrintcapij
    │               └── lpd
    │                   ├── brmfcj5920dwfilter
    │                   ├── filtermfcj5920dw
    │                   └── psconvertij2
    └── usr
        └── bin
            └── brprintconf_mfcj5920dw

21 directories, 31 files

So couple of questions:
1. How do I resolve the error?

2. Which is the actual "filter" file? The wiki example (https://wiki.archlinux.org/index.php/Pa … er_drivers) mentions the "cupswrappermfcj5920dw" file, whereas from the directory structure it looks like it is the "brmfcj5920dwfilter"... ?

3. What is with the inf folder & files, if / where do they need to be copied to?

Ty

Last edited by farc (2016-07-12 21:46:04)

Offline

#2 2016-07-13 07:23:19

severach
Member
Registered: 2015-05-23
Posts: 192

Re: Adapting Package for Brother MFC-J5920DW

Remove the dependency on rpmextract. bsdtar has since gained the ability to extract RPM files. rpmextract was removed but the dependency was left in.

Place 'set -x' at the beginning of package so you can see the command that fails. That and 'false' are the two debug commands you'll be using the most in PKGBUILD.

package() {
  set -x
  ...
}

The ppd is easy to find. I use Midnight Commander but this works too.

find -type 'f' -iname '*.ppd'

Brother's executables are all 32 bit. Your PKGBUILD is missing a multilib dependency to work under 64 bit. It will work if multilib is already installed but you can't be sure of that.

For my Brother packages I noticed that one of the executables has  source available so I compile it and discard the 32 bit version.

The .install file can be gotten rid of by modifying the installer and running in prepare(). This makes the package better and safer.

You can see all this happen in one of my /opt variants like brother-mfc-j5620dw.

Offline

#3 2016-07-17 21:41:42

farc
Member
Registered: 2014-03-05
Posts: 17

Re: Adapting Package for Brother MFC-J5920DW

Ok, thanks for the info. However this was way too much code handling for me... :-/

In the end I copied your mfc-j5620DW script and just changed the 6 for a 9 :-)
(... and the URL and the checksums, thats more my level)

... And it WORKED!!!

So thanks a lot!


Maybe I will try next for the brscan package, although I'm not sure if it is really worth the trouble. Right now I feel quite comfortable with scanning to network (NAS).

Offline

Board footer

Powered by FluxBB