LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-28-2016, 07:59 AM   #106
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20

As regards of /usr/lib64 tree, I agree with you: it could be useful to create that tree at install time for 64 bit system only. However I'm in doubt about the automatic removal of that link created by doinst.sh. I'll edit the patch, the doinst.sh script and test the new package build, install and remove.

Quote:
Originally Posted by vonbiber View Post
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:

Code:
cp $CWD/cupswrapperHL2030-2.0.1 $PKG/usr/local/Brother/cupswrapper
chmod +x $PKG/usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1
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
This procedure sounds a bit "tricky" to me: I follow you when suggest to create a symbolic link in lib64 only if the system arch is x86_64, but as regards the cupswrapper script renaming... I'm not sure about that. My patch writes a new cupswrapper script and it is executed at build time because it creates PPD and LPD wrapper files...
I'd edit the patch to just create the PPD a LPD wrapper files and I'd just move the lib64 linking in doinst.sh.
I'll update my slackbuild as soon. Thank you for your suggestions.
 
Old 10-28-2016, 10:17 AM   #107
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20
As I suspected, the link created by doinst.sh is not deleted after removepkg uninstall all other files. I tested a new package built following your suggestion about lib64 directory. So the pathced cupwrapper script just creates the needed directories to place PPD and LPD wrapper files in.
You can view the content, test the build, installation and removal with this tarball I uploaded to my dropbox:

https://www.dropbox.com/s/qdwyfnnirj...38.tar.gz?dl=0

@vonbiber
I think your suggestions have been matched almost entirely:
- doinsth.sh creates lib64 link only if it's the case
- I included the final lpadmin touches expanded in doinst.sh, rather than recall a stripped version of cupswrapper script.

Issues:
- when I remove the package with removepkg the link:
Code:
/usr/lib64/cups/filter/brlpdwrapperHL2030 -> /usr/lib/cups/filter/brlpdwrapperHL2030
is not deleted... So we have to remove it by hand. But if the user doesn't know what the doinst.sh really does, likely that link will be left forgotten on the file system. I don't think this is a so clean solution: have you any idea to delete it?

I have one, but let say what do you think about:
- to put that link within the pakage tree
- installpkg will install all files, the above link included without check the system arch
- doinst.sh will have to check what is the system arch, and if it isn't x86_64 it will remove the /usr/lib64 directory.
- if the system arch is 64bit we will have the link copied from the package tree and not created through doinst.sh, so removepkg will identify it and will delete it with all other installed files.
 
Old 10-28-2016, 12:21 PM   #108
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 6,121

Rep: Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814
Can you not extract the needed files from the script during the SlackBuild process? Generally, custom scripts should not be run as part of the build process or in the doinst.sh file. The changes the script would make should be incorporated directly into the build script. If you can do that, then you can just place them in the correct directory all through the SlackBuild, then any symlinks will be caught and removed during makepkg and then added to the doinst.sh file automatically. This should allow removepkg to remove the symlinks as they were added during packaging.

I don't have the ability to inspect these files at work due to blocks (and a lack of extracting utilities since Windows 7 is pretty limited and we can't install software on our computers). So sorry if I'm way off base on my assessment.

As for the directory creation and linking, you can do that with something similar to the below (obviously placing them into appropriate sections of your script):

Code:
# Set libdirsuffix on 64bit machines
if [ "$ARCH" = "x86_64" ]; then
  LIBDIRSUFFIX="64"
else
  LIBDIRSUFFIX=""
fi

# Ensure the proper directory structure is created
mkdir -p /usr/lib${LIBDIRSUFFIX}/cups/filter

# Only need the symlink on Slackware64
if [ "$ARCH" = "x86_64" ]; then
  ln -sf /usr/lib/cups/filter/brlpdwrapperHL2030 /usr/lib${LIBDIRSUFFIX}/cups/filter/
fi
Since 32bit installs will already have the /usr/lib/cups/filter directory, it would only be created on a 64bit computer.

Granted, as long as you aren't intending to submit this SlackBuild to SBo, you can follow whatever conventions you want, but I could see this being beneficial to SBo users, so if that is a desire, you'd need to make sure it doesn't execute any 3rd-party scripts during building or installation.
 
Old 10-28-2016, 12:27 PM   #109
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 470

Original Poster
Rep: Reputation: 105Reputation: 105
Quote:
Originally Posted by joenew View Post

