[FreeNX-kNX] FreeNX 0.6.0.99 snapshot with full printing support and some bugs fixed

Fabian Franz FabianFranz at gmx.de
Wed Jan 24 22:45:27 UTC 2007


Hi,

So it was a real challenge, but I managed to do it and lots more:

I (re-)implemented full printing support for FreeNX and CUPS v.1.2.x.

It works serverside only with CUPS v1.2.x and no longer with CUPS v.1.1.

For the brave testers:

http://studwww.ira.uka.de/~s_franz2/freenx/freenx-0.6.0.99.tar.gz

If I don't get any complaints and find no new bugs this will be released as 0.6.1 (in a year or so ;-)).

So, now lets look at the ChangeLog and walk through all the new features and how to use them:

        * Fixed the printing support for CUPS 1.2.
          Older versions of CUPS are no longer supported.
          * Note: You might need to do: chmod 755
                  /usr/lib/cups/backend/{ipp, http}

-> This is just in general. While testing I found out that debian set /usr/lib/cups/backend/ipp and http to 700 with no reason whatsforever. I guess this is just a bug and the chmod did fix it for me.

        * Added foomatic support.
          * Note: You might need to do: ln -s /usr/bin/foomatic-ppdfile
                  /usr/lib/cups/driver/

-> Yes, finally there is the full foomatic support, which you might already know from the KDE Printer Wizard. Now NX can use this DB directly as well. However cups needs to be aware of it, so the symlink is necessary and by default FreeNX will search for /usr/lib/cups/driver/foomatic-ppdfile.

        * Added setting of CUPS_SERVER environment var.

-> Now this is great! As of CUPS 1.2, it can use UNIX domain sockets as the servername. So we export this to the session specific port and whereever we are we can always print to it (and other users cannot, because its protected via file system permissions.)

-> But what about those KDE apps? First of all you can just enable ENABLE_KDE_CUPS="1" and are done with it. Second however you can use a more tricky approach if you want to work locally and remote at the same time with the same home directory:

Use the following script and save it as for example /usr/bin/nxcupsd_getsock:

--
#!/bin/sh

if [ -n "$NXSESSIONID" -a -r "$HOME/.nx/C-$NXSESSIONID/cups/cups.sock" ]
then
        echo "$HOME/.nx/C-$NXSESSIONID/cups/cups.sock"
else
        echo "/var/run/cups/cups.sock"
fi
--

make it executable (chmod a+x /usr/bin/nxcupsd_getsock) and add the following entry to your global kdeprintrc:

Host[$e]=$(/usr/bin/nxcupsd_getsock)

This means whenever we are running in an nxsession we will be redirected to the right cupsd, else the system cupsd will be used.

Isn't KDE great?

Future: I was thinking that one could do the same for a "immutable flat profile" to just disable all fancy things if running inside an NX session.

        * Added automatic downloading of PPDs, if the client supports it.

-> This is as seamless as it can get for now. You can choose "Download (CUPS)" as the driver and it tries to directly retrieve the ppds from the remote userspace cupsd and even caches them. You need "curl" in your path for that to function for the moment. (Yes, there might be a config directive in the future, but I forgot.)

        * Added configuration vars to tweak the new behaviour.

-> You don't like CUPS_SERVER being exported? Or foomatic db being searched? Well, just disable it in the config file.
-> And nxloadconfig --check was extended to support all new variables and automatically test them. So if you don't know if yo uare ready for the next generation of printing (TM) just try it with nxloadconfig --check.

        * Added cups seamless support with no "use this driver?" dialogs at all.
          * Note: You need nxcupsd-wrapper on the client side.
                  Get it from nxutils repository.

-> You don't even have to click on "download" anymore. It will without user interaction automatically retrieve and install the ppd files. The trick is to have the ppds available in the ppd directory on the client but with the special suffix _nxdl.ppd. With this method, the local userspace cupsd does not try to load the ppds, but the remote cupsd can still read them.

If you use the nxcupsd-wrapper script, which is also necessary to run the !M client with CUPS 1.2 it will automatically try to download the PPDs. If you don't have this or the script does not work do on the client something like:

$ cd ~/.nx/cups/
$ mkdir ppd
$ cd ppd
$ for i in $(lpstat -p | cut -d" " -f2 ); do wget http://localhost:631/printers/$i.ppd -O ${i}_nxdl.ppd; done

As the ppd directory is not deleted by nxclient, you only have to do this once.

To enable completely seamless mode add $ENABLE_CUPS_SEAMLESS="1" to your config.

        * Fixed Support for "Running" sessions - again.

-> Yes, I am terribly sorry, but this seems to be broken in 0.6.0 with 2.1 backend. However this affects only running sessions. If you suspend them, everything is fine and no zombies to be seen either.

        * Made the NXAgent exited with exit code 1 message more verbose.

-> Yeah, exit 1 status code was a bit well too "spongy". Now it gives detailed instructions on what to do. Thanks for the idea.

If you now run CUPS 1.2 on the client side with NX 2.1.0, cupsd won't start. So we need to wrap it:

http://svn.berlios.de/svnroot/repos/freenx/nx-utils/nxcupsd-wrapper/nxcupsd-wrapper

Download it, put it somewhere in your home directory, chmod a+x nxcupsd-wrapper, and point nxclient to it instead of /usr/sbin/cupsd.

That is all and printing with the !M client even with the normal commercial server should work again.

You can use the wrapper script also for CUPS/1.1 clients as it has an automatic version detection build in. This way all of your linux clients can benefit from the new seamless download support function of the ppds.

So I hope you enjoyed this printing "service pack" and see you next level :-).

cu

Fabian

PS: Feedback needed! This has costed me quite some time, so please give me feedback.



More information about the FreeNX-kNX mailing list