You are not logged in.

#1 2024-10-11 07:02:43

monksy
Member
Registered: 2013-12-30
Posts: 23

Hard links in binary, PKGBUILD tries to put files elsewhere

Hi,

I'm working on a brother printer driver. I've followed the wiki's suggestion. (https://wiki.archlinux.org/title/Packag … D_for_.RPM)  (Much of this code was copied from a previous Brother driver)


 $ usr  share  brother  Printers  hll3280cdw  lpd  x86_64    ls 
brhll3280cdwfilter  brprintconf_hll3280cdw
$   usr  share  brother  Printers  hll3280cdw  lpd  x86_64    strings * | grep opt | grep brother       
/opt/brother/Printers/
/opt/brother/Printers/%s/inf/ImagingArea
/opt/brother/Printers/%s/inf/PaperDimension
/opt/brother/Printers/%s/inf/br%sfunc
/opt/brother/Printers/%s/inf/br%src

The binaries have /opt/brother hard coded. That also gets passed down into the other scripts.

Question is: How can I get this executable to redirect it's search, or how would I get a symbolic link to place /opt/brother going to /usr/share/brother? (I added that to the pkgbuild script.. howvever it's modifying absolute paths which is a no-no)

PKGBUILD

# based on https://aur.archlinux.org/packages/brother-mfc-l2710dw/
pkgname='brother-hll3280cdw'
pkgver='3.5.1'
pkgrel=1
pkgdesc='LPR and CUPS driver for the Brother HL-L3280CDW'
url='https://support.brother.com/g/b/downloadend.aspx?c=us&lang=en&prod=hll3280cdw_us_as&os=127&dlid=dlf105746_000&flang=4&type3=10282'
arch=('i686' 'x86_64')
license=('custom:Brother commercial license')
depends=('cups' 'ghostscript' )
depends_x86_64=('lib32-glibc')
install="$pkgname.install"
source=("https://download.brother.com/welcome/dlf105746/hll3280cdwpdrv-$pkgver-1.i386.rpm")
sha256sums=('798a6cbda2a21d7046c5e0a7a68a4aff16e0fbd75982d93ac2a74462efbbc8af')

package() {
        _model="hll3280cdw"

        # using /usr/share instead of /opt
        mkdir -p "$pkgdir/usr/share"
        cp -R "$srcdir/opt/brother" "$pkgdir/usr/share"
        sed -i 's|\\\/opt\\\/|\\\/usr\\\/|' "$pkgdir/usr/share/brother/Printers/$_model/cupswrapper/brother_lpdwrapper_$_model"
        sed -i 's|/opt/|/usr/|' "$pkgdir/usr/share/brother/Printers/$_model/lpd/filter_$_model"
        sed -i 's|/opt/|/usr/|' "$pkgdir/usr/share/brother/Printers/$_model/cupswrapper/cupswrapper$_model"

        # /etc/printcap is managed by cups
        find "$pkgdir" -type f -name 'setupPrintcap*' -delete

        # symlink for lpdwrapper so it correctly figures out the printer model from the path
        install -d "$pkgdir/usr/lib/cups/filter/"
        ln -s "/usr/share/brother/Printers/$_model/cupswrapper/brother_lpdwrapper_$_model" "$pkgdir/usr/lib/cups/filter/brother_lpdwrapper_$_model"

        # symlink for the PPD
        install -d "$pkgdir/usr/share/cups/model/"
        ln -s "/usr/share/brother/Printers/$_model/cupswrapper/brother_${_model}_printer_en.ppd" "$pkgdir/usr/share/cups/model/"

        # a couple architecture-specific symlinks
        ln -s "/usr/share/brother/Printers/$_model/lpd/$CARCH/brprintconflsr3" "$pkgdir/usr/share/brother/Printers/$_model/lpd/"
        ln -s "/usr/share/brother/Printers/$_model/lpd/$CARCH/rawtobr3" "$pkgdir/usr/share/brother/Printers/$_model/lpd/"
        ln -s "/usr/share/brother/Printers/$_model/lpd/$CARCH/br${_model}filter" "$pkgdir/usr/share/brother/Printers/$_model/lpd/"

        # symlink for inf because it tries to execute it there
        ln -s "/usr/share/brother/Printers/$_model/inf" "$pkgdir/usr/share/brother/Printers/$_model/lpd/"
        ln -s /usr/share/brother /opt/brother
}

Offline

#2 2024-10-11 09:42:49

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,991

Re: Hard links in binary, PKGBUILD tries to put files elsewhere

https://wiki.archlinux.org/title/Packaging_Brother_printer_drivers#Preparing_a_PKGBUILD_for_.RPM wrote:

This article or section is out of date.
Reason: This page was written before the i686 architecture stopped being supported. As such, it provides examples with i386 packages and packages them without taking 32-bit package guidelines into consideration. (Discuss in Talk:Packaging Brother printer drivers)

look at https://wiki.archlinux.org/title/CUPS/P … ms#Brother .
What is the model of your printer ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2024-10-11 21:05:42

monksy
Member
Registered: 2013-12-30
Posts: 23

Re: Hard links in binary, PKGBUILD tries to put files elsewhere

hl-l3280cdw

Offline

#4 2024-10-11 22:44:57

seth
Member
Registered: 2012-09-03
Posts: 59,159

Re: Hard links in binary, PKGBUILD tries to put files elsewhere

What's wrong w/ "ln -s /usr/share/brother/Printers/$_model/inf $pkgdir/opt/brother/Printers/$_model/inf" ?
(I'd go w/ the specific-most path in case other drivers want to install to /opt/brother)
You'd basically just have to adjust the existing "symlink for inf because brother is dumb" stanza.

1. have you checked that the binary *only* has those paths and doesn't also check /usr and maybe /usr/local
2. brother drivers that depend on gs have a tendency to also depend on "which" to find gs

Offline

Board footer

Powered by FluxBB