Issues:
- when I remove the package with removepkg the link:
Code:
/usr/lib64/cups/filter/brlpdwrapperHL2030 -> /usr/lib/cups/filter/brlpdwrapperHL2030
is not deleted... So we have to remove it by hand. But if the user doesn't know what the doinst.sh really does, likely that link will be left forgotten on the file system. I don't think this is a so clean solution: have you any idea to delete it?
When the user (root actually) remove the package, all the files and directories deleted are shown in
the console. Sometimes 'removepkg' leave out the files/folders that are newer (such as the ones created
by doinst.sh) but it tells you so.
As for what the doinst.sh does, you can see its contents (after the package was installed) here:
Code:
cat cat /var/log/scripts/brother-hl2030...
where brother-hl2030... is the name of your package (minus the extension .txz)
Quote:
I have one, but let say what do you think about:
- to put that link within the pakage tree
- installpkg will install all files, the above link included without check the system arch
- doinst.sh will have to check what is the system arch, and if it isn't x86_64 it will remove the /usr/lib64 directory.
- if the system arch is 64bit we will have the link copied from the package tree and not created through doinst.sh, so removepkg will identify it and will delete it with all other installed files.
With the options you gave to makepkg
Code:
makepkg -l y -c n /tmp/$NAME-$VERSION-$ARCH-$BUILD$TAG.txz
that link will be deleted (-l y) and makepkg will add an entry in your doinst.sh
to recreate the link at install time.
It seems to me it would be simpler to just remove by hand the files/folders that
removepkg left out.
 
Old 10-29-2016, 09:14 AM   #110
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20
Quote:
Originally Posted by bassmadrigal View Post
Can you not extract the needed files from the script during the SlackBuild process? Generally, custom scripts should not be run as part of the build process or in the doinst.sh file. The changes the script would make should be incorporated directly into the build script. If you can do that, then you can just place them in the correct directory all through the SlackBuild, then any symlinks will be caught and removed during makepkg and then added to the doinst.sh file automatically. This should allow removepkg to remove the symlinks as they were added during packaging.
Thank you for your hints. As suggested also by "vonbiber" the cupswrapper script procedure should be splitted and included directly into the SlackBuild. It should be possible and I think not so tricky to do.

The issue about $ARCH dependent operation could be solved as you explained, at build time. But with such a solution, you can't install the same package on different architecture systems: if your package has been built on a 64bit system, when you try to install it on a 32bit Slackware, installpkg will create a "/usr/lib64/cups/filter" directory containing a useless link "brlpdwrapperHL2030". It shouldn't be a big deal, but I think it isn't a too much clean choice. Moreover, if you have created the package on a 32bit system and an other user tries to install it on a 64bit system, the needed symlink isn't created at all and this would cause a not working driver.

So we have to choose between two options:
  1. Create two different package based on an $ARCH defined var (even if the packages will contains 32bit binaries in any case):
    Code:
    - brother-hl2030-2.1.2-i386-1foo.tar.xz
    - brother-hl2030-2.1.2-x86_64-1foo.tar.xz
  2. Create a "noarch" package that leaves an orphan link (on 64bit systems) when removepkg tries to uninstall it.
I like the first one more, but It is just my opinion. If I well understood Vonbiber prefers the second solution.
And you bassmadrigal? What would the SBo guideline say in this case?
Any other opinion?
 
Old 10-29-2016, 09:39 AM   #111
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 6,121

Rep: Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814
Quote:
Originally Posted by joenew View Post
Thank you for your hints. As suggested also by "vonbiber" the cupswrapper script procedure should be splitted and included directly into the SlackBuild. It should be possible and I think not so tricky to do.

The issue about $ARCH dependent operation could be solved as you explained, at build time. But with such a solution, you can't install the same package on different architecture systems: if your package has been built on a 64bit system, when you try to install it on a 32bit Slackware, installpkg will create a "/usr/lib64/cups/filter" directory containing a useless link "brlpdwrapperHL2030". It shouldn't be a big deal, but I think it isn't a too much clean choice. Moreover, if you have created the package on a 32bit system and an other user tries to install it on a 64bit system, the needed symlink isn't created at all and this would cause a not working driver.

So we have to choose between two options:
  1. Create two different package based on an $ARCH defined var (even if the packages will contains 32bit binaries in any case):
    Code:
    - brother-hl2030-2.1.2-i386-1foo.tar.xz
    - brother-hl2030-2.1.2-x86_64-1foo.tar.xz
  2. Create a "noarch" package that leaves an orphan link (on 64bit systems) when removepkg tries to uninstall it.
