Re: lpadmin/cups problem
On Wednesday, 31. January 2007, Per Foreby wrote: I'm trying to setup printers during the installation, using $ROOTCMD lpadmin However, since the is no cupsd in the installation environment, lpadmin doesn't have anyone to talk to, and the error message in shell.log is: lpadmin: Unable to connect to server: Connection refused I thougt about adding cupsys to the nfs environment, but cupsd wouldn't create the configuration in the rigth place. What I do now is to create /INSTALL.NEW at the end of the installation, and make that file trigger fai softupdate at the first boot, but it would of course be nice to avoid that extra stage. Has anyone had this problem and solved it? Would it for exampel work if I started cupds at the end of the installation ($ROOTCMD /etc/init.d/cupsys start) Any other suggestions? For my printer server I made a tar of /etc/cups that get's reinstalled. All others nodes just listen what the cups server announces. No need to do anything for them. If you had to add a local printer, I would setup it like: install the /etc/cups/ppd/my-printer.ppd And the section printer my-printer ... /printer from /etc/cups/printers.conf. During install cat my-printer.conf /etc/cups/printers.conf I.e. no need to use lpadmin and have cupsd running ;) Achim /Per -- To me vi is Zen. To use vi is to practice zen. Every command is a koan. Profound to the user, unintelligible to the uninitiated. You discover truth everytime you use it. -- [EMAIL PROTECTED]
Re: lpadmin/cups problem
Per Foreby a écrit : I'm trying to setup printers during the installation, using $ROOTCMD lpadmin What I do now is to create /INSTALL.NEW at the end of the installation, and make that file trigger fai softupdate at the first boot, but it would of course be nice to avoid that extra stage. I found the same problem. What I've been doing is creating an init script to run on the first reboot of the machine, which then finishes the job when CUPS is running. The script then deletes itself when it's finished. Here's an example install script from FAI: #!/bin/sh # # We copy an init script to do the dirty work on reboot, so that we have CUPS # running properly, and so on. It's a dirty hack, but it works. fcopy /etc/rc2.d/S20installprinter And the script in question: #!/bin/sh /usr/sbin/lpadmin -E -plab -DHP Laser Printer -vparallel:/dev/lp0 -P/usr/share/ppd/hpijs/HP/HP-LaserJet_4V-hpijs.ppd /usr/bin/cupsenable lab /usr/sbin/lpadmin -d lab rm /etc/rc2.d/S20installprinter Same strategy works for other things which require a running system to pull off. -Lou
Re: lpadmin/cups problem
On Wed, 31 Jan 2007, Lou Ruppert wrote: Per Foreby a écrit : I'm trying to setup printers during the installation, using $ROOTCMD lpadmin What I do now is to create /INSTALL.NEW at the end of the installation, and make that file trigger fai softupdate at the first boot, but it would of course be nice to avoid that extra stage. I found the same problem. What I've been doing is creating an init script to run on the first reboot of the machine, which then finishes the job when CUPS is running. The script then deletes itself when it's finished. Here's an example install script from FAI: #!/bin/sh # # We copy an init script to do the dirty work on reboot, so that we have CUPS # running properly, and so on. It's a dirty hack, but it works. fcopy /etc/rc2.d/S20installprinter And the script in question: #!/bin/sh /usr/sbin/lpadmin -E -plab -DHP Laser Printer -vparallel:/dev/lp0 -P/usr/share/ppd/hpijs/HP/HP-LaserJet_4V-hpijs.ppd /usr/bin/cupsenable lab /usr/sbin/lpadmin -d lab rm /etc/rc2.d/S20installprinter Same strategy works for other things which require a running system to pull off. Thanks, as you say, on less reboot. I try to use the same config for install and softupdate, but you solutions could easily be tweaked into running the script immediately on a softupdate: fcopy /etc/rc2.d/S20installprinter if [ $FAI_ACTION == softupdate ]; then /etc/rc2.d/S20installprinter fi To those who suggested fcopy/ftar: I try to avoid that approach for configuration files. The reason is maintainability. With fcopy most of the files need to be replaced when upgrading to a new debian version. However, using cfengine, debconf and configuration utilies like lpadmin, most of the local changes survive the upgrade. And I do of course have the same possibility to take advantage of the class hieracy in shell scripts (ifclass CLASS) and cfengine scripts (CLASS::). Cups is an excellent example: The upgrade from sarge to etch (cups 1.1.23 to 1.2.7) is a major cups upgrade, and the config files are probably not portable, but the lpadmin approach is. /Per