From 4c9ae7f5bf86bb2f201598cd5f9df4f6ed9ce7f9 Mon Sep 17 00:00:00 2001 From: Shahab Vahedi Date: Fri, 2 Aug 2024 16:41:21 +0200 Subject: [PATCH 1/2] New package: brother-dcp8410-lpr-1.5.0 --- srcpkgs/brother-dcp8410-lpr/INSTALL | 9 +++++ srcpkgs/brother-dcp8410-lpr/REMOVE | 6 ++++ .../patches/fix-setup-script.patch | 17 +++++++++ srcpkgs/brother-dcp8410-lpr/template | 35 +++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 srcpkgs/brother-dcp8410-lpr/INSTALL create mode 100644 srcpkgs/brother-dcp8410-lpr/REMOVE create mode 100644 srcpkgs/brother-dcp8410-lpr/patches/fix-setup-script.patch create mode 100644 srcpkgs/brother-dcp8410-lpr/template diff --git a/srcpkgs/brother-dcp8410-lpr/INSTALL b/srcpkgs/brother-dcp8410-lpr/INSTALL new file mode 100644 index 00000000000000..7297faa2a0aba9 --- /dev/null +++ b/srcpkgs/brother-dcp8410-lpr/INSTALL @@ -0,0 +1,9 @@ +case "${ACTION}" in +post) + ln -sf /opt/brother/Printers/dcpl8410cdw/lpd/brprintconf_dcpl8410cdw \ + usr/bin/brprintconf_dcpl8410cdw + + mkdir -p var/spool/lpd + opt/brother/Printers/dcpl8410cdw/inf/setupPrintcapij dcpl8410cdw -i + ;; +esac diff --git a/srcpkgs/brother-dcp8410-lpr/REMOVE b/srcpkgs/brother-dcp8410-lpr/REMOVE new file mode 100644 index 00000000000000..0c666f819ceec4 --- /dev/null +++ b/srcpkgs/brother-dcp8410-lpr/REMOVE @@ -0,0 +1,6 @@ +case ${ACTION} in +pre) + /opt/brother/Printers/dcpl8410cdw/inf/setupPrintcapij dcpl8410cdw -e + unlink /usr/bin/brprintconf_dcpl8410cdw + ;; +esac diff --git a/srcpkgs/brother-dcp8410-lpr/patches/fix-setup-script.patch b/srcpkgs/brother-dcp8410-lpr/patches/fix-setup-script.patch new file mode 100644 index 00000000000000..09b116bdcc7cab --- /dev/null +++ b/srcpkgs/brother-dcp8410-lpr/patches/fix-setup-script.patch @@ -0,0 +1,17 @@ +Source: package maintainer +Upstream: no +Reason: There's no "lp" user on Void Linux + +--- a/opt/brother/Printers/dcpl8410cdw/inf/setupPrintcapij ++++ b/opt/brother/Printers/dcpl8410cdw/inf/setupPrintcapij +@@ -34,9 +34,8 @@ case "$2" in + if [ ! -d $SPOOLER_NAME ]; then + mkdir -p $SPOOLER_NAME + fi +- chown lp $SPOOLER_NAME + chgrp lp $SPOOLER_NAME +- chmod 700 $SPOOLER_NAME ++ chmod 770 $SPOOLER_NAME + + if [ "$3" = "USB" ]; then + DEVICE_IF=/dev/usb/lp0 diff --git a/srcpkgs/brother-dcp8410-lpr/template b/srcpkgs/brother-dcp8410-lpr/template new file mode 100644 index 00000000000000..78a79232ee03c9 --- /dev/null +++ b/srcpkgs/brother-dcp8410-lpr/template @@ -0,0 +1,35 @@ +# Template file for 'brother-dcp8410-lpr' +pkgname=brother-dcp8410-lpr +version=1.5.0 +revision=1 +archs="i686 x86_64" +create_wrksrc=yes +depends="ghostscript" +short_desc="LPR driver for the Brother DCP-L8410CDW machines" +maintainer="Shahab Vahedi " +license="GPL-2.0-only" +homepage="https://support.brother.com/g/b/producttop.aspx?c=eu_ot&lang=en&prod=dcpl8410cdw_eu" +distfiles="https://download.brother.com/welcome/dlf103239/dcpl8410cdwlpr-${version}-0.i386.deb" +checksum="1e97cd530e7b6162bf436d16e94098e524b438fdecf0a8044c5e07efa9300080" +mutable_files="/opt/brother/Printers/dcpl8410cdw/inf/brdcpl8410cdwrc" +nopie=yes + +do_install() { + + if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then + ln -sf ./x86_64/brdcpl8410cdwfilter \ + opt/brother/Printers/dcpl8410cdw/lpd/brdcpl8410cdwfilter + ln -sf ./x86_64/brprintconf_dcpl8410cdw \ + opt/brother/Printers/dcpl8410cdw/lpd/brprintconf_dcpl8410cdw + elif [ "$XBPS_TARGET_MACHINE" = "i686" ]; then + ln -sf ./i686/brdcpl8410cdwfilter \ + opt/brother/Printers/dcpl8410cdw/lpd/brdcpl8410cdwfilter + ln -sf ./i686/brprintconf_dcpl8410cdw \ + opt/brother/Printers/dcpl8410cdw/lpd/brprintconf_dcpl8410cdw + fi + + ln -sf /opt/brother/Printers/dcpl8410cdw/lpd/brprintconf_dcpl8410cdw \ + /usr/bin/brprintconf_dcpl8410cdw + + vcopy opt / +} From e31304fa1cd57078577357c38f447a98a017e94d Mon Sep 17 00:00:00 2001 From: Shahab Vahedi Date: Fri, 2 Aug 2024 16:41:50 +0200 Subject: [PATCH 2/2] New package: brother-dcp8410-cups-1.5.0 --- srcpkgs/brother-dcp8410-cups/INSTALL | 7 + srcpkgs/brother-dcp8410-cups/REMOVE | 5 + .../files/cupswrapperdcpl8410cdw.void | 152 ++++++++++++++++++ srcpkgs/brother-dcp8410-cups/template | 25 +++ 4 files changed, 189 insertions(+) create mode 100644 srcpkgs/brother-dcp8410-cups/INSTALL create mode 100644 srcpkgs/brother-dcp8410-cups/REMOVE create mode 100755 srcpkgs/brother-dcp8410-cups/files/cupswrapperdcpl8410cdw.void create mode 100644 srcpkgs/brother-dcp8410-cups/template diff --git a/srcpkgs/brother-dcp8410-cups/INSTALL b/srcpkgs/brother-dcp8410-cups/INSTALL new file mode 100644 index 00000000000000..3f0d483b50252a --- /dev/null +++ b/srcpkgs/brother-dcp8410-cups/INSTALL @@ -0,0 +1,7 @@ +case "${ACTION}" in +post) + chmod 755 opt/brother/Printers/dcpl8410cdw/cupswrapper + opt/brother/Printers/dcpl8410cdw/cupswrapper/cupswrapperdcpl8410cdw.void -i + ;; +esac + diff --git a/srcpkgs/brother-dcp8410-cups/REMOVE b/srcpkgs/brother-dcp8410-cups/REMOVE new file mode 100644 index 00000000000000..9429345a453649 --- /dev/null +++ b/srcpkgs/brother-dcp8410-cups/REMOVE @@ -0,0 +1,5 @@ +case ${ACTION} in +pre) + opt/brother/Printers/dcpl8410cdw/cupswrapper/cupswrapperdcpl8410cdw.void -e + ;; +esac diff --git a/srcpkgs/brother-dcp8410-cups/files/cupswrapperdcpl8410cdw.void b/srcpkgs/brother-dcp8410-cups/files/cupswrapperdcpl8410cdw.void new file mode 100755 index 00000000000000..5ec8b25520e1ad --- /dev/null +++ b/srcpkgs/brother-dcp8410-cups/files/cupswrapperdcpl8410cdw.void @@ -0,0 +1,152 @@ +#! /bin/sh +# +# Brother Print filter +# Copyright (C) 2005-2016 Brother. Industries, Ltd. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# + +# This is trimmed down and tailored for brother-dcpl8410cdw-cupswrapper +# package of Void Linux + +printer_model="dcpl8410cdw" +printer_name="DCPL8410CDW" # uppercase of $printer_model +device_name="DCP-L8410CDW" # $printer_name with a hyphen after {MFC,DCP,HL} +inst_path="/opt/brother/Printers/${printer_model}" +lpdwrapper="$inst_path/cupswrapper/brother_lpdwrapper_${printer_model}" +ppd_file_name=/usr/share/cups/model/Brother/brother_${printer_model}_printer_en.ppd +brotherlpdwrapper=/usr/lib/cups/filter/brother_lpdwrapper_${printer_model} + +if [ -d "/usr/share/cups/model" ] +then + mkdir -p /usr/share/cups/model/Brother +fi + +# Eliminate +if [ "$1" = '-e' ] +then + lpadmin -x ${printer_name} + rm -f "$ppd_file" + rm -f "$brotherlpdwrapper" + rm -f "$lpdwrapper" + sv restart cupsd + exit 0 +fi + +# Restart +if [ "$1" = "-r" ] +then + lpadmin -x ${printer_name} + sv restart cupsd + exit 0 +fi + +if [ "$1" = "help" ] || [ "$1" = "-h" ] +then + echo 'option -h : help' + echo ' -i : install' + echo ' -e : uninstall' + echo ' -r : remove printer' + exit 0 +fi + +# +# The rest is "install" +# + +if [ -e "$inst_path/lpd/filter_${printer_model}" ] +then + : +else + echo "ERROR : Brother LPD filter is not installed." +fi +rm -f $ppd_file_name + +src_ppd="$inst_path/cupswrapper/brother_${printer_model}_printer_en.ppd" +if [ -e "$src_ppd" ] +then + cp "$src_ppd" $ppd_file_name +fi +chmod 644 $ppd_file_name + +# +# check /usr/lib/cups/filter +# +if [ -d /usr/lib/cups/filter ] +then + rm -f $brotherlpdwrapper + ln -s $lpdwrapper $brotherlpdwrapper +fi + +sv restart cupsd + +sleep 2s + +uris=$(lpinfo -v) + +for uri in $uris +do + URI=$(echo $uri | grep ${device_name} | grep usb) + if [ "$URI" != '' ] + then + break; + fi +done + +if [ "$URI" = '' ] +then + for uri in $uris + do + URI=$(echo $uri | grep ${device_name} ) + if [ "$URI" != '' ] + then + break; + fi + done +fi + +if [ "$URI" = '' ] +then + for uri in $uris + do + URI=$(echo $uri | grep -i Brother | grep usb ) + if [ "$URI" != '' ] + then + break; + fi + done +fi + +if [ "$URI" = '' ] +then + for uri in $uris + do + URI=$(echo $uri | grep usb) + if [ "$URI" != '' ] + then + break; + fi + done +fi + +if [ "$URI" = '' ] +then + URI="usb://dev/usb/lp0" +fi + +echo lpadmin -p ${printer_name} -E -v $URI -P $ppd_file_name +lpadmin -p ${printer_name} -E -v $URI -P $ppd_file_name + +exit 0 diff --git a/srcpkgs/brother-dcp8410-cups/template b/srcpkgs/brother-dcp8410-cups/template new file mode 100644 index 00000000000000..4610712412267d --- /dev/null +++ b/srcpkgs/brother-dcp8410-cups/template @@ -0,0 +1,25 @@ +# Template file for 'brother-dcp8410-cups' +pkgname=brother-dcp8410-cups +version=1.5.0 +revision=1 +archs="i686 x86_64" +create_wrksrc=yes +depends="brother-dcp8410-lpr cups" +short_desc="CUPS wrapper driver for the Brother DCP-L8410CDW machines" +maintainer="Shahab Vahedi " +license="GPL-2.0-only" +homepage="https://support.brother.com/g/b/producttop.aspx?c=eu_ot&lang=en&prod=dcpl8410cdw_eu" +distfiles="https://download.brother.com/welcome/dlf103248/dcpl8410cdwcupswrapper-${version}-0.i386.deb" +checksum="b9deb04a6b8f7dd800e04cd90dcd3fa6129214bf36d63649b1710915fd8b549a" + +do_install() { + vcopy opt / +} + +post_install() { + # favour the "*.void" version over the one provided by the distfile + vinstall ${FILESDIR}/cupswrapperdcpl8410cdw.void 755 opt/brother/Printers/dcpl8410cdw/cupswrapper/ + chmod a-x ${DESTDIR}/opt/brother/Printers/dcpl8410cdw/cupswrapper/cupswrapperdcpl8410cdw + + chmod 755 ${DESTDIR}/opt/brother/Printers/dcpl8410cdw/cupswrapper +}