Sample Header Ad - 728x90

How to update an Arch Linux PKGBUILD file for new version (printer driver)?

5 votes
0 answers
1328 views
I want to install the CUPS driver for the Brother QL-1060N label printer on Arch Linux. Fortunately, there is an AUR package available. (Arch is amazing.) However, the AUR package is a bit out of date. My question is, how can I edit the PKGBUILD file to install the latest driver version? Here is the AUR package. It is for version 1.0.1r0 Here is the Brother driver download link. The current version is 1.0.5-0. Below is the PKGBUILD: # Maintainer: Karol Babioch # Inspired by package brother-dcp130c pkgname='brother-ql1060n' pkgver=1.0.1r0 pkgrel=1 pkgdesc='LPR and CUPS driver for Brother QL-1060N label printer' url='http://solutions.brother.com/linux/en_us/ ' arch=('i686' 'x86_64') license=('custom') depends='cups' if [ "$CARCH" = 'x86_64' ]; then depends+=('lib32-glibc') fi install="$pkgname.install" source=("http://download.brother.com/welcome/dlfp002231/ql1060nlpr-${pkgver/r/-}.i386.rpm " "http://download.brother.com/welcome/dlfp002233/ql1060ncupswrapper-${pkgver/r/-}.i386.rpm " 'LICENSE') sha256sums=('f2c2f919ec15b6159e13bfec60bb2d515f8c77a812e349a0ed1ec68ac29f5a25' 'bf7a1d86234d643547fc9052df55524a5e4ddbd4bf07799988c18666e7d2d3eb' 'cdd1955a9996bc246ba54e84f0a5ccbfdf6623962b668188762389aa79ef9811') prepare() { # do not install in '/usr/local' if [ -d $srcdir/usr/local/Brother ]; then install -d $srcdir/usr/share mv $srcdir/usr/local/Brother/ $srcdir/usr/share/brother rm -rf $srcdir/usr/local sed -i 's|/usr/local/Brother|/usr/share/brother|g' grep -lr '/usr/local/Brother' ./ fi # setup cups directories install -d "$srcdir/usr/share/cups/model" install -d "$srcdir/usr/lib/cups/filter" # go to the cupswrapper directory and find the source file from wich to generate a ppd- and wrapper-file cd find . -type d -name 'cupswrapper' if [ -f cupswrapper* ]; then _wrapper_source=ls cupswrapper* sed -i '/^\/etc\/init.d\/cups/d' $_wrapper_source sed -i '/^sleep/d' $_wrapper_source sed -i '/^echo lpadmin/d' $_wrapper_source sed -i '/^lpadmin/d' $_wrapper_source sed -i 's|/usr|$srcdir/usr|g' $_wrapper_source sed -i 's|/opt|$srcdir/opt|g' $_wrapper_source sed -i 's|/model/Brother|/model|g' $_wrapper_source sed -i 's|lpinfo|echo|g' $_wrapper_source export srcdir=$srcdir ./$_wrapper_source sed -i 's|$srcdir||' $srcdir/usr/lib/cups/filter/*lpdwrapper* sed -i "s|$srcdir||" $srcdir/usr/lib/cups/filter/*lpdwrapper* rm $_wrapper_source fi # /etc/printcap is managed by cups rm find $srcdir -type f -name 'setupPrintcap*' } package() { cd "$srcdir" cp -R usr $pkgdir if [ -d opt ]; then cp -R opt $pkgdir; fi install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } The .install file in the package archive include only this: post_install() { post_upgrade; } post_upgrade() { echo "Restart CUPS to load the new files" echo "You can now register your new printer using the web interface at:" echo " http://localhost:631/" } Some questions include: Why isn't rpmextract required in the PKGBUILD code? I don't understand how the install is working given that the packages are RPMs and this is Arch. Regarding the sha256sums, I assume I just manually download the rpm files and calculate those sums given that the Brother download page doesn't list them (afaik). The values I come up with are: 05d786b9a5b2cf374d5c286ae8feb77e2a79619cc5b2f6ca2695dbd549eec0a3 ql1060ncupswrapper-1.0.5-0.i386.rpm bf20a00f723d0e12cf055ae359d0e03e2c1bd839bacd52f02b3cc5a63bc652e5 ql1060nlpr-1.0.5-0.i386.rpm I assume the license file and it's sha256sum can remain unchanged. Given that, is updating the PKGBUILD as simple as replacing the sha256sums and updating this one value? pkgver=1.0.1r0 with pkgver=1.0.5-0 #UPDATE The package maintainer has updated the package already. Here is a diff: 5c5 pkgver=1.0.5r0 19,20c19,20 sha256sums=('bf20a00f723d0e12cf055ae359d0e03e2c1bd839bacd52f02b3cc5a63bc652e5' > '05d786b9a5b2cf374d5c286ae8feb77e2a79619cc5b2f6ca2695dbd549eec0a3' However, I'll leave the question up because I would like to understand how this PKGBUILD works and how an RPM package can be installed using this method.
Asked by MountainX (18888 rep)
Nov 17, 2017, 03:42 AM
Last activity: Nov 18, 2017, 09:45 AM