Index: pykota/branches/1.26_fixes/bin/pksetup
===================================================================
--- pykota/branches/1.26_fixes/bin/pksetup (revision 3412)
+++ pykota/branches/1.26_fixes/bin/pksetup (revision 3494)
@@ -16,5 +16,5 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
@@ -63,5 +63,5 @@
 # IMPORTANT : many more directives can be used, and some of the directives
 # below accept different and/or more complex parameters. Please read
-# /usr/share/pykota/conf/pykota.conf.sample for more details about the 
+# /usr/share/pykota/conf/pykota.conf.sample for more details about the
 # numerous possibilities allowed.
 #
@@ -116,5 +116,5 @@
 onaccountererror : stop
 
-# Who will receive warning messages ? 
+# Who will receive warning messages ?
 # both means admin and user.
 mailto : both
@@ -130,11 +130,11 @@
 poorman : 1.0
 
-# Warning messages to use 
-poorwarn : Your Print Quota account balance is low. 
+# Warning messages to use
+poorwarn : Your Print Quota account balance is low.
  Soon you'll not be allowed to print anymore.
 
 softwarn : Your Print Quota Soft Limit is reached.
  This means that you may still be allowed to print for some
- time, but you must contact your administrator to purchase 
+ time, but you must contact your administrator to purchase
  more print quota.
 
@@ -144,5 +144,5 @@
  as soon as possible to solve the problem.
 
-# Number of banners allowed to be printed by users 
+# Number of banners allowed to be printed by users
 # who are over quota
 maxdenybanners : 0
@@ -175,8 +175,8 @@
     cupsrestart = "/etc/init.d/cupsys restart"  # overload it if needed
     adduser = "adduser --system --group --home /etc/pykota --gecos PyKota pykota" # overload it if needed
