script problems
I can't seem to get this script working and I'm wondering if anybody willing to lead a hand to fix this script. I found this script on the web, it's suppossed to allow the Lexmark Z35 to work under a Debian based system. Well here it goes,
--- begin --- #!/bin/sh #!/bin/bash PIDOF='which pidof' if [ -z "$PIDOF" ] then PIDOF=/sbin/pidof fi PDIR=/usr/local/lexmark/z25-z35 CONFDIR=`$PDIR/bin/lxgetconf VERIFY` fi ;; esac } #HACK!!!!! #Dumbasses don't know how to create lock files... #They managed to create a 577 lock file and then tried open it O_RDONLY #Can you believe it? umask 002 touch /var/spool/lexmark/Z35Driver/Z35Driver.lck chmod 660 /var/spool/lexmark/Z35Driver/Z35Driver.lck if [ "$LXCOPIES" -gt "1" ] then COPY_COUNT=0 #factored out of loop.. see below image_conversion $LXTMPFILE "$LXRESOLUTION" "$LXDIMENSION" while [ "$COPY_COUNT" -lt "$LXCOPIES" ]; do - LEXPID=/sbin/pidof -s Z35Driver #Wow is this stupid... It's completely irrelevant now.. but it's funny #so I left it in. LEXPID=$PIDOF -s Z35Driver if [ "$LEXPID" != "" ] then sleep 12 fi - $PDIR/Z35Driver $LXBIDIFLAG & - image_conversion $LXTMPFILE "$LXRESOLUTION" "$LXDIMENSION" # This is a RACE CONDITION! HELLO! Good thing they didn't provide # source to the driver.. can't imagine what that code looks like... #Futhermore, this is horrendously inefficient.. Factored out of loop. # $PDIR/Z35Driver $LXBIDIFLAG & # image_conversion $LXTMPFILE "$LXRESOLUTION" "$LXDIMENSION" #Originally, I was going to have the image conversion run in the #background, but it occurred to me that on slow machines, #the driver may starve on input from the converter and b0rk... #I wouldn't put anything past these guys. $PDIR/Z35Driver $LXBIDIFLAG if [ "$?" != "0" ] then let COPY_COUNT=100 done /bin/rm -f $LXTMPFILE else - LEXPID=/sbin/pidof -s Z35Driver - if [ "$LEXPID" != "" ] - then - sleep 12 - fi - $PDIR/Z35Driver $LXBIDIFLAG & #Duh.... I work for Lexmark... My code is 3xtr4 s3kr3t image_conversion $LXTMPFILE "$LXRESOLUTION" "$LXDIMENSION" - /bin/rm -f $LXTMPFILE $PDIR/Z35Driver $LXBIDIFLAG /bin/rm -f $LXTMPFILE fi -LEXPID=/sbin/pidof -s Z35Driver -while [ "$LEXPID" != "" ] -do - usleep 1000 - LEXPID=/sbin/pidof -s Z35Driver -done #clean up after yourselves, for chrissake /bin/rm -f ${INPUT_PIPE} #not needed #LEXPID=$PIDOF -s Z35Driver #while [ "$LEXPID" != "" ] #do # usleep 1000 # LEXPID=$PIDOF -s Z35Driver #done exit 3 --- end --- I get the following error: line 12: syntax error: unexpected token fi ;; I think that's the correct message. Thanks for any help you can give me, Lindows45 |
In just these 5 lines you have a missing case statement and also a missing if statement.
PDIR=/usr/local/lexmark/z25-z35 CONFDIR=`$PDIR/bin/lxgetconf VERIFY` fi ;; esac } You probably got a corrupted file and need to download it again. |
Now I see what happened. http://www.linuxprinting.org/piperma...q3/001103.html
What you got was a patch file and not a script. You need to download the driver from Lexmark. Install the driver then run the patch to make it compatible with debian. But before you install the patch read the next message in that thread because it contains a newer patch. |
The driver is already installed. I thought that the patch replaces the oringinal script by lexmark. This is going to sound really dumb, but how do I run the patch? if it's not a script, what do I do? how do I get this thing working?
Lindows45 |
well it obviously *is* a script - even if what the script is doing is patching another file...
so just make sure it's executable (chmod +x <filename>) then run it... ./<filename> but yeah the code is incredibly messy. perhaps just comb through it to see what it is trying to do and then do it manually? or try to find a different one. |
I have restored the oringinal lexmark script, and took this script and named it lexmarkpatch. I gave the script or patch execute permissions and tried running it. However, it's no avail, it's still spiting out errors. I don't understand anymore, please help me get this darn thing working. Thanks for all the help you have given me so far.
Lindows45 |
It's not a script it just looks like one. It really is a patch (actually a diff file that you use to patch). You don't run a diff file, you use patch to apply it. See man patch for more info.
Go to the link I posted then select the next thread and read it, there is a patch attached to the thread. Select everything between these --k1lZvvs/B4yU6o8G and save it as /path/to/diff-file. Then go to the Lexmark script (/usr/local/lexmark/z25-z35/scripts/) directory and do something like this: patch -p1 < /path/to/diff-file or patch -p0 < /path/to/diff-file |
If you can't get the patch to apply try it from / directory. If nothing works you can apply it manually. Just read it and you can figure out what it's doing. It tells you the file location, then gives you a line number, then some code to help you locate the correct line, then any line with a - is deleted from the file and every line with a + is added to the file. Then you go on to the next file.
|
/bin/bash, you're amazing.... I got this POS to work.
I was able to print a test page using this command: cat filetoprint.foo | /usr/local/lexmark/z25-z35/scripts/LexmarkZ35 - So, my next question is, how do I get OpenOffice and other apps to print to my printer? Can you explain, how to set this up? Lindows45 |
Well I'm glad you got it to print. Now you need to visit www.linuxprinting.org for more info on printing in Linux.
This FAQ addresses the setup of OpenOffice printing. Good-Luck! |
All times are GMT -5. The time now is 08:16 PM. |