Commit 8bddde12 authored by AlmAck's avatar AlmAck

foo2zjs obsolete, removed

parent 25e108aa
Maintainer: Nicola Bignami <nicola@kernel-panic.dnsdojo.net>
Contributor: Muhammed Uluyol <uluyol0@gmail.com>
Date: Wed, 28 Dec 2011 19:30:24
Subject: [PATCH] Firmware destdir support
---
Makefile | 97 ++++++++++----------------------
foo2zjs-loadfw.in | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++
hplj10xx.rules | 59 +++++++-------------
3 files changed, 211 insertions(+), 107 deletions(-)
create mode 100644 foo2zjs-loadfw.in
diff --git a/Makefile b/Makefile
index 8f9bbce..a97b36b 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,6 @@ VERSION=0.0
# Installation prefix...
PREFIX=/usr/local
-PREFIX=/usr
PREFIX=$(DESTDIR)/usr
# Pathnames for this package...
@@ -37,7 +36,7 @@ INSTALL=install
ROOT=root
# Pathnames for referenced packages...
-FOODB=$(DESTDIR)/usr/share/foomatic/db/source
+FOODB=$(PREFIX)/share/foomatic/db/source
# User ID's
LPuid=-oroot
@@ -163,6 +162,7 @@ FILES = \
gipddecode.1in \
hbpldecode.c \
hbpldecode.1in \
+ foo2zjs-loadfw.in \
foo2zjs-wrapper.in \
foo2zjs-wrapper.1in \
foo2hp2600-wrapper.in \
@@ -239,7 +240,7 @@ # CUPS vars
-CUPS_SERVERBIN := $(shell cups-config --serverbin 2>/dev/null)
+CUPS_SERVERBIN := $(DESTDIR)$(shell cups-config --serverbin 2>/dev/null)
-CUPS_DEVEL := $(shell grep cupsSideChannelDoRequest /usr/include/cups/sidechannel.h 2>/dev/null)
+CUPS_DEVEL := $(DESTDIR)$(shell grep cupsSideChannelDoRequest /usr/include/cups/sidechannel.h 2>/dev/null)
-CUPS_GOODAPI := $(shell cups-config --api-version 2>/dev/null | sed "s/1\.[0123].*//")
+CUPS_GOODAPI := $(DESTDIR)$(shell cups-config --api-version | sed "s/1\.[0123].*//" 2>/dev/null)
# hpclj2600n-0.icm km2430_0.icm km2430_1.icm km2430_2.icm samclp300-0.icm
# sihp1000.img sihp1005.img sihp1020.img sihp1018.img
# sihpP1005.img sihpP1006.img sihpP1505.img
@@ -262,7 +262,7 @@ endif
SHELLS= foo2zjs-wrapper foo2oak-wrapper foo2hp2600-wrapper \
foo2xqx-wrapper foo2lava-wrapper foo2qpdl-wrapper \
foo2slx-wrapper foo2hiperc-wrapper
-SHELLS+= foo2zjs-pstops
+SHELLS+= foo2zjs-loadfw foo2zjs-pstops
SHELLS+= printer-profile
MANPAGES= foo2zjs-wrapper.1 foo2zjs.1 zjsdecode.1
MANPAGES+= foo2oak-wrapper.1 foo2oak.1 oakdecode.1
@@ -465,6 +465,11 @@ foo2slx: foo2slx.o $(LIBJBG)
foo2hiperc: foo2hiperc.o $(LIBJBG)
$(CC) $(CFLAGS) -o $@ foo2hiperc.o $(LIBJBG)
+foo2zjs-loadfw: foo2zjs-loadfw.in Makefile
+ [ ! -f $@ ] || chmod +w $@
+ sed < $@.in > $@ \
+ -e 's:@ZJSFWDIR@:$(SHAREZJS)/firmware:' -e 's:@XQXFWDIR@:$(SHAREXQX)/firmware/:' || (rm -f $@ && exit 1)
+ chmod 555 $@
foo2zjs-wrapper: foo2zjs-wrapper.in Makefile
[ ! -f $@ ] || chmod +w $@
@@ -623,6 +628,8 @@ install-test:
UDEVBIN=$(DESTDIR)/bin/
install-prog:
+ [ -d $(BIN) ] || $(INSTALL) -d -m 755 $(BIN)/
+ [ -d $(DESTDIR)/bin/ ] || $(INSTALL) -d -m 755 $(DESTDIR)/bin/
#
# Install driver, wrapper, and development tools
#
@@ -630,7 +637,7 @@ install-prog:
$(INSTALL) -c $(PROGS) $(SHELLS) $(BIN)/
if [ "$(BINPROGS)" != "" ]; then \
$(INSTALL) -d $(UDEVBIN); \
- $(INSTALL) -c $(BINPROGS) $(UDEVBIN); \
+ $(INSTALL) -c $(BINPROGS) $(DESTDIR)/bin/; \
fi
#
# Install gamma correction files. These are just templates,
@@ -683,10 +690,10 @@ install-foo:
#
# Clear foomatic cache and rebuild database if needed
#
- rm -rf /var/cache/foomatic/*/*
- rm -f /var/cache/foomatic/printconf.pickle
- if [ -d /var/cache/foomatic/compiled ]; then \
- cd /var/cache/foomatic/compiled; \
+ rm -rf $(DESTDIR)/var/cache/foomatic/*/*
+ rm -f $(DESTDIR)/var/cache/foomatic/printconf.pickle
+ if [ -d $(DESTDIR)/var/cache/foomatic/compiled ]; then \
+ cd $(DESTDIR)/var/cache/foomatic/compiled; \
foomatic-combo-xml -O >overview.xml; \
fi
@@ -748,7 +755,7 @@ install-extra:
fi; \
done
# foo2zjs Firmware files (if any)
- $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREZJS)/firmware/
+ $(INSTALL) $(LPuid) $(LPgid) -m 755 -d $(SHAREZJS)/firmware/
for i in sihp1*.img; do \
if [ -f $$i ]; then \
base=`basename $$i .img`; \
@@ -757,7 +764,7 @@ install-extra:
fi; \
done
# foo2xqx Firmware files (if any)
- $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREXQX)/firmware/
+ $(INSTALL) $(LPuid) $(LPgid) -m 755 -d $(SHAREXQX)/firmware/
for i in sihpP*.img; do \
if [ -f $$i ]; then \
base=`basename $$i .img`; \
@@ -808,10 +815,10 @@ install-extra:
fi; \
done
-MODEL=$(DESTDIR)/usr/share/cups/model
+MODEL=$(PREFIX)/share/cups/model
-LOCALMODEL=$(DESTDIR)/usr/local/share/cups/model
+LOCALMODEL=$(PREFIX)/usr/local/share/cups/model
MACMODEL=/Library/Printers/PPDs/Contents/Resources
-PPD=$(DESTDIR)/usr/share/ppd
+PPD=$(PREFIX)/share/ppd
VARPPD=/var/lp/ppd
install-ppd:
#
@@ -829,13 +836,6 @@ install-ppd:
done; \
ppdmgr -u; \
elif [ -d $(PPD) ]; then \
- find $(PPD) -name '*foo2zjs*' | xargs rm -rf; \
- find $(PPD) -name '*foo2hp*' | xargs rm -rf; \
- find $(PPD) -name '*foo2xqx*' | xargs rm -rf; \
- find $(PPD) -name '*foo2lava*' | xargs rm -rf; \
- find $(PPD) -name '*foo2qpdl*' | xargs rm -rf; \
- find $(PPD) -name '*foo2slx*' | xargs rm -rf; \
- find $(PPD) -name '*foo2hiperc*' | xargs rm -rf; \
[ -d $(PPD)/foo2zjs ] || mkdir $(PPD)/foo2zjs; \
cd PPD; \
for ppd in *.ppd; do \
@@ -868,9 +868,9 @@ install-ppd:
done; \
fi
-APPL=$(DESTDIR)/usr/share/applications
-OLDAPPL=$(DESTDIR)/usr/share/gnome/apps/System
-PIXMAPS=$(DESTDIR)/usr/share/pixmaps
+APPL=$(PREFIX)/share/applications
+OLDAPPL=$(PREFIX)/share/gnome/apps/System
+PIXMAPS=$(PREFIX)/share/pixmaps
install-desktop:
#
@@ -894,7 +894,7 @@ install-gui:
$(INSTALL) -c -m 755 hplj10xx_gui.tcl $(SHAREZJS)
-USBDIR=/etc/hotplug/usb
+USBDIR=$(DESTDIR)/etc/hotplug/usb
UDEVDIR=/etc/udev/rules.d
LIBUDEVDIR=/lib/udev/rules.d
RULES=hplj10xx.rules
@@ -939,61 +939,22@@ install-hotplug-test:
#
install-hotplug-prog:
- #
- # remove HPLIP (proprietary) files and install our version
- #
- if [ -d $(UDEVDIR) ]; then \
- rm -f $(UDEVDIR)/*hpmud*laserjet_1000*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_1005*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_1018*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_1020*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_p1005*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_p1006*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_p1007*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_p1008*; \
- rm -f $(UDEVDIR)/*hpmud*laserjet_p1505*; \
- rm -f $(UDEVDIR)/*hpmud_support.rules; \
- rm -f $(LIBUDEVDIR)/*-hplj10xx.rules; \
- version=`$(UDEVD) --version 2>/dev/null`; \
- if [ "$$version" = "" ]; then version=0; fi; \
- echo "*** udev version $$version"; \
- if [ "$$version" -lt 148 ]; then \
- $(INSTALL) -c -m 644 $(RULES).old $(UDEVDIR)/11-$(RULES); \
- else \
- $(INSTALL) -c -m 644 $(RULES) $(UDEVDIR)/11-$(RULES); \
- fi \
- fi
+ install -d -m 755 $(DESTDIR)$(UDEVDIR)
+ $(INSTALL) -c -m 644 $(RULES) $(DESTDIR)$(UDEVDIR)/11-$(RULES); \
if [ -d $(DEVDDIR) ]; then \
$(INSTALL) -c -m 644 hplj10xx.conf $(DEVDDIR)/; \
fi
[ -d $(USBDIR) ] || $(INSTALL) -d -m 755 $(USBDIR)/
- $(INSTALL) -c -m 755 hplj1000 $(USBDIR)/
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hplj1005
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hplj1018
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hplj1020
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1005
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1006
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1007
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1008
- ln -sf $(USBDIR)/hplj1000 $(USBDIR)/hpljP1505
- $(USBDIR)/hplj1000 install-usermap
- $(USBDIR)/hplj1005 install-usermap
- $(USBDIR)/hplj1018 install-usermap
- $(USBDIR)/hplj1020 install-usermap
- $(USBDIR)/hpljP1005 install-usermap
- $(USBDIR)/hpljP1006 install-usermap
- $(USBDIR)/hpljP1007 install-usermap
- $(USBDIR)/hpljP1008 install-usermap
- $(USBDIR)/hpljP1505 install-usermap
- # modprobe usblp
- $(USBDIR)/hplj1000 install-usblp
+ $(INSTALL) -d -m 755 $(DESTDIR)/sbin
+ $(INSTALL) -c -m 755 foo2zjs-loadfw $(DESTDIR)/sbin
install-hotplug-osx:
cd osx-hotplug; $(MAKE) PREFIX=$(PREFIX) install-hotplug
install-filter:
if [ "$(CUPS_SERVERBIN)" != "" ]; then \
+ install -d -m 755 $(CUPS_SERVERBIN)/filter; \
- ln -sf $(BIN)/command2foo2lava-pjl $(CUPS_SERVERBIN)/filter/; \
+ ln -sf ../../../bin/command2foo2lava-pjl $(CUPS_SERVERBIN)/filter/; \
fi
CUPSDCONF=/etc/cups/cupsd.conf
diff --git a/foo2zjs-loadfw.in b/foo2zjs-loadfw.in
new file mode 100644
index 0000000..a7e1bfc
--- /dev/null
+++ b/foo2zjs-loadfw.in
@@ -0,0 +1,162 @@
+#!/bin/sh
+
+# foo2zjs-loadfw:
+#
+# Hotplug script for HP1000/1005/1020 USB laser printers. The model number
+# that this script deals with is determined from the udev env.
+#
+# Used to download firmware automatically into the printer when it
+# is powered up or plugged into the USB port.
+#
+# The inspiration fo this script is from:
+# Oscar Santacreu. Alicante-Spain (2002)
+# Mike Morgan (2004)
+# Modified by Stefan Schweizer (2005) to work as a udev-RUN-script
+
+#
+# Directory to find downloadable HP firmware files sihpMMMM.dl
+#
+ZJSFW=@ZJSFWDIR@
+XQXFW=@XQXFWDIR@
+
+#
+# Program used to determine USB id information
+#
+USBID=/bin/usb_printerid
+
+#
+# Timeout to load firmware
+#
+TIMEOUT=6
+
+#
+# Figure out how to log our messages
+#
+if [ -t 1 ]; then
+ # Running from a tty...
+ log() {
+ echo "$0: $@"
+ }
+elif [ -x /usr/bin/logger ]; then
+ # Have logger...
+ log() {
+ logger -t "$0" -- "$@"
+ }
+else
+ # No logger...
+ log() {
+ echo "$0: $@" >> /var/log/messages
+ }
+fi
+
+#
+# Figure out the model number from the name of this script
+#
+case "$1" in
+P1005)
+ MODEL=P1005; FWMODEL=$MODEL
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$XQXFW
+ ;;
+P1006)
+ MODEL=P1006; FWMODEL=$MODEL
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$XQXFW
+ ;;
+P1007)
+ MODEL=P1007; FWMODEL=P1005 # Alias
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$XQXFW
+ ;;
+P1008)
+ MODEL=P1008; FWMODEL=P1006 # Alias
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$XQXFW
+ ;;
+P1505)
+ MODEL=P1505; FWMODEL=$MODEL
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$XQXFW
+ ;;
+P1505n)
+ MODEL=P1505n; FWMODEL=$MODEL
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$XQXFW
+ ;;
+1000)
+ MODEL=1000; FWMODEL=$MODEL
+ MODELNAME="hp LaserJet $MODEL"
+ FWDIR=$ZJSFW
+ ;;
+1005)
+ MODEL=1005; FWMODEL=$MODEL
+ MODELNAME="hp LaserJet $MODEL"
+ FWDIR=$ZJSFW
+ ;;
+1018)
+ MODEL=1018; FWMODEL=$MODEL
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$ZJSFW
+ ;;
+1020)
+ MODEL=1020; FWMODEL=$MODEL
+ MODELNAME="HP LaserJet $MODEL"
+ FWDIR=$ZJSFW
+ ;;
+*)
+ log "Only HP LaserJet 1000, 1005, 1018 and 1020 are supported"
+ log "You need to supply one of these on the cmdline: $0 10**"
+ exit
+ ;;
+esac
+
+if [ -n "$2" ]; then
+ DEVNAME=$2
+elif [ -n "$DEVNAME" ]; then
+ log 'using $DEVNAME'
+else
+ log "You need to either have $DEVNAME set in the environment or supply it on the cmdline, like:"
+ log "$0 10** /dev/usb/lp0"
+ exit 1
+fi
+
+#
+# Procedure to load a single device with firmware
+#
+load1() {
+ 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
+ fi
+
+ log "loading HP LaserJet $MODEL firmware $fw to $DEVNAME ..."
+ if cat $fw > $DEVNAME; then
+ sleep $TIMEOUT
+ log "... download successful."
+ else
+ log "... download failed."
+ fi
+ return 0
+}
+
+#
+# OK, now download firmware to any printers that need it
+#
+if [ -x $USBID ]; then
+ if $USBID $DEVNAME | grep "$MODELNAME" 2> /dev/null; then
+ # This is a LaserJet 100x
+ if $USBID $DEVNAME | grep 'FWVER' 2> /dev/null; then
+ log "HP LaserJet $MODEL firmware already loaded into $DEVNAME"
+ else
+ # Firmware is not yet loaded
+ load1 "$DEVNAME"
+ fi
+ else
+ log "No supported printer found."
+ fi
+else
+ log "HP LaserJet $MODEL firmware was not downloaded..."
+ log "...couldn't find $USBID"
+fi
diff --git a/hplj10xx.rules b/hplj10xx.rules
index ee0295d..b81ff9e 100644
--- a/hplj10xx.rules
+++ b/hplj10xx.rules
@@ -1,39 +1,20 @@
-#
-# hplj10xx.rules.old: udev equal or after 1.30
-#
-#Own udev rule for HP Laserjet 1000
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="hp LaserJet 1000", NAME="usb/%k", \
- SYMLINK+="hplj1000-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1000"
-#Own udev rule for HP Laserjet 1005
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="hp LaserJet 1005 series", NAME="usb/%k", \
- SYMLINK+="hplj1005-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1005"
-#Own udev rule for HP Laserjet 1018
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="HP LaserJet 1018", NAME="usb/%k", \
- SYMLINK+="hplj1018-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1018"
-#Own udev rule for HP Laserjet 1020
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="HP LaserJet 1020", NAME="usb/%k", \
- SYMLINK+="hplj1020-%n", MODE="0666", RUN+="/etc/hotplug/usb/hplj1020"
-#Own udev rule for HP Laserjet P1005
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="HP LaserJet P1005", NAME="usb/%k", \
- SYMLINK+="hpljP1005-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1005"
-#Own udev rule for HP Laserjet P1006
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="HP LaserJet P1006", NAME="usb/%k", \
- SYMLINK+="hpljP1006-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1006"
-#Own udev rule for HP Laserjet P1007
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="HP LaserJet P1007", NAME="usb/%k", \
- SYMLINK+="hpljP1007-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1007"
-#Own udev rule for HP Laserjet P1008
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="HP LaserJet P1008", NAME="usb/%k", \
- SYMLINK+="hpljP1008-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1008"
-#Own udev rule for HP Laserjet P1505
-KERNEL=="lp*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", \
- ATTRS{product}=="HP LaserJet P1505", NAME="usb/%k", \
- SYMLINK+="hpljP1505-%n", MODE="0666", RUN+="/etc/hotplug/usb/hpljP1505"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="0517", RUN+="/sbin/foo2zjs-loadfw 1000 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="1317", RUN+="/sbin/foo2zjs-loadfw 1005 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="4117", RUN+="/sbin/foo2zjs-loadfw 1018 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="2b17", RUN+="/sbin/foo2zjs-loadfw 1020 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="3d17", RUN+="/sbin/foo2zjs-loadfw P1005 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="3e17", RUN+="/sbin/foo2zjs-loadfw P1006 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="4817", RUN+="/sbin/foo2zjs-loadfw P1007 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="4917", RUN+="/sbin/foo2zjs-loadfw P1008 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="3f17", RUN+="/sbin/foo2zjs-loadfw P1505 $tempnode"
+ACTION=="add", KERNEL=="lp*", SUBSYSTEM=="usb", ATTRS{idVendor}=="03f0", \
+ ATTRS{idProduct}=="4017", RUN+="/sbin/foo2zjs-loadfw P1505n $tempnode"
--
1.7.6
Maintainer: Nicola Bignami <nicola@kernel-panic.dnsdojo.net>
Contributor: Muhammed Uluyol <uluyol0@gmail.com>
Subject: [PATCH] Firmware destdir support
---
Makefile | 97 ++++++++++----------------------
foo2zjs-loadfw.in | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++
hplj10xx.rules | 59 +++++++-------------
3 files changed, 211 insertions(+), 107 deletions(-)
create mode 100644 foo2zjs-loadfw.in
diff --git a/Makefile b/Makefile
index 8f9bbce..a97b36b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,6 @@ VERSION=0.0
# Installation prefix...
PREFIX=/usr/local
-PREFIX=/usr
PREFIX=$(DESTDIR)/usr
# Pathnames for this package...
@@ -37,7 +36,7 @@ INSTALL=install
ROOT=root
# Pathnames for referenced packages...
-FOODB=$(DESTDIR)/usr/share/foomatic/db/source
+FOODB=$(PREFIX)/share/foomatic/db/source
# User ID's
LPuid=-oroot
@@ -163,6 +162,7 @@ FILES = \
gipddecode.1in \
hbpldecode.c \
hbpldecode.1in \
+ foo2zjs-loadfw.in \
foo2zjs-wrapper.in \
foo2zjs-wrapper.1in \
foo2hp2600-wrapper.in \
@@ -239,7 +240,7 @@ # CUPS vars
-CUPS_SERVERBIN := $(shell cups-config --serverbin 2>/dev/null)
+CUPS_SERVERBIN := $(DESTDIR)$(shell cups-config --serverbin 2>/dev/null)
-CUPS_DEVEL := $(shell grep cupsSideChannelDoRequest /usr/include/cups/sidechannel.h 2>/dev/null)
+CUPS_DEVEL := $(DESTDIR)$(shell grep cupsSideChannelDoRequest /usr/include/cups/sidechannel.h 2>/dev/null)
-CUPS_GOODAPI := $(shell cups-config --api-version 2>/dev/null | sed "s/1\.[0123].*//")
+CUPS_GOODAPI := $(DESTDIR)$(shell cups-config --api-version | sed "s/1\.[0123].*//" 2>/dev/null)
# hpclj2600n-0.icm km2430_0.icm km2430_1.icm km2430_2.icm samclp300-0.icm
# sihp1000.img sihp1005.img sihp1020.img sihp1018.img
# sihpP1005.img sihpP1006.img sihpP1505.img
@@ -262,7 +262,7 @@ endif
SHELLS= foo2zjs-wrapper foo2oak-wrapper foo2hp2600-wrapper \
foo2xqx-wrapper foo2lava-wrapper foo2qpdl-wrapper \
foo2slx-wrapper foo2hiperc-wrapper
-SHELLS+= foo2zjs-pstops
+SHELLS+= foo2zjs-loadfw foo2zjs-pstops
SHELLS+= printer-profile
MANPAGES= foo2zjs-wrapper.1 foo2zjs.1 zjsdecode.1
MANPAGES+= foo2oak-wrapper.1 foo2oak.1 oakdecode.1
@@ -465,6 +465,11 @@ foo2slx: foo2slx.o $(LIBJBG)
foo2hiperc: foo2hiperc.o $(LIBJBG)
$(CC) $(CFLAGS) -o $@ foo2hiperc.o $(LIBJBG)
+foo2zjs-loadfw: foo2zjs-loadfw.in Makefile
+ [ ! -f $@ ] || chmod +w $@
+ sed < $@.in > $@ \
+ -e 's:@ZJSFWDIR@:$(SHAREZJS)/firmware:' -e 's:@XQXFWDIR@:$(SHAREXQX)/firmware/:' || (rm -f $@ && exit 1)
+ chmod 555 $@
foo2zjs-wrapper: foo2zjs-wrapper.in Makefile
[ ! -f $@ ] || chmod +w $@
@@ -623,6 +628,8 @@ install-test:
UDEVBIN=$(DESTDIR)/bin/
install-prog:
+ [ -d $(BIN) ] || $(INSTALL) -d -m 755 $(BIN)/
+ [ -d $(DESTDIR)/bin/ ] || $(INSTALL) -d -m 755 $(DESTDIR)/bin/
#
# Install driver, wrapper, and development tools
#
@@ -630,7 +637,7 @@ install-prog:
$(INSTALL) -c $(PROGS) $(SHELLS) $(BIN)/
if [ "$(BINPROGS)" != "" ]; then \
$(INSTALL) -d $(UDEVBIN); \
- $(INSTALL) -c $(BINPROGS) $(UDEVBIN); \
+ $(INSTALL) -c $(BINPROGS) $(DESTDIR)/bin/; \
fi
#
# Install gamma correction files. These are just templates,
@@ -683,10 +690,10 @@ install-foo:
#
# Clear foomatic cache and rebuild database if needed
#
- rm -rf /var/cache/foomatic/*/*
- rm -f /var/cache/foomatic/printconf.pickle
- if [ -d /var/cache/foomatic/compiled ]; then \
- cd /var/cache/foomatic/compiled; \
+ rm -rf $(DESTDIR)/var/cache/foomatic/*/*
+ rm -f $(DESTDIR)/var/cache/foomatic/printconf.pickle
+ if [ -d $(DESTDIR)/var/cache/foomatic/compiled ]; then \
+ cd $(DESTDIR)/var/cache/foomatic/compiled; \
foomatic-combo-xml -O >overview.xml; \
fi
@@ -748,7 +755,7 @@ install-extra:
fi; \
done
# foo2zjs Firmware files (if any)
- $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREZJS)/firmware/
+ $(INSTALL) $(LPuid) $(LPgid) -m 755 -d $(SHAREZJS)/firmware/
for i in sihp1*.img; do \
if [ -f $$i ]; then \
base=`basename $$i .img`; \
@@ -757,7 +764,7 @@ install-extra:
fi; \
done
# foo2xqx Firmware files (if any)
- $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREXQX)/firmware/
+ $(INSTALL) $(LPuid) $(LPgid) -m 755 -d $(SHAREXQX)/firmware/
for i in sihpP*.img; do \
if [ -f $$i ]; then \
base=`basename $$i .img`; \
@@ -808,10 +815,10 @@ install-extra:
fi; \
done
-MODEL=$(DESTDIR)/usr/share/cups/model
+MODEL=$(PREFIX)/share/cups/model
-LOCALMODEL=$(DESTDIR)/usr/local/share/cups/model
+LOCALMODEL=$(PREFIX)/usr/local/share/cups/model
MACMODEL=/Library/Printers/PPDs/Contents/Resources
-PPD=$(DESTDIR)/usr/share/ppd
+PPD=$(PREFIX)/share/ppd
VARPPD=/var/lp/ppd
install-ppd:
#
@@ -829,13 +836,6 @@ install-ppd:
done; \
ppdmgr -u; \
elif [ -d $(PPD) ]; then \
- find $(PPD) -name '*foo2zjs*' | xargs rm -rf; \
- find $(PPD) -name '*foo2hp*' | xargs rm -rf; \
- find $(PPD) -name '*foo2xqx*' | xargs rm -rf; \
- find $(PPD) -name '*foo2lava*' | xargs rm -rf; \
- find $(PPD) -name '*foo2qpdl*' | xargs rm -rf; \
- find $(PPD) -name '*foo2slx*' | xargs rm -rf; \
- find $(PPD) -name '*foo2hiperc*' | xargs rm -rf; \
[ -d $(PPD)/foo2zjs ] || mkdir $(PPD)/foo2zjs; \
cd PPD; \
for ppd in *.ppd; do \
@@ -868,9 +868,9 @@ install-ppd:
done; \
fi
-APPL=$(DESTDIR)/usr/share/applications
-OLDAPPL=$(DESTDIR)/usr/share/gnome/apps/System
-PIXMAPS=$(DESTDIR)/usr/share/pixmaps