Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have bought a Lexmar Impact S305 scanner / printer. There was the small penguin and the word "Linux" among supported systems on the box. The problem is the official drivers are only for Debian based and RPM based distros. I haven't found unofficial drivers.

There is graphic installer. It fails win my distro (Arch Linux), however I've installed it on virtual machine with Mint Debian and the printer works there. I've extracted some files (so, ppd, bin) from installer too.

My question.

What do I need to set up my printer? It looks ppd alone is not enough.


Update 08-03-2011

I've extracted scripts from deb file. There are 3 files: control, postinst (17k) and prerm (4,2k).

# ./postinst 
Executing postin scripts ...
./postinst: line 73: [: ==: unary operator expected
sudo: unknown user: /usr/local/lexmark/legacy/bin/.scripts/demon
sudo: unable to initialize policy plugin

I enter a new shell.

sh-4.2# exit
exit
cp: cannot stat `/usr/local/lexmark/legacy/etc/lxS800.ppd': No such file or directory
cp: cannot stat `/usr/local/lexmark/legacy/etc/lxS800.ppd': No such file or directory

And it is the end.

Update 13-03-2011

The content of line 70-82:

#run device monitor
#TODO: investigate other ways to run daemon
#/bin/sh ${script}
if [ $username == "root" ]; then
    #/bin/sh /usr/local/lexmark/legacy/bin/.scripts/demon
    /bin/sh $script
else
    sudo -u $username /usr/local/lexmark/legacy/bin/.scripts/demon
    if [ $? -ne 0 ]; then
        #/bin/sh /usr/local/lexmark/legacy/bin/.scripts/demon
        /bin/sh $script
    fi
fi;
share|improve this question
    
Where did you find the official drivers? Where they included with a disk that came with the printer? –  Tshepang Mar 7 '11 at 17:49
    
The drivers were on the US version of the official site. –  Michas Mar 7 '11 at 18:29
    
What about line 73? Also, you might wanna try ask.debian.net. They got Debian Developers there, who deeply understand this stuff. –  Tshepang Mar 9 '11 at 6:02

2 Answers 2

It would help if you posted all the scripts involved, but I'll hazard a guess. Those are bash scripts, but they are run by /bin/sh, which is dash and not bash on your system. Change any #!/bin/sh line at the top of the scripts to #!/bin/bash, and change the explicit invocations of /bin/sh into /bin/bash as well.

The immediate source of the error on line 73 is that $username is not set, so the [ command sees the operands == and root (plus the final ]). This is a syntax error. It's impossible to know why the variable isn't set without seeing more of the script.

(Beware that the small extract from the scripts you've included in your post shows that the author doesn't have a lot of experience writing unix shell scripts. From what I've seen elsewhere, this often applies to the rest of the driver. Open-source drivers shipped in Linux distributions tend to be much better quality than manufacturer-provided drivers. Unfortunately, it looks like you have no choice with this model.)

share|improve this answer
    
There is #!/bin/bash in this script. In Arch Linux /bin/sh is symlink to /bin/bash too. –  Michas Mar 14 '11 at 19:51
    
There are 434 lines of code, about 17KB. I can upload it somewhere. However, I am not sure about copyrights. –  Michas Mar 14 '11 at 20:00
    
@Michas: I've just realized that the immediate cause of the error is obvious (see my edited answer). But it's impossible to know why the error occurs without seeing the whole script. Is the driver downloadable on the manufacturer's web site? If so, it's probably acceptable for you to upload an extract in a public location somewhere. –  Gilles Mar 14 '11 at 20:12

Have a look inside the DEB file(s), and navigate into DEBIAN directory. There you'll find out what dpkg would do when installing the package, and try to replicate those steps manually. They are shell scripts.

share|improve this answer
    
I was using deb2targz. It created a tar.gz file without DEBIAN directory. What should I use? –  Michas Mar 7 '11 at 19:03
    
I used file-roller. Note that it's an ar archive, which can be extracted with ar, which comes bundled with binutils on Debian. –  Tshepang Mar 7 '11 at 19:20
    
I've got scripts. However there are a lot of conditional coping of files and editing some other scripts. It would be very hard for me to reverse engineer this. –  Michas Mar 8 '11 at 8:59
    
@mic How many scripts are there? There should be just a few. Are you looking at the right place? When you run ar x on the DEB file, it should expose control.tar.gz which is the file I'm referring to. –  Tshepang Mar 8 '11 at 9:02
    
There are control, postinst (17k) and prerm (4,2k). –  Michas Mar 8 '11 at 18:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.