--- foo2zjs.orig/hplj1000 2008-06-05 14:02:14 +0400 +++ foo2zjs/hplj1000 2008-12-15 10:41:35 +0300 @@ -24,7 +24,7 @@ esac PROGNAME="$0" - +PROGDIR="`dirname "$0"`" # # Set $DEV to, e.g. /dev/usb/lp0, to force the device you want # Else, leave it null to automatically detect the device @@ -35,7 +35,7 @@ # # Directory to find downloadable HP firmware files sihpMMMM.dl # -FWDIR=/usr/share/foo2zjs/firmware +FWDIR=/var/lib/foo2zjs/firmware # # Program used to determine USB printer id information @@ -77,37 +77,37 @@ MODEL=P1005; FWMODEL=$MODEL USB1=0x03f0 #Vendor USB2=0x3d17 #Model - FWDIR=/usr/share/foo2xqx/firmware + FWDIR=/var/lib/foo2xqx/firmware ;; *P1006) MODEL=P1006; FWMODEL=$MODEL USB1=0x03f0 #Vendor USB2=0x3e17 #Model - FWDIR=/usr/share/foo2xqx/firmware + FWDIR=/var/lib/foo2xqx/firmware ;; *P1007) MODEL=P1007; FWMODEL=P1005 # Alias USB1=0x03f0 #Vendor USB2=0x4817 #Model - FWDIR=/usr/share/foo2xqx/firmware + FWDIR=/var/lib/foo2xqx/firmware ;; *P1008) MODEL=P1008; FWMODEL=P1006 # Alias USB1=0x03f0 #Vendor USB2=0x4917 #Model - FWDIR=/usr/share/foo2xqx/firmware + FWDIR=/var/lib/foo2xqx/firmware ;; *P1505) MODEL=P1505; FWMODEL=$MODEL USB1=0x03f0 #Vendor USB2=0x3f17 #Model - FWDIR=/usr/share/foo2xqx/firmware + FWDIR=/var/lib/foo2xqx/firmware ;; *P1505n) MODEL=P1505n; FWMODEL=$MODEL USB1=0x03f0 #Vendor USB2=0x4017 #Model - FWDIR=/usr/share/foo2xqx/firmware + FWDIR=/var/lib/foo2xqx/firmware ;; *1000) MODEL=1000; FWMODEL=$MODEL @@ -144,16 +144,18 @@ if [ "$USB2" != "" ]; then if [ -w /etc/hotplug/usb.usermap ]; then USERMAP=/etc/hotplug/usb.usermap - elif [ -d /etc/hotplug/usb/ ]; then + elif [ -d /etc/hotplug/usb/ -a -w /etc/hotplug/usb/ ]; then USERMAP=/etc/hotplug/usb/foo2zjs.usermap if [ ! -s $USERMAP ]; then echo > $USERMAP fi + elif [ -d "$PROGDIR" -a -w "$PROGDIR" ]; then + USERMAP="$PROGDIR/foo2zjs.usermap" else log "No /etc/hotplug usermap!" exit fi - chmod 664 $USERMAP + #chmod 664 $USERMAP ex - $USERMAP <<-EOF g/^hplj$MODEL/d \$a @@ -179,8 +181,20 @@ fw="$FWDIR/sihp$FWMODEL.dl" if [ ! -f "$fw" ]; then log "Missing HP LaserJet $MODEL firmware file $fw" - log "...read foo2zjs installation instructions and run ./getweb $MODEL" - return 1 +# Ёлы. Нет прошивки. Смотрим, установлен ли foo2zjs_download_fw. Если да, то пробуем скачать прошивку. + app_fwd="/usr/sbin/foo2zjs_download_fw" + if [ ! -f "$app_fwd" ]; then + log "Firmware not installing. Read foo2zjs installation instructions (/usr/share/doc/foo2zjs-XXXXXXXX/README-UTF8.ALT)" + return 1 + else + log "Yes! foo2zjs_download_fw installed. Try download firmware $MODEL ...." + if $app_fwd $FWMODEL $FWDIR; then + log "Can't download firmware. Read foo2zjs installation instructions (/usr/share/doc/foo2zjs-XXXXXXXX/README-UTF8.ALT)" + return 1 + else + log "Firmware downloding, unpacking and installed" + fi + fi fi log "loading HP LaserJet $MODEL firmware $fw to $_dev ..." @@ -212,7 +226,7 @@ status=`$PRINTERID $dev 2>/dev/null | grep -y "hp LaserJet $MODEL"` if [ "$status" != "" ]; then # This is a LaserJet 100x - chmod 0666 $dev + #chmod 0666 $dev status=`$PRINTERID $dev | grep 'FWVER'` if [ "$status" = "" ]; then # Firmware is not yet loaded