I like the first one more, but It is just my opinion. If I well understood Vonbiber prefers the second solution.
And you bassmadrigal? What would the SBo guideline say in this case?
Any other opinion?
I think generally, if there is a possibility of ARCH related files, it is best to have a package for each ARCH, each being created based on the ARCH the SlackBuild was run on. This is the way the SlackBuilds in Slackware work as well as the ones hosted on SBo.
 
Old 10-29-2016, 12:56 PM   #112
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 470

Original Poster
Rep: Reputation: 105Reputation: 105
Quote:
Originally Posted by joenew View Post
[*] Create two different package based on an $ARCH defined var (even if the packages will contains 32bit binaries in any case):
Code:
- brother-hl2030-2.1.2-i386-1foo.tar.xz
- brother-hl2030-2.1.2-x86_64-1foo.tar.xz
You can with the same SlackBuild build 2 packages that target 32-bit and 64-bit systems if, for instance, you add
this at the beginning of your SlackBuild:
Code:
LIBDIRSUFFIX=""
if [ z"$1" == z64 ]; then
  LIBDIRSUFFIX=64
fi
and then you copy the wrapper in /usr/lib$LIBDIRSUFFIX/...' instead of '/usr/lib'

When you invoke the SlackBuild with no argument, a 'brother-...-i386-*.txz' will be produced
and if you run it like
Code:
./brother-HL.....SlackBuild 64
you'll get the package with the /usr/lib64/... path for the wrapper
 
Old 10-30-2016, 07:08 AM   #113
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20
Thank you all for your replies!

I'll prepare a new SlackBuild closer to SBo guidelines and post an update as soon.
Thanks again for your support and suggestions!
 
Old 10-30-2016, 03:19 PM   #114
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20
I edited Slackbuild script and doinst.sh
- patch file has been removed
- cupswrapper script is not executed anymore within the SlackBuild. PPD and LPD wrapper files are now extracted from the cupswrapper "here documents" and written directly by the SlackBuild. It creates the needed dirs and set some files permissions too.
- ARCH dependent symlink is created by the slackbuild in a similar way bassmadrigal suggested few posts above. ARCH is detected automatically so by default the build script creates a package for the current system. Anyway ARCH variable value can be setted frome the command line. I added a README-build file with an example.
- I added makepkg "-p" option to prepend symlink creation commands in doinst.sh so that other final operations (cups restart and printer add) are executed when all needed files are installed.

The printer test seems ok.
I uploaded a new tarball marked "1030": https://www.dropbox.com/s/4hvhtj6jt9...30.tar.gz?dl=0

Comments are welcome!
Bye
 
Old 11-01-2016, 05:15 AM   #115
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 14.2 + Multilib
Posts: 1,483

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
joenew --

This is EXCELLENT work !

I don't have a Brother HL-2030 Printer on my System but that did not matter -- the SlackBuild did the right thing and made a pair of packages( x86_64 and i386 ) for me.

The Package Names are 'Slackware Standard' ( they parse properly with the standard Slackware Package Name Parser ).

The Packages seem to be 'multilib-safe'

My only suggestions would be:

1. add a blurb to the README to let the user know that the SlackBuild will auto-download the necessary Brother.rpm files into `pwd` ... I had to look at the script to find out.
2. I wonder if there is a way to remove the lpadmin command from the doinst.sh script so that installing the Package and setting up the Printer are separate ops ?

And I am not sure about #2 ... it just seems that invoking `lpadmin` to install the printer deserves it's own dedicated script ...

Below is my SlackBuild Session in reverse order.

I Love It !

Your SlackBuild will allow me to build the Package locally on my machine and then distribute the SlackBuild ( and the .rpm sources ) to a Customer's Machine as /usr/src/dld/brother/

Thank you joenew !

-- kjh
#
# the following appendages are in 'reverse order` ...
#
# 5b. Parse the i386 Package Name to check that it parses ( good Package Name Here )
#
Code:
# parsepkg /tmp/brother-hl2030-2.0.1-i386-1hb.txz