-    packages = [ "wget", 
-                 "bzip2", 
-                 "subversion", 
-                 "postgresql", 
+    packages = [ "wget",
+                 "bzip2",
+                 "subversion",
+                 "postgresql",
                  "postgresql-client",
                  "pkpgcounter",
@@ -195,5 +195,5 @@
                  "python-chardet",
                  "python-pam" ]
-        
+
     otherpackages = [ { "name" : "pkipplib",
                         "version" : "0.07",
@@ -204,28 +204,31 @@
                                      ],
                       },
-                      { "name" : "ghostpcl",
-                        "version" : "1.41p1",
-                        "url" : "ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/GhostPCL/%(name)s_%(version)s.tar.bz2", 
-                        "commands" : [ "bunzip2 <%(name)s_%(version)s.tar.bz2 | tar -xf -",
-                                       "cd %(name)s_%(version)s",
+                      { "name" : "ghostpdl",
+                        "version" : "1.54",
+                        "url" : "http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/%(name)s/%(name)s-%(version)s.tar.bz2",
+                        "commands" : [ "bunzip2 <%(name)s-%(version)s.tar.bz2 | tar -xf -",
+                                       "cd %(name)s-%(version)s",
+                                       "wget http://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/GhostPCL/urwfonts-1.41.tar.bz2",
+                                       "bunzip2 <urwfonts-1.41.tar.bz2 | tar -xf -",
+                                       "mv urwfonts-1.41 urwfonts",
                                        "make fonts",
-                                       "make product",
+                                       "make pcl",
                                        "make install",
                                      ],
                       },
-                   ]  
-                   
-    def __init__(self) :               
+                   ]
+
+    def __init__(self) :
         """Initializes instance specific datas."""
         self.launched = []
-        
-    def yesno(self, message) :        
+
+    def yesno(self, message) :
         """Asks the end user some question and returns the answer."""
         try :
             return raw_input("\n%s ? " % message).strip().upper()[0] == 'Y'
-        except IndexError :    
+        except IndexError :
             return False
-        
-    def confirmCommand(self, message, command, record=True) :    
+
+    def confirmCommand(self, message, command, record=True) :
         """Asks for confirmation before a command is launched, and launches it if needed."""
         if self.yesno("The following command will be launched %(message)s :\n%(command)s\nDo you agree" % locals()) :
@@ -236,6 +239,6 @@
         else :
             return False
-            
-    def confirmPipe(self, message, command) :    
+
+    def confirmPipe(self, message, command) :
         """Asks for confirmation before a command is launched in a pipe, launches it if needed, and returns the result."""
         if self.yesno("The following command will be launched %(message)s :\n%(command)s\nDo you agree" % locals()) :
@@ -246,5 +249,5 @@
         else :
             return False
-            
+
     def listPrinters(self) :
         """Returns a list of tuples (queuename, deviceuri) for all existing print queues."""
@@ -258,7 +261,7 @@
             queuename = begin.split()[-1]
             printers.append((queuename, deviceuri))
-        return printers    
-        
-    def downloadOtherPackages(self) :    
+        return printers
+
+    def downloadOtherPackages(self) :
         """Downloads and install additional packages from http://www.pykota.com or other websites"""
         olddirectory = os.getcwd()
@@ -273,23 +276,23 @@
             if url.startswith("svn://") :
                 download = 'svn export "%(url)s" %(name)s' % locals()
-            else :    
+            else :
                 download = 'wget "%(url)s"' % locals()
             if self.confirmCommand("to download %(name)s" % locals(), download) :
                 self.confirmCommand("to install %(name)s" % locals(), commands)
-        self.confirmCommand("to remove the temporary directory %(directory)s" % locals(),     
+        self.confirmCommand("to remove the temporary directory %(directory)s" % locals(),
                             "rm -fr %(directory)s" % locals(),
                             record=False)
-        os.chdir(olddirectory)    
-        
+        os.chdir(olddirectory)
+
     def waitPrintersOnline(self) :
         """Asks the admin to switch all printers ON."""
         while not self.yesno("First you MUST switch ALL your printers ON. Are ALL your printers ON") :
             pass
-            
+
     def setupDatabase(self) :
         """Creates the database."""
         pykotadirectory = self.pykotadirectory
         self.confirmCommand("to create PyKota's database in PostgreSQL", 'su - postgres -c "psql -f %(pykotadirectory)s/postgresql/pykota-postgresql.sql template1"' % locals())
-        
+
     def configurePostgreSQL(self) :
         """Configures PostgreSQL for PyKota to work."""
@@ -306,7 +309,7 @@
                     if answer is not False :
                         tcpip = answer.strip().lower().endswith("true")
-                    else :    
+                    else :
                         tcpip = False
-                    if tcpip :    
+                    if tcpip :
                         conflines.insert(2, "host\tpykota\tpykotaadmin,pykotauser\t127.0.0.1\t255.255.255.255\tmd5")
                     else :
@@ -316,11 +319,11 @@
                     self.confirmCommand("to make PostgreSQL take the changes into account", self.pgrestart)
                     return tcpip
-        return None    
-        
-    def genConfig(self, adminname, adminemail, dnsdomain, smtpserver, home, tcpip) :        
+        return None
+
+    def genConfig(self, adminname, adminemail, dnsdomain, smtpserver, home, tcpip) :
         """Generates minimal configuration files for PyKota."""
         if tcpip :
             storageserver = "localhost"
-        else :    
+        else :
             storageserver = ""
         conf = pykotaconf % locals()
@@ -340,26 +343,26 @@
                     if begin is None :
                         begin = i
-                    else :    
+                    else :
                         end = i
-                        
+
             if (begin is not None) and (end is not None) :
                 suffix = "\n".join(lines[begin+1:end])
                 self.confirmCommand("to improve PyKota's configuration wrt your existing printers", 'echo "%(suffix)s" >>%(home)s/pykota.conf' % locals())
-        
+
     def addPyKotaUser(self) :
         """Adds a system user named pykota, returns its home directory or None"""
         try :
             user = pwd.getpwnam("pykota")
-        except KeyError :    
+        except KeyError :
             if self.confirmCommand("to create a system user named 'pykota'", self.adduser) :
-                try :    
+                try :
                     return pwd.getpwnam("pykota")[5]
-                except KeyError :    
+                except KeyError :
                     return None
-            else :        
+            else :
                 return None
-        else :    
+        else :
             return user[5]
-    
+
     def setupBackend(self) :
         """Installs the cupspykota backend."""
@@ -369,11 +372,11 @@
             self.confirmCommand("to make PyKota known to CUPS", "ln -s %(realbackend)s %(backend)s" % locals())
             self.confirmCommand("to restart CUPS for the changes to take effect", self.cupsrestart)
-        
-    def managePrinters(self, printers) :    
+
+    def managePrinters(self, printers) :
         """For each printer, asks if it should be managed with PyKota or not."""
         for (queuename, deviceuri) in printers :
             command = 'pkprinters --add --cups --description "Printer created with pksetup" "%(queuename)s"' % locals()
             self.confirmCommand("to import the %(queuename)s print queue into PyKota's database and reroute it through PyKota" % locals(), command)
-    
+
     def installPyKotaFiles(self) :
         """Installs PyKota files through Python's Distutils mechanism."""
@@ -383,5 +386,5 @@
         if os.path.exists(setuppy) :
             self.confirmCommand("to install PyKota files on your system", "python %(setuppy)s install" % locals())
-        
+
     def setup(self) :
         """Installation procedure."""
@@ -395,5 +398,5 @@
         if homedirectory is None :
             sys.stderr.write("Installation can't proceed. You MUST create a system user named 'pykota'.\n")
-        else :    
+        else :
             self.upgradeSystem()
             self.setupPackages()
@@ -406,55 +409,55 @@
             print nowready
             print "The script %s can be used to reinstall in unattended mode.\n" % self.genInstaller()
-            
-    def genInstaller(self) :        
+
+    def genInstaller(self) :
         """Generates an installer script."""
         scriptname = "/tmp/pykota-installer.sh"
-        commands = [ "#! /bin/sh", 
+        commands = [ "#! /bin/sh",
                      "#",
-                     "# PyKota installer script.", 
-                     "#", 
+                     "# PyKota installer script.",
+                     "#",
                      "# This script was automatically generated.",
                      "#",
                    ] + self.launched
-        script = open(scriptname, "w")           
+        script = open(scriptname, "w")
         script.write("\n".join(commands))
         script.close()
         os.chmod(scriptname, \
                  stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
-        return scriptname    
-        
-        
-class Debian(PyKotaSetup) :        
+        return scriptname
+
+
+class Debian(PyKotaSetup) :
     """Class for Debian installer."""
-    def setupPackages(self) :    
+    def setupPackages(self) :
         """Installs missing Debian packages."""
         self.confirmCommand("to install missing dependencies", "apt-get install %s" % " ".join(self.packages))
-            
+
     def upgradeSystem(self) :
         """Upgrades the Debian setup."""
         if self.confirmCommand("to grab an up-to-date list of available packages", "apt-get update") :
             self.confirmCommand("to put your system up-to-date", "apt-get -y dist-upgrade")
-    
-class Ubuntu(Debian) :    
+
+class Ubuntu(Debian) :
     """Class for Ubuntu installer."""
     pass
-    
-if __name__ == "__main__" :        
+
+if __name__ == "__main__" :
     retcode = 0
     if (len(sys.argv) != 2) or (sys.argv[1] == "-h") or (sys.argv[1] == "--help") :
         print "pksetup v0.1 (c) 2003-2007 Jerome Alet - alet@librelogiciel.com\n\nusage : pksetup distribution\n\ne.g. : pksetup debian\n\nIMPORTANT : only Debian and Ubuntu are currently supported."
-    elif (sys.argv[1] == "-v") or (sys.argv[1] == "--version") :    
+    elif (sys.argv[1] == "-v") or (sys.argv[1] == "--version") :
         print "0.1" # pksetup's own version number
-    else :    
+    else :
         classname = sys.argv[1].strip().title()
         try :
             installer = globals()[classname]()
-        except KeyError :    
+        except KeyError :
             sys.stderr.write("There's currently no support for the %s distribution, sorry.\n" % sys.argv[1])
             retcode = -1
-        else :    
+        else :
             try :
                 retcode = installer.setup()
-            except KeyboardInterrupt :             
+            except KeyboardInterrupt :
                 sys.stderr.write("\n\n\nWARNING : Setup was aborted at user's request !\n\n")
                 retcode = -1
