The branch, master has been updated via 3d504f393caf5d3942e22578695f8fcc73ef1409 (commit) from 2a54f6694a95b24c915dfafc04b7a1e9123b94d4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3d504f393caf5d3942e22578695f8fcc73ef1409 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Thu Sep 8 17:36:30 2011 +0200 Major change of code, add comments, syslogging, fix ghostscript call. ----------------------------------------------------------------------- Summary of changes: cups-x2go | 66 ++++++++++++++++++++++++++++++++++++++--------------- cups-x2go.conf | 2 +- debian/changelog | 1 + 3 files changed, 49 insertions(+), 20 deletions(-) The diff of changes is: diff --git a/cups-x2go b/cups-x2go index ab0d1ef..a57cbea 100755 --- a/cups-x2go +++ b/cups-x2go @@ -1,4 +1,4 @@ -!/usr/bin/perl +#!/usr/bin/perl # X2go CUPS backend # Copyright 2009-2011 Obviously Nice @@ -104,19 +104,38 @@ sub printfile if($phost eq $host) { my ($tm,$tm,$uid,$gid,$tm,$tm,$tm,$spooldir)=getpwnam("x2goprint"); - my $spfile="$spooldir/$sess$bname"; + my $spfile="$spooldir/${sess}_$bname"; copy($pfile, $spfile); copy($tfile, "$spfile.title"); chown $uid,$gid,"$spfile"; chown $uid,$gid,"$spfile.title"; - system( "x2goprint $userName $sess $sess$bname $sess$bname.title" ); - # log that we processed a print job - syslog('debug', "x2goprint $userName $sess $bname $bname.title"); + syslog('debug', `ls /var/spool/x2goprint`); + # log that we are about to process a print job + syslog('debug', "x2goprint $userName $sess ${sess}_$bname ${sess}_$bname.title"); + + # process print job + system( "x2goprint $userName $sess ${sess}_$bname ${sess}_$bname.title" ); } else { - system ("scp -i $printdsa $pfile $tfile x2goprint\@$x2goserver:~x2goprint/"); - system( "ssh -i $printdsa x2goprint\@$x2goserver \"sudo x2goprint $userName $sess $bname $bname.title\"" ); + # push spool job to remote X2go server... and launch x2goprint there (with sudo!!!) + + # FIXME: probably the $phost contains the value for the remote x2goserver... + # $x2goserver is read from config, it doesn't make sense here that the + # X2go server is statically taken from the config file, it should be + # taken from the session information hash (i.e. = $phost). + # If that is so, then $phost is not an appropriate var name... + + # PDF file + syslog('debug', "scp -i $printdsa $pfile x2goprint\@$x2goserver:~x2goprint/${sess}_$bname"); + system ("scp -i $printdsa $pfile x2goprint\@$x2goserver:~x2goprint/${sess}_$bname"); + # title file + syslog('debug', "scp -i $printdsa $tfile x2goprint\@$x2goserver:~x2goprint/${sess}_$bname.title"); + system ("scp -i $printdsa $tfile x2goprint\@$x2goserver:~x2goprint/${sess}_$bname.title"); + # run x2goprint on remote X2go server + syslog('debug', "ssh -i $printdsa x2goprint\@$x2goserver \"sudo x2goprint $userName $sess ${sess}_$bname ${sess}_$bname.title\"" ); + system( "ssh -i $printdsa x2goprint\@$x2goserver \"sudo x2goprint $userName $sess ${sess}_$bname ${sess}_$bname.title\"" ); + } } @@ -140,13 +159,13 @@ my $jobID; my $jobTitle; my $copies; my $printOptions; -my $printFile; +my $psFile; -($jobID, $userName, $jobTitle, $copies, $printOptions, $printFile) = @ARGV; -syslog('info', "Print job received from cups -> $jobID $userName $jobTitle $copies $printOptions $printFile"); +($jobID, $userName, $jobTitle, $copies, $printOptions, $psFile) = @ARGV; +syslog('info', "Print job received from cups -> $jobID $userName $jobTitle $copies $printOptions $psFile"); my $tempFile; -if (!$printFile) +if (!$psFile) { my $jid = $jobID; my $uid = $userName; @@ -161,15 +180,24 @@ if (!$printFile) } close OUT; - $printFile = $tempFile; + $psFile = $tempFile; } readconfig(); -$ps2pdf=~s/%s/$printFile/g; -system($ps2pdf); -$printFile="$printFile.pdf"; -my $titleFile="$printFile.title"; +# converting PS file that we retrieved from CUPS into PDF format +$ps2pdf=~s/%s/$psFile/g; +syslog('info', "Converting printjob with command: $ps2pdf\n"); + +# the TMPDIR env var is needed for ghostscript... +$ENV{TMPDIR}="/tmp"; +system("$ps2pdf"); + +# after we have created the PDF from CUPS's PS file, we can drop the PS file +unlink ($psFile); + +my $pdfFile="$psFile.pdf"; +my $titleFile="$pdfFile.title"; open (TITLE,">$titleFile"); print TITLE $jobTitle; close (TITLE); @@ -180,12 +208,12 @@ for(my $i=0; $i<scalar(@sessions);$i++ ) my @sinfo=split("\\|",@sessions[$i]); if(@sinfo[4] eq "R") { - printfile( $printFile, $titleFile, @sinfo[3], @sinfo[1]); - syslog('debug', "Call to printfile function with: $printFile $titleFile @sinfo[3] @sinfo[1]\n"); + syslog('debug', "Call to printfile function with: $pdfFile $titleFile @sinfo[3] @sinfo[1]\n"); + printfile( $pdfFile, $titleFile, @sinfo[3], @sinfo[1]); } } -unlink ($printFile); +unlink ($pdfFile); unlink ($titleFile); # closing syslog diff --git a/cups-x2go.conf b/cups-x2go.conf index 0480381..1b11d56 100644 --- a/cups-x2go.conf +++ b/cups-x2go.conf @@ -12,4 +12,4 @@ #printdsa = /root/.ssh/id_dsa-x2goprint ## command to generate pdf files -#ps2pdf = /usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f "%s" +#ps2pdf = /usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=\"%s.pdf\" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f \"%s\" diff --git a/debian/changelog b/debian/changelog index 8d94388..b4a668a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ cups-x2go (3.0.0.2-0~x2go2) UNRELEASED; urgency=low * Call x2goprint directly with root privileges if x2goserver and CUPS server share the same machine. * Add a proper dpkg-statoverride check in postinst script. + * Major change of code, add comments, syslogging, fix ghostscript call. [ Mario Oroz ] * Add syslog support for cups-x2go. hooks/post-receive -- cups-x2go.git (CUPS Backend for X2go Printing) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "cups-x2go.git" (CUPS Backend for X2go Printing).