Package = brother-hl2030-2.0.1-i386-1hb
Name    = brother-hl2030
Version = 2.0.1
Arch    = i386
Build   = 1
Tag     = hb
Ext     = .txz
#
# 5a. Parse the i386 Package Name to check that it parses ( good Package Name Here )
#
Code:
Package = brother-hl2030-2.0.1-i386-1hb
Name    = brother-hl2030
Version = 2.0.1
Arch    = i386
Build   = 1
Tag     = hb
Ext     = .txz
#
# 4b. what does the i386 install/doinst.sh do ? ( ??? not sure about including the lpadmin command here ??? )
#
Code:
# rm -rf install
# tar -xvf /tmp/brother-hl2030-2.0.1-i386-1hb.txz install

install/
install/slack-desc
install/doinst.sh
#
# cat install/doinst.sh
#
# Setup the new printer and restart cups service
#
port2=`lpinfo -v | grep -i 'usb://Brother/HL-2030' | head -1`
if [ "$port2" = '' ];then
  port2=`lpinfo -v | grep 'usb://' | head -1`
fi
  port=`echo $port2| sed s/direct//g`
if [ "$port" = '' ];then
  port=usb:/dev/usb/lp0
fi
lpadmin -p HL2030 -E -v $port -P /usr/share/cups/model/HL2030.ppd
/etc/rc.d/rc.cups restart
#
# 4a. what does the x86_64 install/doinst.sh do ? ( ??? not sure about including the lpadmin command here ??? )
#
Code:
# tar -xvf /tmp/brother-hl2030-2.0.1-x86_64-1hb.txz install

install/
install/slack-desc
install/doinst.sh

# cat install/doinst.sh

( cd usr/lib64/cups/filter ; rm -rf brlpdwrapperHL2030 )
( cd usr/lib64/cups/filter ; ln -sf /usr/lib/cups/filter/brlpdwrapperHL2030 brlpdwrapperHL2030 )

# Setup the new printer and restart cups service
#
port2=`lpinfo -v | grep -i 'usb://Brother/HL-2030' | head -1`
if [ "$port2" = '' ];then
  port2=`lpinfo -v | grep 'usb://' | head -1`
fi
  port=`echo $port2| sed s/direct//g`
if [ "$port" = '' ];then
  port=usb:/dev/usb/lp0
fi
lpadmin -p HL2030 -E -v $port -P /usr/share/cups/model/HL2030.ppd
/etc/rc.d/rc.cups restart
#
# 3b. what is in the i386 Package ? ( very clean )
#
Code:
# tar -tvf /tmp/brother-hl2030-2.0.1-i386-1hb.txz

drwxr-xr-x root/root         0 2016-11-01 04:52 ./
drwxr-xr-x root/root         0 2016-11-01 04:52 var/
drwxr-xr-x root/root         0 2016-11-01 04:52 var/spool/
drwxr-xr-x lp/lp             0 2016-11-01 04:52 var/spool/lpd/
drwx------ lp/lp             0 2007-04-05 18:31 var/spool/lpd/HL2030/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/bin/
-rwxr-xr-x root/root     20872 2007-04-05 18:31 usr/bin/brprintconflsr2
-rwxr-xr-x root/root       191 2007-04-05 18:31 usr/bin/brprintconfiglpr2
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/local/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/local/Brother/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/local/Brother/cupswrapper/
-rwxr-xr-x root/root     17812 2007-04-10 00:32 usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1
-rwxr-xr-x root/root     14212 2007-04-10 00:32 usr/local/Brother/cupswrapper/brcupsconfig3
drwxrwxrwx root/root         0 2016-11-01 04:52 usr/local/Brother/inf/
-rw-r--r-- root/root       651 2007-04-05 18:31 usr/local/Brother/inf/brHL2030func
-rw-r--r-- root/root       215 2007-04-05 18:31 usr/local/Brother/inf/paperinf
-rw-rw-rw- root/root       165 2007-04-05 18:31 usr/local/Brother/inf/brHL2030rc
-rwxr-xr-x root/root      1623 2007-04-05 18:31 usr/local/Brother/inf/setupPrintcap
-rwxr-xr-x root/root      5604 2007-04-05 18:31 usr/local/Brother/inf/braddprinter
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/local/Brother/lpd/
-rwxr-xr-x root/root      3150 2007-04-05 18:31 usr/local/Brother/lpd/psconvert2
-rwxr-xr-x root/root     15328 2007-04-05 18:31 usr/local/Brother/lpd/rawtobr2
-rwxr-xr-x root/root      7908 2007-04-05 18:31 usr/local/Brother/lpd/filterHL2030
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/local/Brother/filter/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/share/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/share/cups/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/share/cups/model/
-rw-r--r-- root/root     10258 2016-11-01 04:52 usr/share/cups/model/HL2030.ppd
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/doc/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/doc/brother-hl2030-2.0.1/
-rw-r--r-- root/root      3055 2016-11-01 04:52 usr/doc/brother-hl2030-2.0.1/brother-hl2030.SlackBuild
-rw-r--r-- root/root       735 2016-11-01 04:52 usr/doc/brother-hl2030-2.0.1/README-build
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/lib/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/lib/cups/
drwxr-xr-x root/root         0 2016-11-01 04:52 usr/lib/cups/filter/
-rwxr-xr-x root/root      4598 2016-11-01 04:52 usr/lib/cups/filter/brlpdwrapperHL2030
-rwxr-xr-x root/root     45104 2007-04-05 18:31 usr/lib/libbrcomplpr2.so
drwxr-xr-x root/root         0 2016-11-01 04:52 install/
-rw-r--r-- root/root       635 2016-11-01 04:52 install/slack-desc
-rw-r--r-- root/root       370 2016-11-01 04:52 install/doinst.sh
#
# 3a. what is in the x86_64 Package ? ( the contents look multilib-safe to me )
#
Code:
# tar -tvf /tmp/brother-hl2030-2.0.1-x86_64-1hb.txz
drwxr-xr-x root/root         0 2016-11-01 04:28 ./
drwxr-xr-x root/root         0 2016-11-01 04:28 var/
drwxr-xr-x root/root         0 2016-11-01 04:28 var/spool/
drwxr-xr-x lp/lp             0 2016-11-01 04:28 var/spool/lpd/
drwx------ lp/lp             0 2007-04-05 18:31 var/spool/lpd/HL2030/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/bin/
-rwxr-xr-x root/root     20872 2007-04-05 18:31 usr/bin/brprintconflsr2
-rwxr-xr-x root/root       191 2007-04-05 18:31 usr/bin/brprintconfiglpr2
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/local/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/local/Brother/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/local/Brother/cupswrapper/
-rwxr-xr-x root/root     17812 2007-04-10 00:32 usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1
-rwxr-xr-x root/root     14212 2007-04-10 00:32 usr/local/Brother/cupswrapper/brcupsconfig3
drwxrwxrwx root/root         0 2016-11-01 04:28 usr/local/Brother/inf/
-rw-r--r-- root/root       651 2007-04-05 18:31 usr/local/Brother/inf/brHL2030func
-rw-r--r-- root/root       215 2007-04-05 18:31 usr/local/Brother/inf/paperinf
-rw-rw-rw- root/root       165 2007-04-05 18:31 usr/local/Brother/inf/brHL2030rc
-rwxr-xr-x root/root      1623 2007-04-05 18:31 usr/local/Brother/inf/setupPrintcap
-rwxr-xr-x root/root      5604 2007-04-05 18:31 usr/local/Brother/inf/braddprinter
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/local/Brother/lpd/
-rwxr-xr-x root/root      3150 2007-04-05 18:31 usr/local/Brother/lpd/psconvert2
-rwxr-xr-x root/root     15328 2007-04-05 18:31 usr/local/Brother/lpd/rawtobr2
-rwxr-xr-x root/root      7908 2007-04-05 18:31 usr/local/Brother/lpd/filterHL2030
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/local/Brother/filter/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/share/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/share/cups/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/share/cups/model/
-rw-r--r-- root/root     10258 2016-11-01 04:28 usr/share/cups/model/HL2030.ppd
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/doc/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/doc/brother-hl2030-2.0.1/
-rw-r--r-- root/root      3055 2016-11-01 04:28 usr/doc/brother-hl2030-2.0.1/brother-hl2030.SlackBuild
-rw-r--r-- root/root       735 2016-11-01 04:28 usr/doc/brother-hl2030-2.0.1/README-build
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/lib/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/lib/cups/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/lib/cups/filter/
-rwxr-xr-x root/root      4598 2016-11-01 04:28 usr/lib/cups/filter/brlpdwrapperHL2030
-rwxr-xr-x root/root     45104 2007-04-05 18:31 usr/lib/libbrcomplpr2.so
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/lib64/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/lib64/cups/
drwxr-xr-x root/root         0 2016-11-01 04:28 usr/lib64/cups/filter/
drwxr-xr-x root/root         0 2016-11-01 04:28 install/
-rw-r--r-- root/root       635 2016-11-01 04:28 install/slack-desc
-rw-r--r-- root/root       525 2016-11-01 04:28 install/doinst.sh
#
# 2b. build the non-ARCH i386 Package ( nice work: no references to /usr/lib64/ here )
#
Code:
# ARCH=i386 ./brother-hl2030.SlackBuild     

