SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
FWIW - The Brother HL-2035 is supported in Slackware (without installing the Brother drivers) via CUPS and gutenprint.
From 'lpinfo -m | grep -i brother'
In my case:
The Brother lpr package installs a filter that is called from a shell script installed in /usr/lib/cups/filter/ so providing the raster filter. This is used in conjunction with the PPD file installed by the Brother cupswrapper package. Further filters are included before passing to the backend.
I confirm: PCL hpijs-pcl5e driver works and also other open drivers seem to be able to interact with my printer. But all that drivers have some limitation: for example hpijs-pcl5e driver works fine but it can't print at highest resolution (1200HQ), hl1250 works quite well but if you select 1200HQ quality it prints out a strange two column printed page, so I have to downgrade to 600x600 resolution. Brother proprietary drivers, if I well remember, allow the best quality supported by the printer and I want to try them to obtain the max quality from my printer. I opened a new topic to talk about my tests with open drivers, because this one is related to proprietary drivers installation. So let's rest in topic
I referred to hl1250 open driver because it works for my HL-2035 printer and just to describe how a PPD file works and which other files it needs.
As recap, I'd like to understand which files from brother proprietary packages are really needed to make the hl-2035 printer working under CUPS. When this will be clearer I want to make a slackware complaint txz package or a slackbuild script... Some patches will likely be needed to edit the brother scripts so that they properly write just the needed files in the right paths of slackware file system.
Vonbiber slackbuilds are based on rpm brother packages, while for my 2035 I have just a cupswrapper source package. I'd like to install my printer using that package only. Maybe it isn't possible and the LPD filter (from HL-2030 rpm package) is also required: I'll inspect the cups filter bash script to verify it...
PS.
As regard 2035/2030 printer models, they are managed by the same driver, here's why you the script refers to HL2030 and not to HL2035, but it's not a problem, also linux detects it as 2030 model:
Code:
Bus 001 Device 006: ID 04f9:0027 Brother Industries, Ltd HL-2030 Laser Printer
EDIT:
Thank you Allend! I'll take a look at your links
As regards the gutenprint driver you can see my tests in the other topic, I put the link above at the top of this message. Anyway It didn't seem to work well with my printer...
Hey folks!
I tried to install a package built with a slackbuild based on an archlinux PKGBUILD and a patch to edit some brother files. I think the approach could be similar to vonbiber slackbuilds.
Unfortunately the installed drivers can't make my printer working as expected. I suspect the issue could be related to 64 bits arch of my system, while the drivers involve 32-bit binaries. I installed also the suggested multilib package from AlienBob repo:
Code:
# ls /var/log/packages/|grep "compat32\|multi"
cups-compat32-2.1.4-x86_64-1compat32
cups-filters-compat32-1.9.0-x86_64-2compat32
glibc-solibs-2.23_multilib-x86_64-1alien
The question is: are you sure the above "deps" packages are enough to make the 32bit drivers working properly?
Thanks a lot in advance!
PS.
The following are te files installed on my system with the created package:
I tested a simpler solution:
- To just extract RPMs content and package it for Slackware, even if not standard paths will be created (as for files in /usr/local/Brother).
- Then run cupswrapper (/usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1) bash script by hand and let it make the PPD file and its cups-filter (/usr/lib/cups/filter/brlpdwrapperHL2030) file. It will also restars CUPS service and add printer the new printer using "lpadmin" command...
This time seems all works as expected:
- Printer support 1200HQ quality
- Jobs are managed properly and sheets seem to be moved without any problem.
Since the drivers installed in that way just work fine, I wrote a slackbuild script. I attach it to this message.
It is just a testing slackbuild not complete and I'd like to obtain some suggestion.
Especially as regards the post install script: is there a way to automatically run the post-install script "cupswrapperHL2030-2.0.1"?
I think the proper way to do it is through a doinstall.sh script... could you help me to add this last part?
I added a doinst.sh script that just launches "/usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1" and restart CUPS service (maybe this last restart command is not needed, anyway it doesn't hurt...). You can find SlackBuild, doinst.sh and slack-desc files attached.
I tested the new package:
- uninstalled previous package (the one tried yesterday without doinst.sh)
- manually removed /usr/local/Brother/ directory because it contained a new subdir called "filter"
- deleted printer "HL-2030" from CUPS
- restarted CUPS
- tried to print something and it doesn't work (as expected, because the printer had been deleted from cups)
- Ok, at this point I launched the new SlackBuild (the one attached to this message) and installed the created package.
- Opened CUPS web interface, the "new" printer appeared properly added so I set 1200HQ print quality.
- finally I tried some print test:
1.
Code:
lp -o fit-to-page -o media=a4 -P1 testpage.pdf
It worked fine.
2.
I also tested a CUPS "self print test" and also that works as expected.
3.
Finally I printed a page from Okular: it worked and the whole page width has been printed as expected. If you look at my above messages you can see my priter printed out pages with lateral margins cuted away when I tried printing from Okular (with open drivers, both hl1250 and hpijs-pcl5e).
Hope it will be useful also for other users!
I would had liked to build a package closer to Slackware standard file system paths. But as I reported, also Debian guys say the binaries contained in RPM packages involve hardcoded paths (in HL-2030 case I think files installed in /usr/local/Brother are needed).
I'm not an expert packager so if you could check them out, it would be greatly appreciated!
See you!
@joenew
Glad to hear you were able to make your printer work.
I had a look at the contents of the RPMs and your scripts.
Here are the contents (I left out var) and the file types
###LPR
usr/bin/brprintconflsr2
ELF 32-bit LSB executable, Intel 80386
usr/bin/brprintconfiglpr2
POSIX shell script, ASCII text executable
usr/lib/libbrcomplpr2.so
ELF 32-bit LSB shared object
usr/local/Brother/lpd/filterHL2030
POSIX shell script, ASCII text executable
usr/local/Brother/lpd/psconvert2
ASCII text
usr/local/Brother/lpd/rawtobr2
ELF 32-bit LSB executable, Intel 80386
usr/local/Brother/inf/setupPrintcap
POSIX shell script, ASCII text executable
usr/local/Brother/inf/braddprinter
ELF 32-bit LSB executable, Intel 80386
usr/local/Brother/inf/paperinf
ASCII text
usr/local/Brother/inf/brHL2030rc
ASCII text
usr/local/Brother/inf/brHL2030func
ASCII text
Right off the bat, here are some suggestions.
Code:
1. I would create 2 different trees for the unpacked RPMs and the
directory where you're going to run makepkg
e.g., /tmp/brother-hl2030, and /tmp/pkg
2. I would only copy from /tmp/brother-hl2030/usr the binaries (see above),
and have a closer look at the ASCII files (some being shell scripts)
(for instance in usr/local/Brother/cupswrapper/cpswrapperHL2030-2.0.1
I would extract (using awk/grep/sed/wc ...) directly the ppd and
place it in the right location as well as the filter and
I would look at the remaining stuff in that script and write
just what is needed (and call that script from the doinst.sh)
3. I wouldn't copy the var tree.
Instead in the doinst.sh I would add this:
mkdir -p /var/spool/lpd/HL2030
#set the right permissions and ownership
chown -R lp:lp /var/spool/lpd/HL2030
chmod 700 /var/spool/lpd/HL2030
Yes that's not a big deal.
Anyway seems removepkg can't remove exactly every files. I noticed at least four files are still present after removing brother-hl2030 package:
Code:
WARNING: Unique directory /usr/local/Brother/ contains new files
This Warning message regards the empty directory /usr/local/Brother/filter.
Moreover we have two/three files written by the "/usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1" script through doinst.sh:
Code:
# ls -1 /usr/lib*/cups/filter/brlpdwrapperHL2030 /usr/share/cups/model/HL2030.ppd
/usr/lib/cups/filter/brlpdwrapperHL2030*
/usr/lib64/cups/filter/brlpdwrapperHL2030*
/usr/share/cups/model/HL2030.ppd
I read about the lack of post-uninstall script of removepkg and if I well understand post-unistall "purge" scripts are unsopported to prevent potential data loss issues. So I think the right way to install the package should be:
Extract all RPMs content in a temporary directory (like /tmp/borther-2030)
Then split the "/tmp/borther-hl2030/usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1" script in two parts: the first will write the PPD files and cup filter, the second will just add the new printer to CUPS and restart the service.
The first part could be obtained by patching the original script so that it writes all files to temporary packaging directory instead of the root file system. The patched script should be executed from within the slackbuild.
The last part of the script could be executed by doinst.sh.
In that way when the package will be removed also PPD and cups filter files will be removed, since they have been previously installed directly by installpkg.
I tried this way, but seems my HL2035 can't print properly anymore. It always prints out just a strange "log" page reporting various printer stats...
I have to check the patched file....
EDIT:
Thank you vonbiber, I wrote this message before noticing your answer!
I'll do various tests...
EDIT2:
Ahrrg.. My mistake! :\
I have removed the package without cleanup printers list from CUPS web interface... Here why my printer was able to print those strange pages... strange behavior anyway! The printer was able to print (strange log pages only ok but it was working) without drivers really installed...
Let forget it!
Now, I've reinstalled the new package (created with patched script as explained in the previous message) and printer seems to work fine. I'll check the new slackbuild, new doinst.sh and the patch, then I'll post them.
1. I would create 2 different trees for the unpacked RPMs and the
directory where you're going to run makepkg
e.g., /tmp/brother-hl2030, and /tmp/pkg
2. I would only copy from /tmp/brother-hl2030/usr the binaries (see above),
and have a closer look at the ASCII files (some being shell scripts)
(for instance in usr/local/Brother/cupswrapper/cpswrapperHL2030-2.0.1
I would extract (using awk/grep/sed/wc ...) directly the ppd and
place it in the right location as well as the filter and
I would look at the remaining stuff in that script and write
just what is needed (and call that script from the doinst.sh)
3. I wouldn't copy the var tree.
Instead in the doinst.sh I would add this:
mkdir -p /var/spool/lpd/HL2030
#set the right permissions and ownership
chown -R lp:lp /var/spool/lpd/HL2030
chmod 700 /var/spool/lpd/HL2030
Let's start from suggestion number 2: it's not a so easy stuff...
For instance PPD file contains the line:
it requests the cups filter file: /usr/lib/cups/filter/brlpdwrapperHL2030
What is that? What kind of file?
Well it is an other shell script (it is written by the same cupswrapper script which creates the above PPD file). If we look closer at that script we can see it require some other files, for example:
And what about /usr/local/Brother/lpd/filterHL2030 ?
It is an other shell script, but this one is part of the LPD brother package. If we copy just the binary files of LPD package, we will miss that needed script and the printer will not be working properly for sure.
So your suggestion could be useful for cupswrapper script, because it just creates few directories and a couple of files, but for the other scripts it would be a little hard checking all involved files patching them etc etc...
So I would highlight few points the slackbuild and the package created has to comply with:
Code:
I. printer is working properly
II. removepkg doesn't leave orphan files around
This second condition requires doinst.sh script doesn't create new dirs and files around.
For example in your third suggestion doinst.sh would create the spool dirs. What would happen at remove time? Well removepkg would leave behind the /var/spool/lpd/HL2030 directory....
On the contrary, if we copy that empty spool dirs in the package, when we will remove it, removepkg will delete also that empty directory.
As regard cupwrapper file I created a patch to remove all uneeded lines. In my attempt the patched script is executed from within the slackbuild so that it creates PPD and cups filter files in the package tree, it seems easier than extracting them with sed or awk. I included the last part of that script in doinst.sh: it restarts cups service and adds the printer with lpadmin.
I attach all needed files to build the slackware package of brother-hl2030.
Hope it could be useful and it doesn't contain too much errors.
it requests the cups filter file: /usr/lib/cups/filter/brlpdwrapperHL2030
If we look closer at that script we can see it require some other files, for example:
And what about /usr/local/Brother/lpd/filterHL2030 ?
I wrote a quick and dirty script to split the cupswrapper script and extract the
ppd file and the lpd wrapper:
Code:
TMP=/tmp/HL2030
PKG=$TMP/pkg
#unpacked RPMs in $TMP
#copy all the binaries in $PKG
#leave out cupswrapperHL2030-2.0.1
cd $TMP
input=usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1
# write ppd file
ppdfile=HL2030.ppd
output=$PKG/usr/share/cups/model/$ppdfile
n=$(grep -n '<<ENDOFPPDFILE' $input | sed 's?:.*??')
l=$(grep -n '^ENDOFPPDFILE' $input | sed 's?:.*??')
head -n$((l-1)) $input | tail -n$((l-$((n+1)))) >$output
#get the beginning of the script: head -n$((n-1)) >part1
#part between end of ENDOFPPDFILE and start of ENDOFWFILTER
#m=$(grep -n '<<!ENDOFWFILTER' $input | sed 's?:.*??')
#head -n$((m-1)) $input | tail -n$((m-$((l+1)))) > part2
###
# write the lpdwrapper
lpdwrapper=brlpdwrapperHL2030
output=brlpdwrapperHL2030
output=$PKG/usr/lib/cups/filter/$lpdwrapper
o=$(grep -n '^!ENDOFWFILTER' $input | sed 's?:.*??')
head -n$((o-1)) $input | tail -n$((o-$((m+1)))) | sed 's?\\\([\$`]\)?\1?g' > $output
###
# get the end of the script
f=$(cat $input | wc -l)
tail -n$((f-$((o+1)))) $input > part3
#merge part1, part 2, part 3 and examine it
Quote:
As regard cupwrapper file I created a patch to remove all uneeded lines. In my attempt the patched script is executed from within the slackbuild so that it creates PPD and cups filter files in the package tree, it seems easier than extracting them with sed or awk.)
Oh, I didn't see that when I wrote the stuff above.
I'll have a look at your files.
ok, I just looked at your files and here's what I suggest.
1. Revise your patch so it doesn't create a /usr/lib64/... tree.
The creation of /usr/lib64 shouldn't be done in the SlackBuild.
It should be done at installation time if the package is installed on a 64-bit system.
You could have doinst.sh take care of this, and just create a symbolic link
in the doinst.sh (see further below).
That way, your script can build a package for either architecture, and
doesn't install an uneeded /usr/lib64 on a 32-bit system
2. Rename the doinst.sh you have
Code:
mv doinst.sh cupswrapperHL2030-2.0.1
and replace cupswrapperHL2030-2.0.1 in the package by its contents:
and, finally, create a new doinst.sh, so it does 2 things:
a) check if the system is 64-bit, in which case you create a link to brlpdwrapperHL2030
b) launch the simplified cupswrapper script (see above) from there.
Open your favorite text editor and copy and paste this to your new doinst.sh:
Code:
if [ $(name -m) == x86_64 ]; then
(cd /usr/lib64/cups/filter; ln -sf /usr/lib/cups/filter/brlpdwrapperHL2030)
fi
/usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.