LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 09-06-2016, 06:34 PM   #16
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748

Have you seen this at SlackDocs? http://docs.slackware.com/howtos:har...r_installation
 
2 members found this post helpful.
Old 09-07-2016, 08:05 AM   #17
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Original Poster
Rep: Reputation: 129Reputation: 129
Is your achitecture 32-bit?
I posted a SlackBuild (along the RPMs) here:
http://vonbiber.byethost17.com/slack...uilds/dcp7030/

This might work for 32-bit systems.
But for a 64-bit system these should be dealt with:
usr/bin/brprintconflsr2
and
usr/lib/libbrcomplpr2.so

The command
Code:
file brprintconflsr2
yields:
Code:
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter
/lib/ld-linux.so.2, not stripped
and
Code:
ldd libbrcomplpr2.so
yields
Code:
        linux-gate.so.1 (0xf77a3000)
        libc.so.6 => /lib/libc.so.6 (0xf75ae000)
        /lib/ld-linux.so.2 (0x56617000)
Perhaps, someone out there could come up with some ideas?
 
Old 09-07-2016, 08:41 AM   #18
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
vonbiber --

I am not sure what's the Question.

On a 64-bit system with FULL Multilib, the ELF 32-bit progs should 'just work' ...

Or am I missing something ?

-- kjh
 
Old 09-07-2016, 09:09 AM   #19
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Original Poster
Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by kjhambrick View Post
vonbiber --

On a 64-bit system with FULL Multilib, the ELF 32-bit progs should 'just work' ...

-- kjh
ok, perhaps I could just leave bin/* as is and install
the lib*.so in usr/lib since it's 32-bit library
If someone with that type of printer and a 64-bit system could test it,
we'll know for sure

I removed the restriction for the 64-bit architecture.
I just found an error in my SlackBuilds (this one and the HL-L2300D):
In doinst.sh
Code:
(cd /usr/lib$LIBDIRSUFFIX/filtercd
should be replaced with
Code:
(cd /usr/lib$LIBDIRSUFFIX/cups/filter
I uploaded the amended SlackBuilds
 
Old 09-07-2016, 09:42 AM   #20
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Thanks vonbiber.

Yes, but ...

Since that particular Printer Driver is 32-bit software, LIBDIRSUFFIX should ALWAYS be blank so that the 32-bit 'stuff' lands in /usr/lib/ and not /usr/lib64/

See the code after my sig ...

I also wondered about the following Symlink Command in the doinst.sh code generator.

What I downloaded yesterday:
Code:
ln -s /usr/share/brother/Printers/HLL2300D/cupswrapper/$wrapper
Should it not be ?
Code:
ln -s /usr/share/brother/Printers/HLL2300D/cupswrapper/$wrapper $wrapper
HTH.

-- kjh

This is the original code that sets PARCH and LIBDIRSUFFIX.

Code:
PARCH=i386
LIBDIRSUFFIX=""
if [ $ARCH == "x86_64" ]; then
        PARCH=x86_64
        LIBDIRSUFFIX=64
fi
#
# PARCH will falsely tag the Package as a 64-bit Package on any  x86_64 System
#
PKGNAME=brotherhll2300d-${VERSION}-${PARCH}-${BUILD}$TAG.txz
I changed it to this ...

Code:
FORCE=${FORCE:-0}               # kjh added this to force the build on 64-bit w/out MultiLib
PARCH=i386
LIBDIRSUFFIX=""                 # not used here 
IsMultiLib=0                    # kjh was here
#
# kjh changed this
#
if [ $ARCH == "x86_64" ]
then
   test -f /usr/lib/libcupsfilters.la && IsMultiLib=1 || IsMultiLib=0

   if [ "$IsMultiLib" = "0" ]
   then
      echo "this is a 32-bit only Package.  You will require MultiLib to run on $ARCH" >&2
      [ "$FORCE" = "0" ] && exit 1
   fi
fi

PKGNAME=brotherhll2300d-${VERSION}-${PARCH}-${BUILD}$TAG.txz
 
Old 09-07-2016, 09:47 AM   #21
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748
Quote:
On a 64-bit system with FULL Multilib, the ELF 32-bit progs should 'just work'
Actually, you only need the cups-compat32 package and the glibc-solibs package from our revered Alien_Bob to support the 32-bit Brother printer driver on a 64-bit system. (Choose your Slackware version at http://bear.alienbase.nl/mirrors/people/alien/multilib/ The cups-compat32 package is in the ./slackware64-compat32/ap-compat32 subdirectory)
 
2 members found this post helpful.
Old 09-07-2016, 10:04 AM   #22
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Thanks for the info allend.

I never thought of installing individual multilib / compat32 Packages !

-- kjh
 
Old 09-07-2016, 11:01 AM   #23
offgridguy
Senior Member
 
Registered: Nov 2015
Location: Alberta Canada
Distribution: Windows10, Debian
Posts: 1,109

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by allend View Post
Actually no, I hadn't seen this, it looks very promising. Thank you.
To answer vonbiber, my system is 64 bit.
 
Old 09-07-2016, 12:33 PM   #24
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Original Poster
Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by kjhambrick View Post
Since that particular Printer Driver is 32-bit software, LIBDIRSUFFIX should ALWAYS be blank so that the 32-bit 'stuff' lands in /usr/lib/ and not /usr/lib64/
in the HL-L2300D there's no 32-bit stuff in /usr/lib64,
there's just a symbolic link to a shell script in /usr/lib64/cups/filter

Quote:
Code:
ln -s /usr/share/brother/Printers/HLL2300D/cupswrapper/$wrapper
Should it not be ?
Code:
ln -s /usr/share/brother/Printers/HLL2300D/cupswrapper/$wrapper $wrapper
Both commands have the same effect


Quote:
#
# PARCH will falsely tag the Package as a 64-bit Package on any x86_64 System
#
PKGNAME=brotherhll2300d-${VERSION}-${PARCH}-${BUILD}$TAG.txz
[/code]
The problem is preventing from installing the package if those 32-compat libraries
are missing. Say, someone builds this in a 64-bit environment with the required libraries,
and they want to install the resulting package on another (pure) 64-bit environment.
I was thinking about what's the best way to warn the user...

@allend
Quote:
Actually, you only need the cups-compat32 package and the glibc-solibs package from our revered Alien_Bob to support the 32-bit Brother printer driver on a 64-bit system.
Yes, I mentioned that earlier.
I think I should put a readmefirst.txt or x86_64.txt along with that info
and the warning.

@offgridguy
don't use the SlackBuild yet. There are a few things I need to check first.
 
1 members found this post helpful.
Old 09-07-2016, 04:25 PM   #25
offgridguy
Senior Member
 
Registered: Nov 2015
Location: Alberta Canada
Distribution: Windows10, Debian
Posts: 1,109

Rep: Reputation: 147Reputation: 147
Quote:
@offgridguy
don't use the SlackBuild yet. There are a few things I need to check first.
You bet, actually I am hoping to get microlinux installed on this machine tomorrow and I would like the drivers there as MLED comes with Libre Office.
I actually have 2 separate install of 14.1 on here now, one is earmarked for MLED.
 
Old 09-08-2016, 05:44 AM   #26
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
vonbiber --

Thanks for the info about the ln command !

I was not aware of the 2nd Form ( from the ln man page ).

As you already posted, the link failure was due to the PATH, not the ln command.

And as for preventing a user from building the 32-bit package on a pure 64-bit Slackware Install ...

Maybe all you can do would be to install something like the 'standard' set of SBo Files plus a README.SACKWARE file ?

Thanks again.

-- kjh
 
Old 09-08-2016, 07:02 AM   #27
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Original Poster
Rep: Reputation: 129Reputation: 129
ok, I uploaded a new version of the SlackBuild for the DCP7030 printer:
http://vonbiber.byethost17.com/slack...uilds/dcp7030/

I added a x86_64readme.txt to give the info for running it on
a 64-bit slackware system (I also put the same info in the slack-desc).

Looking at the cupswrapper script in usr/local/Brother/cupswrapper/
I noticed that when invoked it wrote a ppd file and and lpdwrapper
I wrote these directly in the appropriate directories (usr/share...).
I applied awk and sed on that script to produce these files,
and I left usr/local/Brother/cupswrapper/cupswrapper* out of the installation.

Also, in order not to mislead, the package name resulting is *x86*.txz
(and no $LIBDIRSUFFIX).

Let me know if you see any error, or something I forgot to add.
Thanks
 
1 members found this post helpful.
Old 09-08-2016, 07:21 AM   #28
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Original Poster
Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by kjhambrick View Post
vonbiber --
Maybe all you can do would be to install something like the 'standard' set of SBo Files plus a README.SACKWARE file ?
-- kjh
I was considering including the 3 libraries from ALIENbob but then thought it would
be better to warn the user in the slack-desc and to remove the misleading $LIBDIRSUFFIX or
x86_64 in the name of the package
So I commented out this passage
Code:
PARCH=i386
LIBDIRSUFFIX=""
#if [ $ARCH == "x86_64" ]; then
#       PARCH=x86_64
#       LIBDIRSUFFIX=64
#fi

PKGNAME=brotherhll2300d-${VERSION}-${PARCH}-${BUILD}$TAG.txz
I just posted the new version.
 
Old 09-08-2016, 07:42 AM   #29
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Thanks vonbiber.

The 7030 package built but not having that printer, I didn't install it.

I pounded out the clear statement in the SlackBuild so I could see the output ( below )

One thing I noticed yesterday when I used allend's suggestion to try the rpm2tgz command ( http://docs.slackware.com/howtos:har...r_installation ) is that the permissions on var/spool/lpd/DCP7030/ may be incorrect ( 644 ) ... see below for directory and file listings.

If these perms are incorrect, maybe needs a doinst.sh or maybe fix the perms ( ??? and owner ??? ) on the extracted directory, before running makepkg ?

Looks pretty good to me and thanks again !

-- kjh

# this is the output from the SlackBuild
#
# sh brotherdcp7030.SlackBuild
Code:
extracting files from /home/dld/Brother/vonbiber-Brother-7030-SlackBuild/cupswrapperDCP7030-2.0.2-1.i386.rpm ...
71 blocks
... done
extracting files from /home/dld/Brother/vonbiber-Brother-7030-SlackBuild/brdcp7030lpr-2.0.2-1.i386.rpm ...
243 blocks
... done

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:  /home/dld/Brother/vonbiber-Brother-7030-SlackBuild/brotherdcp7030-2.0.2-1-i386-1_vbi.txz

./
var/
var/spool/
var/spool/lpd/
var/spool/lpd/DCP7030/
usr/
usr/bin/
usr/bin/brprintconflsr2
usr/bin/brprintconfiglpr2
usr/share/
usr/share/Brother/
usr/share/Brother/cupswrapper/
usr/share/Brother/cupswrapper/brcupsconfig3
usr/share/Brother/inf/
usr/share/Brother/inf/brDCP7030rc
usr/share/Brother/inf/paperinf
usr/share/Brother/inf/setupPrintcap
usr/share/Brother/inf/brDCP7030func
usr/share/Brother/inf/braddprinter
usr/share/Brother/lpd/
usr/share/Brother/lpd/psconvert2
usr/share/Brother/lpd/filterDCP7030
usr/share/Brother/lpd/rawtobr2
usr/share/cups/
usr/share/cups/model/
usr/share/cups/model/DCP7030.ppd
usr/doc/
usr/doc/brotherdcp7030/
usr/doc/brotherdcp7030/SlackBuild/
usr/doc/brotherdcp7030/SlackBuild/brotherdcp7030.SlackBuild
usr/doc/brotherdcp7030/SlackBuild/readme.txt
usr/lib/
usr/lib/cups/
usr/lib/cups/filter/
usr/lib/cups/filter/brlpdwrapperDCP7030
usr/lib/libbrcomplpr2.so
install/
install/slack-desc

Slackware package /home/dld/Brother/vonbiber-Brother-7030-SlackBuild/brotherdcp7030-2.0.2-1-i386-1_vbi.txz created.

dcp_7030 (driver for the Brother DCP-7030 printer)

This package contains the lpr printer driver and
the CUPS wrapper for the Brother DCP-7030 laser printer.
Note that the binaries here are 32-bit. If you want to run this
on a 64-bit slackware system, you need to install at least these
packages (from Alien Bob): cups-compat32*, cups-filters-compat32*,
and glibc-solibs*.

http://support.brother.com/g/b/

package brotherdcp7030-2.0.2-1-i386-1_vbi.txz successfully created in /home/dld/Brother/vonbiber-Brother-7030-SlackBuild
#
# extract brotherdcp7030-2.0.2-1-i386-1_vbi.txz for inspection ...
#
Code:
# mkdir tmp
# cd tmp
# tar -xvf  ../brotherdcp7030-2.0.2-1-i386-1_vbi.txz
#
# these are the perms on the directories in brotherdcp7030-2.0.2-1-i386-1_vbi.txz ( note the last one ~/DCP7030/ )
#
Code:
# ls -lad $(find . -type d)

drwxr-xr-x 5 root root 4096 Sep  8 07:19 ./
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./install/
drwxr-xr-x 6 root root 4096 Sep  8 07:19 ./usr/
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./usr/bin/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./usr/doc/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./usr/doc/brotherdcp7030/
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./usr/doc/brotherdcp7030/SlackBuild/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./usr/lib/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./usr/lib/cups/
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./usr/lib/cups/filter/
drwxr-xr-x 4 root root 4096 Sep  8 07:19 ./usr/share/
drwxr-xr-x 5 root root 4096 Sep  8 07:19 ./usr/share/Brother/
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./usr/share/Brother/cupswrapper/
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./usr/share/Brother/inf/
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./usr/share/Brother/lpd/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./usr/share/cups/
drwxr-xr-x 2 root root 4096 Sep  8 07:19 ./usr/share/cups/model/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./var/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./var/spool/
drwxr-xr-x 3 root root 4096 Sep  8 07:19 ./var/spool/lpd/
drw-r--r-- 2 root root 4096 Sep  8 07:19 ./var/spool/lpd/DCP7030/
#
# these are the perms on the Files in brotherdcp7030-2.0.2-1-i386-1_vbi.txz ( look good )
#
Code:
# ls -lad $(find . -type f)

-rw-r--r-- 1 root root  1076 Sep  8 07:19 ./install/slack-desc
-rwxr-xr-x 1 root root   191 Sep  8 07:19 ./usr/bin/brprintconfiglpr2
-rwxr-xr-x 1 root root 26313 Sep  8 07:19 ./usr/bin/brprintconflsr2
-rw-r--r-- 1 root root  4738 Sep  8 07:19 ./usr/doc/brotherdcp7030/SlackBuild/brotherdcp7030.SlackBuild
-rw-r--r-- 1 root root   424 Sep  8 07:19 ./usr/doc/brotherdcp7030/SlackBuild/readme.txt
-rwxr-xr-x 1 root root  4579 Sep  8 07:19 ./usr/lib/cups/filter/brlpdwrapperDCP7030
-rwxr-xr-x 1 root root 53606 Sep  8 07:19 ./usr/lib/libbrcomplpr2.so
-rwxr-xr-x 1 root root 17552 Sep  8 07:19 ./usr/share/Brother/cupswrapper/brcupsconfig3
-rw-r--r-- 1 root root   652 Sep  8 07:19 ./usr/share/Brother/inf/brDCP7030func
-rw-r--r-- 1 root root   166 Sep  8 07:19 ./usr/share/Brother/inf/brDCP7030rc
-rwxr-xr-x 1 root root  7976 Sep  8 07:19 ./usr/share/Brother/inf/braddprinter
-rw-r--r-- 1 root root   215 Sep  8 07:19 ./usr/share/Brother/inf/paperinf
-rwxr-xr-x 1 root root  1623 Sep  8 07:19 ./usr/share/Brother/inf/setupPrintcap
-rwxr-xr-x 1 root root  7909 Sep  8 07:19 ./usr/share/Brother/lpd/filterDCP7030
-rwxr-xr-x 1 root root  3150 Sep  8 07:19 ./usr/share/Brother/lpd/psconvert2
-rwxr-xr-x 1 root root 20186 Sep  8 07:19 ./usr/share/Brother/lpd/rawtobr2
-rwxr-xr-x 1 root root 10265 Sep  8 07:19 ./usr/share/cups/model/DCP7030.ppd
 
Old 09-08-2016, 09:16 AM   #30
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
vonbiber --

Just noticed one thing.

The Package Names have an extra '-' char in the VERSION.

This causes the 'standard' Slackware Package Name Parser to fail.

One way to fix it is to add a tr command to translate '-' to '.' or '_' after you extract the VERSION from the rpm file name:

Code:
VERSION="$(echo $VERSION |tr '-' '.')"     # translate '-' to '.'
#
# or
#
VERSION="$(echo $VERSION |tr '-' '_')"     # translate '-' to '_'
This way, the Package File Name will parse using the std SlackWare Rules ( found all over the place ).

-- kjh

# original Package FileName with an extra '-' in VERSION, parsepkg fails:

Code:
# parsepkg vonbiber-Brother-7030-SlackBuild/brotherdcp7030-2.0.2-1-i386-1_vbi.txz

  Package = brotherdcp7030-2.0.2-1-i386-1_vbi
  Name    = brotherdcp7030-2.0.2
  Version = 1
  Arch    = i386
  Build   = 1
  Tag     = _vbi
  Ext     = .txz
# 'fixed' VERSION with '-' translated to '.' ...

Code:
# parsepkg vonbiber-Brother-7030-SlackBuild/brotherdcp7030-2.0.2.1-i386-1_vbi.txz

  Package = brotherdcp7030-2.0.2.1-i386-1_vbi
  Name    = brotherdcp7030
  Version = 2.0.2.1
  Arch    = i386
  Build   = 1
  Tag     = _vbi
  Ext     = .txz
#
# this is my parsepkg script if you want it ...
#
# save as parsepkg ( or invoke with -v flag ) and the output will include each Slackware Package FileName Component
# save as any other name ( or make a hard link ) and the output will only include the Program Name ( and optional Prefix ; Suffix )
#
Code:
#!/bin/sh

PrgNam="`basename $0`"
DirNam="`dirname  $0`"

if [ "$DirNam" = "." ]
then
   if [ -f "$PrgNam" ]
   then
      DirNam="`pwd`"
   else
      DirNam="`whichone $PrgNam`"
      DirNam="`dirname $DirNam`"
   fi
elif [ "$DirNam" = ".." ]
then
   DirNam="`pwd`"
   DirNam="`dirname $DirNam`"
elif [ "`dirname $DirNam`" = ".." ]
then
   FooNam="`basename $DirNam`"
   DirNam="`pwd -P`"
   DirNam="`dirname $DirNam`/$FooNam"
elif [ "$DirNam" = "" ]               # should not happen ...
then                                  # see: man 3 dirname
   DirNam="`whichone $PrgNam`"
   DirNam="`dirname $DirNam`"
fi

AllArg="$@"
CwdDir="`pwd -P`"

File=""
DoSuffix="0"
DoPrefix="0"
Verbose=0

WacExt ()
{
   echo "$@" |
   gawk '
   {
      if (( L = length( $0 )) < 1 )
      {
         print ""
         exit 0
      }
      for ( i = L ; i > 0 ; i -- )
      {
         if (( substr( $0, i,   1 ) == "." ) \
         &&  ( substr( $0, i-1, 1 ) != "/" ))
         {
            print substr( $0, 1, i-1 )
            exit 0
         }
      }
      print $0
      exit 0
   }'
   return $?
}
GetExt ()
{
   GetExtCase=""

   while [ "$1" = "-l" \
        -o "$1" = "-L" \
        -o "$1" = "-u" \
        -o "$1" = "-U" ]
   do
      if [ "$1" = "-l" -o "$1" = "-L" ]
      then
         GetExtCase="l"
         shift
      elif [ "$1" = "-u" -o "$1" = "-U" ]
      then
         GetExtCase="u"
         shift
      fi
   done

   echo "$@" |
   gawk '
   BEGIN {

      Case = "'"$GetExtCase"'" ""

   }
   function FixCase( DoCase, InStr )
   {
      if ( DoCase == "l" )
      {
         return( tolower( InStr ))
      }
      if ( DoCase == "u" )
      {
         return( toupper( InStr ))
      }
      return( InStr )
   }
   # main
   {
      if (( L = length( $0 )) < 1 )
      {
         print ""
         exit 0
      }
      for ( i = L ; i > 0 ; i -- )
      {
         if (( substr( $0, i,   1 ) == "." ) \
         &&  ( substr( $0, i-1, 1 ) != "/" ))
         {
            print FixCase( Case, substr( $0, i ))
            exit 0
         }
      }
      print ""
      exit 0
   }'
   return $?
}
Usage ()
{
   ErrNum=$1
   shift

   [ $# -gt 0 ] && echo -e "\n$*" >&2

   echo -e "\nusage:  $PrgNam [ -foo ] " >&2
   cat  <<Usage_EOF >&2

No help text here !

        boo
        hoo
        hoo ...
 
Usage_EOF
 
   exit $ErrNum

}
while  getopts vhlspf: junk 2>/dev/null
do
   case $junk in
      f)    File="$OPTARG"
            ;;
      p)    DoPrefix=1
            ;;
      s)    DoSuffix=1
            ;;
      l)    DoPrefix=1
            DoSuffix=1
            ;;
      v)    Verbose=1
            ;;
      h)    Usage 0
            ;;
      *)    Usage 1
            ;;
   esac
done

shift `expr $OPTIND - 1`

FileList="$@"

[ "$File" != "" ] && FileList="$FileList $(cat $File)"

[ "$FileList" = "" ] && echo "usage:  $PrgNam [ -f ListFile ] [ File [ File ... ]]" >&2 && exit 1

for PkgFile in $FileList
do
   echo $PkgFile
done |
gawk '
BEGIN {

   PrgNam   = "'"$PrgNam"'"    ""
   DirNam   = "'"$DirNam"'"    ""

   Verbose  = "'"$Verbose"'"   +0

   DoPrefix = "'"$DoPrefix"'"  +0
   DoSuffix = "'"$DoSuffix"'"  +0
   RetCode  = 0

   DoProps  = (( Verbose == 1 ) || ( PrgNam == "parsepkg" )) ? 1 : 0

   Prefix = ( DoPrefix == 1 ) ? " " : ""
   Suffix = ( DoSuffix == 1 ) ? "-" : ""
}
function BaseName( InStr,       N, FooAry )
{
   N = split( InStr, FooAry, "/" ) 

   if ( N < 2 )
      return( InStr )
  
   return( FooAry [N] )
}
function WacExt( InStr,       i )
{
   # returns FileName sans LAST dot-extent

   if ( InStr == "" )
   {
      return ( InStr )
   }
   for ( i = length( InStr ) ; i > 0 ; i-- )
   {
      if ( substr( InStr, i, 1 ) == "." )
      {
         if ( i > 1 )
            return( substr( InStr, 1, i-1 ))
         else
            return( InStr )
      }
   }
   return( InStr )
}
function GetExt( InStr,       i )
{
   # returns LAST dot-extent

   if ( InStr == "" )
      return ( InStr )

   for ( i = length( InStr ) ; i > 0 ; i-- )
   {
      if ( substr( InStr, i, 1 ) == "." )
      {
         if ( i > 1 )
            return( substr( InStr, i ))
         else
            return( "" )
      }
   }
   return( "" )
}
# main
{
   Pkg = BaseName( $NF )
   Ext = GetExt( Pkg )

   if ( match( Ext, /t.*z$/ ))
   {
      Pkg = WacExt( Pkg )
   }
   else
   {
      Ext = ""
   }
   N   = split( Pkg, FooAry, "-" )

   Build = FooAry[ N-- ]
   Arch  = FooAry[ N-- ]
   Ver   = FooAry[ N-- ]
   Tag   = ""

   Name  = Sep = ""

   for ( i = 1 ; i <= N ; i ++ )
   {
      Name = Name Sep FooAry[ i ]
      Sep  = "-"
   }
   if ( match( Build, /^[0-9][0-9]*/ ))
   {
      Tag   = substr( Build, RLENGTH + 1 )
      Build = substr( Build, RSTART, RLENGTH )
   }
   if ( DoProps == 1 )
   {
      print "Package = " Pkg
      print "Name    = " Name
      print "Version = " Ver
      print "Arch    = " Arch
      print "Build   = " Build
      print "Tag     = " Tag

      if ( Ext != "" )
      {
         print "Ext     = " Ext
      }
      print ""
   }
   else
   {
      print Prefix Name Suffix
   }
}'
 
  


Reply



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 03:55 PM.

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
Open Source Consulting | Domain Registration