64 blocks
202 blocks

Slackware package maker, version 3.141593.

Searching for symbolic links:

No symbolic links were found, so we won't make an installation script.
You can make your own later in ./install/doinst.sh and rebuild the
package if you like.

This next step is optional - you can set the directories in your package
to some sane permissions. If any of the directories in your package have
special permissions, then DO NOT reset them here!

Would you like to reset all directory permissions to 755 (drwxr-xr-x) and
directory ownerships to root.root ([y]es, [n]o)? n

Creating Slackware package:  /tmp/brother-hl2030-2.0.1-i386-1hb.txz

./
var/
var/spool/
var/spool/lpd/
var/spool/lpd/HL2030/
usr/
usr/bin/
usr/bin/brprintconflsr2
usr/bin/brprintconfiglpr2
usr/local/
usr/local/Brother/
usr/local/Brother/cupswrapper/
usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1
usr/local/Brother/cupswrapper/brcupsconfig3
usr/local/Brother/inf/
usr/local/Brother/inf/brHL2030func
usr/local/Brother/inf/paperinf
usr/local/Brother/inf/brHL2030rc
usr/local/Brother/inf/setupPrintcap
usr/local/Brother/inf/braddprinter
usr/local/Brother/lpd/
usr/local/Brother/lpd/psconvert2
usr/local/Brother/lpd/rawtobr2
usr/local/Brother/lpd/filterHL2030
usr/local/Brother/filter/
usr/share/
usr/share/cups/
usr/share/cups/model/
usr/share/cups/model/HL2030.ppd
usr/doc/
usr/doc/brother-hl2030-2.0.1/
usr/doc/brother-hl2030-2.0.1/brother-hl2030.SlackBuild
usr/doc/brother-hl2030-2.0.1/README-build
usr/lib/
usr/lib/cups/
usr/lib/cups/filter/
usr/lib/cups/filter/brlpdwrapperHL2030
usr/lib/libbrcomplpr2.so
install/
install/slack-desc
install/doinst.sh

Slackware package /tmp/brother-hl2030-2.0.1-i386-1hb.txz created.
#
# 2a. build the default x86_64 Package ( nice ... /usr/lib64/ is included here )
#
Code:
# ./brother-hl2030.SlackBuild
--2016-11-01 04:28:30--  http://download.brother.com/welcome/dlf005837/cupswrapperHL2030-2.0.1-1.i386.rpm
Resolving download.brother.com (download.brother.com)... 23.79.138.206
Connecting to download.brother.com (download.brother.com)|23.79.138.206|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13028 (13K) [application/octet-stream]
Saving to: 'cupswrapperHL2030-2.0.1-1.i386.rpm'

cupswrapperHL2030-2.0.1-1. 100%[========================================>]  12.72K  --.-KB/s    in 0.002s  

2016-11-01 04:28:31 (6.52 MB/s) - 'cupswrapperHL2030-2.0.1-1.i386.rpm' saved [13028/13028]

--2016-11-01 04:28:31--  http://download.brother.com/welcome/dlf005835/brhl2030lpr-2.0.1-1.i386.rpm
Resolving download.brother.com (download.brother.com)... 23.79.138.206
Connecting to download.brother.com (download.brother.com)|23.79.138.206|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35687 (35K) [application/octet-stream]
Saving to: 'brhl2030lpr-2.0.1-1.i386.rpm'

brhl2030lpr-2.0.1-1.i386.r 100%[========================================>]  34.85K  --.-KB/s    in 0.03s   

2016-11-01 04:28:31 (1.32 MB/s) - 'brhl2030lpr-2.0.1-1.i386.rpm' saved [35687/35687]

64 blocks
202 blocks

Slackware package maker, version 3.141593.

Searching for symbolic links:
usr/lib64/cups/filter/brlpdwrapperHL2030        /usr/lib/cups/filter/brlpdwrapperHL2030

Making symbolic link creation script:
( cd usr/lib64/cups/filter ; rm -rf brlpdwrapperHL2030 )
( cd usr/lib64/cups/filter ; ln -sf /usr/lib/cups/filter/brlpdwrapperHL2030 brlpdwrapperHL2030 )

