Skip to content

Instantly share code, notes, and snippets.

@coderbyheart
Last active February 3, 2024 20:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save coderbyheart/ab133a5700c8dc4e2ca7 to your computer and use it in GitHub Desktop.
Save coderbyheart/ab133a5700c8dc4e2ca7 to your computer and use it in GitHub Desktop.
QL-720NW

QL-720NW printing with Arch Linux (32-Bit)

brother-ql720nw-lpr

PKGBUILD

# Maintainer:  Markus Tacker <m@cto.hiv>
# Based on the QL-700 PKGBUILD -> Jacob Alexander <triplehaata@gmail.com>
pkgname=brother-ql720nw-lpr
pkgver=1.0.1
pkgrel=1
pkgdesc="Brother LPR driver for P-Touch QL-720NW labelprinter"
url="http://solutions.brother.com/linux/en_us/"
arch=('i686' 'x86_64')
license=("custom:brother")
depends=('cups' 'ghostscript')
makedepends=('rpmextract')
source=("http://www.brother.com/pub/bsc/linux/dlf/ql720nwlpr-${pkgver}-1.i386.rpm"
        'license.txt')
md5sums=('5e488a98b6ec1786e55b541dae2810d8'
        '47cf89c2ae034aaf18ea0a6379c897da')
noextract=("ql720nwlpr-$pkgver-1.i386.rpm")
install='lpr.install'

build() {
        cd $srcdir
        rpmextract.sh "ql720nwlpr-$pkgver-1.i386.rpm" || return 1
        rm "ql720nwlpr-$pkgver-1.i386.rpm"
}

package() {
        mv usr opt $pkgdir/. || return 1
        install -D -m644 license.txt $pkgdir/usr/share/licenses/$pkgname/license.txt || return 1
}

lpr.install

# Install file for brother-ql720nw-lpr

post_install() {
        useradd -s /bin/false -g lp lp
        mkdir -p /var/spool/lpd/ql720nw
        /opt/brother/PTouch/ql720nw/inf/setupPrintcappt1 ql720nw -i USB
}

pre_remove() {
        rm -rf /var/spool/lpd/ql720nw
        /opt/brother/PTouch/ql720nw/inf/setupPrintcappt1 ql720nw -e
}

brother-ql720nw-cupswrapper

PKGBUILD

# Maintainer: Markus Tacker <m@cto.hiv>
# Based on the QL-700 PKGBUILD -> Jacob Alexander <triplehaata@gmail.com>
pkgname=brother-ql720nw-cupswrapper
_pkgname=ql720nwcupswrapper
pkgver=1.0.1
pkgrel=1
pkgdesc="LPR-to-CUPS wrapper for Brother P-Touch QL-720NW labelprinter (metric)"
url="http://solutions.brother.com/linux/en_us/"
arch=('i686' 'x86_64')
license=("GPL2")
if [ $CARCH == "x86_64" ]; then
depends=('cups' 'ghostscript' 'lib32-glibc' 'brother-ql720nw-lpr')
else
depends=('cups' 'ghostscript' 'glibc' 'brother-ql720nw-lpr')
fi
makedepends=('rpmextract' 'cpio')
source=("http://download.brother.com/welcome/dlfp002205/$_pkgname-$pkgver-1.i386.rpm")
md5sums=('ff90c008c85c9265c3451b3103ddf54f')
noextract=("$_pkgname-$pkgver-1.i386.rpm")
install='cupswrapper.install'

build() {
        cd $srcdir
        rpmextract.sh "$_pkgname-$pkgver-1.i386.rpm"

        rm -f $_pkgname-$pkgver-1.i386.rpm

        mkdir -p usr/share/ || return 1
        mv opt/brother usr/share/brother || return 1
        rmdir opt || return 1

        sed -i 's|/opt/brother|/usr/share/brother|g' `grep -lr '/opt/brother' ./` || return 1
}

package() {
        mv usr $pkgdir/. || return 1
}

cupswrapper.install

# Install file for brother-ql720nw-cupswrapper

post_install() {
        ln -s /opt/brother/PTouch/ql720nw/{inf,lpd} /usr/share/brother/PTouch/ql720nw/.
        /usr/share/brother/PTouch/ql720nw/cupswrapper/cupswrapperql720nwpt1
        systemctl restart cups
}

pre_remove() {
        /usr/share/brother/PTouch/ql720nw/cupswrapper/cupswrapperql720nwpt1 -e
}

post_remove() {
        rm /usr/share/brother/PTouch/ql720nw/{inf,lpd}
        systemctl restart org.cups.cupsd
}

Add custom media size

sudo brpapertoollpr_ql720nw -P Brother_QL-720NW -n 50x80 -w 50 -h 80
# Brother_QL-720NW is the cups printer name
sudo systemctl restart org.cups.cupsd

Now select the new format as the default media in the printer default options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment