LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-02-2004, 07:46 PM   #1
Lindows45
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Rep: Reputation: 0
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
 
Old 03-02-2004, 08:05 PM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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.
 
Old 03-02-2004, 08:24 PM   #3
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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.
 
Old 03-02-2004, 09:21 PM   #4
Lindows45
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Original Poster
Rep: Reputation: 0
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
 
Old 03-02-2004, 09:31 PM   #5
eccles23
Member
 
Registered: Jun 2003
Location: Australia
Distribution: Gentoo/kernel 2.6.2
Posts: 45

Rep: Reputation: 15
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.
 
Old 03-02-2004, 09:46 PM   #6
Lindows45
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Original Poster
Rep: Reputation: 0
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
 
Old 03-02-2004, 11:47 PM   #7
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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

Last edited by /bin/bash; 03-02-2004 at 11:59 PM.
 
Old 03-03-2004, 12:08 AM   #8
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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.
 
Old 03-03-2004, 04:39 PM   #9
Lindows45
LQ Newbie
 
Registered: Feb 2004
Posts: 9

Original Poster
Rep: Reputation: 0
/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
 
Old 03-04-2004, 04:18 PM   #10
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
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!
 
  


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
shell script problems BC1 Linux - General 1 05-02-2005 12:42 AM
Problems with simple script.... jong357 Programming 6 12-20-2004 07:08 AM
Problems with this script homey Programming 9 09-27-2004 11:18 PM
Big problems with script going away.. aggscott Linux - Newbie 4 08-22-2004 07:50 PM
Stupid script problems hayduke Mandriva 4 10-03-2003 10:29 PM


All times are GMT -5. The time now is 11:15 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