Unless your existing installation script already contains the code
to create these links, you should append these lines to your existing
install script. Now's your chance. :^)

Would you like to add this stuff to the existing install script and
remove the symbolic links ([y]es, [n]o)? y


Removing symbolic links:
removed './usr/lib64/cups/filter/brlpdwrapperHL2030'

Updating your ./install/doinst.sh (prepending symlinks)...

This next step is optional - you can set the directories in your package
to some sane permissions. If any of the directories in your package have
special permissions, then DO NOT reset them here!

Would you like to reset all directory permissions to 755 (drwxr-xr-x) and
directory ownerships to root.root ([y]es, [n]o)? n

Creating Slackware package:  /tmp/brother-hl2030-2.0.1-x86_64-1hb.txz

./
var/
var/spool/
var/spool/lpd/
var/spool/lpd/HL2030/
usr/
usr/bin/
usr/bin/brprintconflsr2
usr/bin/brprintconfiglpr2
usr/local/
usr/local/Brother/
usr/local/Brother/cupswrapper/
usr/local/Brother/cupswrapper/cupswrapperHL2030-2.0.1
usr/local/Brother/cupswrapper/brcupsconfig3
usr/local/Brother/inf/
usr/local/Brother/inf/brHL2030func
usr/local/Brother/inf/paperinf
usr/local/Brother/inf/brHL2030rc
usr/local/Brother/inf/setupPrintcap
usr/local/Brother/inf/braddprinter
usr/local/Brother/lpd/
usr/local/Brother/lpd/psconvert2
usr/local/Brother/lpd/rawtobr2
usr/local/Brother/lpd/filterHL2030
usr/local/Brother/filter/
usr/share/
usr/share/cups/
usr/share/cups/model/
usr/share/cups/model/HL2030.ppd
usr/doc/
usr/doc/brother-hl2030-2.0.1/
usr/doc/brother-hl2030-2.0.1/brother-hl2030.SlackBuild
usr/doc/brother-hl2030-2.0.1/README-build
usr/lib/
usr/lib/cups/
usr/lib/cups/filter/
usr/lib/cups/filter/brlpdwrapperHL2030
usr/lib/libbrcomplpr2.so
usr/lib64/
usr/lib64/cups/
usr/lib64/cups/filter/
install/
install/slack-desc
install/doinst.sh

Slackware package /tmp/brother-hl2030-2.0.1-x86_64-1hb.txz created.
#
# 1. untar joenew's brother-hl2030-1030.tar.gz and check the README
#
Code:
# tar -xvf brother-hl2030-1030.tar.gz

drwxr-xr-x joe/users         0 2016-10-30 14:28 brother-hl2030/
-rwxr-xr-x joe/users      3055 2016-10-30 14:32 brother-hl2030/brother-hl2030.SlackBuild
-rw-r--r-- joe/users       735 2016-10-30 14:32 brother-hl2030/README-build
-rw-r--r-- joe/users       635 2016-10-30 14:32 brother-hl2030/slack-desc
-rw-r--r-- joe/users       370 2016-10-30 14:32 brother-hl2030/doinst.sh

# cat brother-hl2030/README-build

This SlackBuild script makes an architecture dependent package.
If your system is 64bit the following symlink will be created:

/usr/lib64/cups/filter/brlpdwrapperHL2030

to the following file:

/usr/lib/cups/filter/brlpdwrapperHL2030

The build script automatically detects current system arch and
makes a package tailored for current system. Anyway, if you are
building a package for a different arch, you can set ARCH variable
by hand from the command line:

Example:

To force building a i386 package from a 64bit system
----------
# uname -m
x86_64

# ARCH=i386 ./brother-hl2030.SlackBuild

[...]

Slackware package /tmp/brother-hl2030-2.0.1-i386-1hb.txz created.
-----------------------------------------------------------------
 
Old 11-01-2016, 02:53 PM   #116
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20
Thanks for your testing and hints.

1) Ok, I'll append some lines more to README file.
2) Yes we can delete the custom doinst.sh included and move those operations in an other script installed somewhere in the filesystem. The script will be obviously:
Code:
# Setup the new printer and restart cups service
#
port2=`lpinfo -v | grep -i 'usb://Brother/HL-2030' | head -1`
if [ "$port2" = '' ];then
  port2=`lpinfo -v | grep 'usb://' | head -1`
fi
  port=`echo $port2| sed s/direct//g`
if [ "$port" = '' ];then
  port=usb:/dev/usb/lp0
