Skip to content

Commit

Permalink
system/brother-dcp8410-cups: Added (DCP-L8410CDW).
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahab Vahedi authored and sbo-bot[bot] committed Nov 16, 2024
1 parent 0068f2d commit cfe0bef
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 0 deletions.
24 changes: 24 additions & 0 deletions system/brother-dcp8410-cups/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This provides the PPD (Postscript Printer Description) driver for
Brother DCP-L8410CDW printer and is needed by CUPS to support it.
This is merely a repackaging of the official "deb" package.

You can check if the PPD is installed correctly by:
$ lpinfo -m | grep 8410
Brother/brother_dcpl8410cdw_printer_en.ppd Brother DCP-L8410CDW CUPS

To add the printer to CUPS, first its URI must be retrieved:
$ lpinfo -v
...
network lpd://BRWD0123456789A/BINARY_P1

And eventually, the printer can be added to CUPS by:
# lpadmin \
-p mybrother \ # name
-L "Valhalla" \ # location
-D "The Almighty Printer" \ # description
-E \ # enable
-v lpd://BRWD0123456789A/BINARY_P1 \ # device URI
-P /usr/share/cups/model/brother_dcpl8410cdw_printer_en.ppd

Later, it may be removed with:
# lpadmin -x mybrother
107 changes: 107 additions & 0 deletions system/brother-dcp8410-cups/brother-dcp8410-cups.SlackBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash

# Slackware build script for brother-dcp8410-lpr

# Copyright 2024 Shahab Vahedi, NL
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=brother-dcp8410-cups
VERSION=${VERSION:-1.5.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
ARCH=noarch
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $PKG
ar p $CWD/dcpl8410cdwcupswrapper-${VERSION}-*.deb data.tar.gz | tar xvz

chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

INST_OPT=opt/brother/Printers/dcpl8410cdw/cupswrapper

# The goal is to populate the files in the following manner:
#
# /usr/share/cups/model/brother_dcpl8410cdw_printer_en.ppd --> ...
# ... --link-to--> /$INST_OPT/brother_dcpl8410cdw_printer_en.ppd
# /usr/lib${LIBDIRSUFFIX}/cups/filter/brother_lpdwrapper_dcpl8410cdw --> ...
# ... --link-to--> /$INST_OPT/brother_lpdwrapper_dcpl8410cdw
#
# Creating a symlink to "brother_lpdwrapper_dcpl8410cdw" is utterly
# important. If we were to copy the lpdwrapper to CUPS filter directory
# instead of creating a symlink, the printing functionality would not
# work. Evidently, the actual lpdwrapper uses relative paths to access
# the LPR driver files installed by brother-dcp8410-lpr:
#
# /opt/brother/Printers/dcpl8410cdw/
# |-- cupswrapper/
# | |-- brother_dcpl8410cdw_printer_en.ppd
# | `-- brother_lpdwrapper_dcpl8410cdw <-- The LPD wrapper
# |-- lpd/ <-- LPD driver dir
# | |-- brdcpl8410cdwfilter
# | |-- brprintconf_dcpl8410cdw
# | `-- filter_dcpl8410cdw
# `-- inf/
# `-- ...
#
# For what it's worth, I've opted to also create a symlink to
# "$INST_OPT/brother_dcpl8410cdw_printer_en.ppd" instead of putting
# the file in /usr/share/cups/model/ directory. Because that directory
# is owned by CUPS package and not this one.
chmod 644 $INST_OPT/brother_dcpl8410cdw_printer_en.ppd
# The link creation parts are done through the doinst.sh script.

# The "cupswrapperdcpl8410cdw" script is poorly written and is not worth
# hacking to make it work. Instead, notify user of the necessary actions
# to take through the README doc.
rm "$INST_OPT/cupswrapperdcpl8410cdw"

mkdir -p usr/doc/$PRGNAM-$VERSION
cat $CWD/README > usr/doc/$PRGNAM-$VERSION/README.maintainer
cat $CWD/$PRGNAM.SlackBuild > usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p install
cat $CWD/slack-desc > install/slack-desc
cat $CWD/doinst.sh > install/doinst.sh
cat $CWD/douninst.sh > install/douninst.sh

/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
10 changes: 10 additions & 0 deletions system/brother-dcp8410-cups/brother-dcp8410-cups.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PRGNAM="brother-dcp8410-cups"
VERSION="1.5.0"
HOMEPAGE="https://support.brother.com/g/b/producttop.aspx?c=eu_ot&lang=en&prod=dcpl8410cdw_eu"
DOWNLOAD="https://download.brother.com/welcome/dlf103248/dcpl8410cdwcupswrapper-1.5.0-0.i386.deb"
MD5SUM="efc8971290459402de7950dee79c4d23"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="brother-dcp8410-lpr"
MAINTAINER="Shahab Vahedi"
EMAIL="list+sbo@vahedi.org"
10 changes: 10 additions & 0 deletions system/brother-dcp8410-cups/doinst.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
case "$( uname -m )" in
x86_64|aarch64) LIBDIRSUFFIX="64" ;;
*) LIBDIRSUFFIX="" ;;
esac

( cd /usr/lib${LIBDIRSUFFIX}/cups/filter && rm -rf brother_lpdwrapper_dcpl8410cdw )
( cd /usr/lib${LIBDIRSUFFIX}/cups/filter && ln -sf /opt/brother/Printers/dcpl8410cdw/cupswrapper/brother_lpdwrapper_dcpl8410cdw )

( cd usr/share/cups/model && rm -rf brother_dcpl8410cdw_printer_en.ppd )
( cd usr/share/cups/model && ln -sf /opt/brother/Printers/dcpl8410cdw/cupswrapper/brother_dcpl8410cdw_printer_en.ppd )
7 changes: 7 additions & 0 deletions system/brother-dcp8410-cups/douninst.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
case "$( uname -m )" in
x86_64|aarch64) LIBDIRSUFFIX="64" ;;
*) LIBDIRSUFFIX="" ;;
esac

( cd /usr/lib${LIBDIRSUFFIX}/cups/filter && unlink brother_lpdwrapper_dcpl8410cdw )
( cd /usr/share/cups/model && unlink brother_dcpl8410cdw_printer_en.ppd )
19 changes: 19 additions & 0 deletions system/brother-dcp8410-cups/slack-desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.

|-----handy-ruler------------------------------------------------------|
brother-dcp8410-cups: brother-dcp8410-cups (CUPS wrapper)
brother-dcp8410-cups:
brother-dcp8410-cups: CUPS support for Brother laser printer DCP-L8410CDW.
brother-dcp8410-cups:
brother-dcp8410-cups:
brother-dcp8410-cups:
brother-dcp8410-cups:
brother-dcp8410-cups:
brother-dcp8410-cups:
brother-dcp8410-cups:
brother-dcp8410-cups:

0 comments on commit cfe0bef

Please sign in to comment.