Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] Add Printer Support: Brother DCP-L8410CDW
@ 2024-08-02 14:58 shahab-vahedi
  2024-08-02 16:37 ` [PR PATCH] [Updated] " shahab-vahedi
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: shahab-vahedi @ 2024-08-02 14:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

There is a new pull request by shahab-vahedi against master on the void-packages repository

https://github.com/shahab-vahedi/void-packages brother
https://github.com/void-linux/void-packages/pull/51608

Add Printer Support: Brother DCP-L8410CDW
The LPR drivers and CUPS wrappers from Debian packages provided on [Brother's Support page](https://support.brother.com/g/b/producttop.aspx?c=eu_ot&lang=en&prod=dcpl8410cdw_eu).

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, `glibc`

A patch file from https://github.com/void-linux/void-packages/pull/51608.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-brother-51608.patch --]
[-- Type: text/x-diff, Size: 10249 bytes --]

From 7f9752f272e1f8ed6191c6aa7f1d908ea84aae25 Mon Sep 17 00:00:00 2001
From: Shahab Vahedi <list+void@vahedi.org>
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..8bbf296fff6e9d
--- /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 <list+void@vahedi.org>"
+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-1.5.0-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 2d206e64366b75c2f00f36c6570f29e833971652 Mon Sep 17 00:00:00 2001
From: Shahab Vahedi <list+void@vahedi.org>
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..dd642d2f1629f9
--- /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 <list+void@vahedi.org>"
+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-1.5.0-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
+}

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-02-11  1:58 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-02 14:58 [PR PATCH] Add Printer Support: Brother DCP-L8410CDW shahab-vahedi
2024-08-02 16:37 ` [PR PATCH] [Updated] " shahab-vahedi
2024-08-04 22:04 ` shahab-vahedi
2024-08-05  7:39 ` shahab-vahedi
2024-08-05  7:53 ` shahab-vahedi
2024-08-05  7:56 ` shahab-vahedi
2024-08-10 19:57 ` shahab-vahedi
2024-08-17  6:39 ` shahab-vahedi
2024-08-25 13:39 ` shahab-vahedi
2024-08-31 17:56 ` shahab-vahedi
2024-09-09  7:41 ` shahab-vahedi
2024-10-24 19:34 ` shahab-vahedi
2024-10-24 19:35 ` shahab-vahedi
2024-10-25 13:26 ` ahesford
2024-10-25 17:29 ` shahab-vahedi
2024-10-28 18:49 ` shahab-vahedi
2024-10-28 20:52 ` [PR PATCH] [Updated] " shahab-vahedi
2024-10-28 20:58 ` shahab-vahedi
2024-10-29 12:59 ` ahesford
2025-01-28  1:57 ` github-actions
2025-02-11  1:58 ` [PR PATCH] [Closed]: " github-actions

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).