fi
lpadmin -p HL2030 -E -v $port -P /usr/share/cups/model/HL2030.ppd
/etc/rc.d/rc.cups restart
It basically adds the new printer to CUPS managing printer list:
- firstly detects the device "URI" (look at $port variable), so you have to have the printer plugged in and switched on
- then set printer name to "HL2030"
- and configures it to use the right PPD file (previously installed by installpkg).

These operations could be executed by an other script other than the doinst.sh.
Now the question:
Slackware guidelines where would place a script like that?
/usr/bin ???

Last edited by joenew; 11-01-2016 at 02:55 PM.
 
Old 11-01-2016, 03:15 PM   #117
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 14.2 + Multilib
Posts: 1,483

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
joenew --

I don't know for sure but since the lpadmin command is a 'root-only' operation, would it make sense to install in /usr/sbin/ ???

And would it be possible for the user to override the $port and possibly even the Printer Name ( HL2030 ) as well ?

Just thinking out loud here ...

Thanks again.

-- kjh
 
Old 11-01-2016, 04:39 PM   #118
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20
Well If the user wants to change the printer name, it is always possible to manage the device using CUPS web interface (http://localhost:631). That script is what Brother provides to install the printer with a default name. I think "HL2030" is a good self-explaining choice, why the user should choose an other one?

It would be possible to edit that script to pass $PRINTERNAME as commandline argument "PRINTERNAME=$1". But then also an --help option would be needed and more documentation lines appended to README file. I don't see in this case the need to complicate the script: it install the printer in CUPS, aftter that the user can customize the name through the cups web interface.

As regards the $port variable, it isn't a choice, but the output of a detecting command (`lpinfo -v | grep -i 'usb://Brother/HL-2030').
This is the exact name the printer is detected by linux. Look at my system for example (I have a brother HL-2035):
Code:
$lsusb
Bus 001 Device 005: ID 04f9:0027 Brother Industries, Ltd HL-2030 Laser Printer
Code:
# lpinfo -v
direct hp
network ipps
network http
network https
network ipp
direct usb://Brother/HL-2030%20series?serial=L0J245537
network beh
network lpd
network socket
network smb
direct hpfax
If you grep usb://etc/etc
Code:
 lpinfo -v | grep -i 'usb://Brother/HL-2030'
direct usb://Brother/HL-2030%20series?serial=L0J245537
and remove the prepended word "direct", here you will obtain the device URI, needed. That is the printer address linux detects and it has to use it to communicate with the device.
Code:
echo $port2| sed s/direct//g                                
 usb://Brother/HL-2030%20series?serial=L0J245537
 
Old 11-01-2016, 04:42 PM   #119
joenew
Member
 
Registered: Mar 2010
Distribution: slackware 14.2 64bit
Posts: 117

Rep: Reputation: 20
Quote:
Originally Posted by kjhambrick View Post
I don't know for sure but since the lpadmin command is a 'root-only' operation, would it make sense to install in /usr/sbin/ ???
Code:
/usr/sbin
let's wait for other users opinions, even I'm not sure about it...
Thanks to you for all your replies!
 
Old 11-01-2016, 05:07 PM   #120
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 6,121

Rep: Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814Reputation: 3814
Since this will likely be a one-time run (right?), I don't know if it needs to be located within your PATH. Maybe it'd be better to put it in the /usr/share directory (like the mkinitrd_command_generator.sh file is located in /usr/share/mkinitrd/ and has to be called manually). You could put it in /usr/share/brother/hl2030-setup.sh and make it executable. Then just add a quick note in the README to run that after completion if they want to automate their printer setup.

Since I doubt they'd need to run this more than once, it makes sense (to me) that it doesn't need to go into any of the {s}bin directories, but if you do decide to put it there, I'd put it in /usr/sbin/ (assuming everything else is going directly into /usr/ and not /usr/local/).
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] brother printer drivers randyvh Linux - Newbie 5 10-09-2015 06:01 PM
Brother DCP-J4110DW printer-Drivers Nuffield Linux - Newbie 2 02-06-2015 06:59 PM
Drivers for Brother MFC J430 w printer jbander Linux - Hardware 1 07-26-2013 07:44 PM
Unable to install Brother printer drivers siouxzieq Linux - Hardware 8 01-04-2012 04:35 PM
Brother Printer Drivers Site Down Michael Johnson Linux - General 1 07-21-2005 01:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration