File lz11-V2-1.2.dif of Package filters

--- lz11.install
+++ lz11.install	2007-07-17 16:15:57.070252190 +0200
@@ -2,24 +2,24 @@
 export PATH="${PATH}:/sbin:/usr/sbin"
 
 # files to remove
-remove_files="/usr/bin/cZ11-V2 \
-/usr/bin/lz11.kill \
-/usr/bin/lz11.stop \
-/usr/bin/lz11.stopjobs \
-/usr/bin/lz11.uninstall \
-/usr/bin/lz11.testpage \
-/usr/bin/lz11.adjust \
-/usr/bin/lz11.setup \
-/usr/bin/cZ11 \
-/usr/bin/cZ11-bit-300dpi \
-/usr/bin/cZ11-bit-600dpi \
-/usr/bin/cZ11-bitcmyk-300dpi \
-/usr/bin/cZ11-bitcmyk-600dpi \
-/usr/doc/lz11/README \
-/etc/LexmarkZ11/lz11.conf \
-/etc/LexmarkZ11/prolog.prn \
-/etc/LexmarkZ11 \
-/usr/doc/lz11"
+remove_files="${DESTDIR}/usr/bin/cZ11-V2 \
+${DESTDIR}/usr/bin/lz11.kill \
+${DESTDIR}/usr/bin/lz11.stop \
+${DESTDIR}/usr/bin/lz11.stopjobs \
+${DESTDIR}/usr/bin/lz11.uninstall \
+${DESTDIR}/usr/bin/lz11.testpage \
+${DESTDIR}/usr/bin/lz11.adjust \
+${DESTDIR}/usr/bin/lz11.setup \
+${DESTDIR}/usr/bin/cZ11 \
+${DESTDIR}/usr/bin/cZ11-bit-300dpi \
+${DESTDIR}/usr/bin/cZ11-bit-600dpi \
+${DESTDIR}/usr/bin/cZ11-bitcmyk-300dpi \
+${DESTDIR}/usr/bin/cZ11-bitcmyk-600dpi \
+${DESTDIR}/usr/share/doc/packages/lz11/README \
+${DESTDIR}/etc/LexmarkZ11/lz11.conf \
+${DESTDIR}/etc/LexmarkZ11/prolog.prn \
+${DESTDIR}/etc/LexmarkZ11 \
+${DESTDIR}/usr/share/doc/packages/lz11"
 
 
 # the directory the new PPD will go into
@@ -187,11 +187,11 @@ opt/lz11-V2-CancelJob.xml"
   echo
   echo -n "updating Foomatic xml files "
   for j in $dest_dirs ; do
-    rm -f "$j/foomatic/db/source/opt/lz11-v2*"
+    rm -f "${DESTDIR}$j/foomatic/db/source/opt/lz11-v2*"
     for i in $xml_files ; do
       echo -n "."
-      rm -f "$j/foomatic/db/source/$i"
-      install -c -m 644 "./foomatic/$i" "$j/foomatic/db/source/$i"
+      rm -f "${DESTDIR}$j/foomatic/db/source/$i"
+      install -c -m 644 "./foomatic/$i" "${DESTDIR}$j/foomatic/db/source/$i"
     done
   done
   echo " done!"
@@ -312,22 +312,28 @@ function InstallPPD ()
           fi
           cups_ppd_dir="$(cups-config --serverroot)/ppd"
         else
-          default_dir="/usr/share/cups/model"
-          cups_ppd_dir="/etc/cups/ppd"
+          default_dir="${DESTDIR}/usr/share/cups/model"
+          cups_ppd_dir="${DESTDIR}/etc/cups/ppd"
         fi
         FindOlderPPDs "${default_dir}" "${cups_ppd_dir}"
       fi
 
+      if [ -n "$DESTDIR" ] ; then
+	cups_found=1
+	default_dir="${DESTDIR}/usr/share/cups/model"
+	cups_ppd_dir="${DESTDIR}/etc/cups/ppd"
+      fi
+
     else
 
       # look for a ppr installation
       if ( which ppad > /dev/null 2>&1 ) ; then
         echo "examining PPR"
-        if [ -d /usr/share/ppr/PPDFiles ] ; then
-            default_dir="/usr/share/ppr/PPDFiles"
+        if [ -d ${DESTDIR}/usr/share/ppr/PPDFiles ] ; then
+            default_dir="${DESTDIR}/usr/share/ppr/PPDFiles"
             FindOlderPPDs $default_dir
-        elif [ -d /usr/local/share/ppr/PPDFiles ] ; then
-            default_dir="/usr/local/share/ppr/PPDFiles"
+        elif [ -d ${DESTDIR}/usr/local/share/ppr/PPDFiles ] ; then
+            default_dir="${DESTDIR}/usr/local/share/ppr/PPDFiles"
             FindOlderPPDs $default_dir
         elif [ -d /opt/ppr/PPDFiles ] ; then
             default_dir="/opt/ppr/PPDFiles"
@@ -350,9 +356,9 @@ function InstallPPD ()
     if [ -n "${default_dir}" ] ; then
        for new_ppd ; do
          echo "installing ${new_ppd}"
-         install -o "lp" -g "lp" -D -m 644 "${new_ppd}" "${default_dir}/lz11-ppd/${new_ppd}"
+         install -o "lp" -g "lp" -D -m 644 "${new_ppd}" "${default_dir}/Lexmark/${new_ppd}"
        done
-       ppd_install_dirs="${ppd_install_dirs} ${default_dir}/lz11-ppd"
+       ppd_install_dirs="${ppd_install_dirs} ${default_dir}/Lexmark"
     fi
 
   done
@@ -365,7 +371,7 @@ function UpdatePPD ()
 {
   local printer=""
   local install_dir=""
-  if ( which cupsd >/dev/null 2>&1 ) ; then
+  if which cupsd >/dev/null 2>&1 ; then
     if [ -n "${1}" -a -n "${setup_printers}" -a -n "${ppd_install_dirs}" ] ; then
        for install_dir in ${ppd_install_dirs} ; do
           for printer in ${setup_printers} ; do
@@ -571,7 +577,7 @@ function ForceUninstall ()
     return
   fi
 
-  RemoveFiles "$remove_files /usr/bin/lz11.foomatic"
+  RemoveFiles "$remove_files ${DESTDIR}/usr/bin/lz11.foomatic"
 
   # check if gs.orig can be uninstalled
   if ( which gs.orig >/dev/null 2>&1 ) ; then
@@ -680,6 +686,10 @@ function SelectionMenu ()
       echo "***************************************************"
       several_invoked=1
     fi
+    if [ -n "$DESTDIR" ] ; then
+      echo "2) Install (Foomatic/linuxprinting.org)"
+      choices="$choices 2"
+    fi
 
     # is the configuration available
     if ( which lz11.setup >/dev/null 2>&1 ) ; then
@@ -738,12 +748,13 @@ function SelectionMenu ()
 # END OF FUNCTIONS
 ################################################################################
 
-
-who=`whoami`;
-if [ $who != "root" ]; then
-    echo "You need to be root to be able to install lz11."
-    echo "Please log in as root and try again"
-    exit 1
+if [ -z "$DESTDIR" ] ; then
+    who=`whoami`;
+    if [ $who != "root" ]; then
+	echo "You need to be root to be able to install lz11."
+	echo "Please log in as root and try again"
+	exit 1
+    fi
 fi
 
 curdir=`pwd`
@@ -783,7 +794,7 @@ while true ; do
         GS=`which gs 2>/dev/null` || GS=""
         if [ "$GSORIG" != "" ] ; then
           MsgPreviousGS
-        elif [ -x /usr/bin/lz11.foomatic ] ; then
+        elif [ -x ${DESTDIR}/usr/bin/lz11.foomatic ] ; then
           MsgPreviousFoomatic
         elif [ "$GS" = "" ] ; then
           MsgNoGhostScript
@@ -820,20 +831,20 @@ while true ; do
 
             RemoveFiles "$remove_files"
 
-            install -m 755  ./cZ11-V2 /usr/bin/cZ11-V2
-            install -m 755  ./lz11.kill /usr/bin/lz11.kill
-            install -m 755  ./lz11.stop /usr/bin/lz11.stop
-            install -m 755  ./lz11.stopjobs /usr/bin/lz11.stopjobs
-            install -m 755  ./lz11.uninstall /usr/bin/lz11.uninstall
-            install -m 755  ./lz11.testpage /usr/bin/lz11.testpage
-            install -m 755  ./lz11.adjust /usr/bin/lz11.adjust
-            install -m 755  ./cZ11-bit-300dpi /usr/bin/cZ11-bit-300dpi
-            install -m 755  ./cZ11-bit-600dpi /usr/bin/cZ11-bit-600dpi
-            install -m 755  ./cZ11-bitcmyk-300dpi /usr/bin/cZ11-bitcmyk-300dpi
-            install -m 755  ./cZ11-bitcmyk-600dpi /usr/bin/cZ11-bitcmyk-600dpi
-            install -m 755  ./cZ11 /usr/bin/cZ11
+            install -m 755  ./cZ11-V2 ${DESTDIR}/usr/bin/cZ11-V2
+            install -m 755  ./lz11.kill ${DESTDIR}/usr/bin/lz11.kill
+            install -m 755  ./lz11.stop ${DESTDIR}/usr/bin/lz11.stop
+            install -m 755  ./lz11.stopjobs ${DESTDIR}/usr/bin/lz11.stopjobs
+            install -m 755  ./lz11.uninstall ${DESTDIR}/usr/bin/lz11.uninstall
+            install -m 755  ./lz11.testpage ${DESTDIR}/usr/bin/lz11.testpage
+            install -m 755  ./lz11.adjust ${DESTDIR}/usr/bin/lz11.adjust
+            install -m 755  ./cZ11-bit-300dpi ${DESTDIR}/usr/bin/cZ11-bit-300dpi
+            install -m 755  ./cZ11-bit-600dpi ${DESTDIR}/usr/bin/cZ11-bit-600dpi
+            install -m 755  ./cZ11-bitcmyk-300dpi ${DESTDIR}/usr/bin/cZ11-bitcmyk-300dpi
+            install -m 755  ./cZ11-bitcmyk-600dpi ${DESTDIR}/usr/bin/cZ11-bitcmyk-600dpi
+            install -m 755  ./cZ11 ${DESTDIR}/usr/bin/cZ11
 
-            install -m 644 -D ./README /usr/doc/lz11/README
+            install -m 644 -D ./README ${DESTDIR}/usr/share/doc/packages/lz11/README
 
             # if not foomatic then wrap gs
             if [ $INSTALL -eq 1 ] ; then
@@ -842,21 +853,21 @@ while true ; do
                 install -m 755  ./gs "$gspath/gs"
 
                 # install the setup program
-                install -m 755 ./lz11.setup /usr/bin/lz11.setup
-                install -m 644 -D ./lz11.conf /etc/LexmarkZ11/lz11.conf
+                install -m 755 ./lz11.setup ${DESTDIR}/usr/bin/lz11.setup
+                install -m 644 -D ./lz11.conf ${DESTDIR}/etc/LexmarkZ11/lz11.conf
 
             # foomatic installation
             else
                 # install the foomatic wrapper script
-                install -m 755 ./lz11.foomatic /usr/bin/lz11.foomatic
+                install -m 755 ./lz11.foomatic ${DESTDIR}/usr/bin/lz11.foomatic
 
                 # try!! to install the proper PPD file
                 InstallPPD Lexmark-Z11-lz11-V2.ppd Compaq-IJ300-lz11-V2.ppd
 
                 # remind to uninstall again
                 if [ -n "$ppd_install_dirs" ] ; then
-                   echo "rm -rf $ppd_install_dirs" >> /usr/bin/lz11.uninstall
-                   echo "echo removing PPD file" >> /usr/bin/lz11.uninstall
+                   echo "rm -rf $ppd_install_dirs" >> ${DESTDIR}/usr/bin/lz11.uninstall
+                   echo "echo removing PPD file" >> ${DESTDIR}/usr/bin/lz11.uninstall
                 else
                   MsgNoPPDEnvironment
                 fi
@@ -864,8 +875,8 @@ while true ; do
 
 
             # append a coda to the uninstall file
-            echo "echo" >> /usr/bin/lz11.uninstall
-            echo "echo Uninstallation complete" >> /usr/bin/lz11.uninstall
+            echo "echo" >> ${DESTDIR}/usr/bin/lz11.uninstall
+            echo "echo Uninstallation complete" >> ${DESTDIR}/usr/bin/lz11.uninstall
 
             if  ( [ $cups_found == "1" ] && [ -n "$ppd_install_dirs" ] ) ; then
               if [ -x "/etc/init.d/cups" ] ; then
--- lz11.setup
+++ lz11.setup	2007-07-17 15:07:35.727393001 +0200
@@ -1,13 +1,16 @@
 #!/usr/bin/perl
 
+my $DESTDIR = $ENV{'DESTDIR'};
 
-$who=`whoami`;
-chomp $who;
-if ($who ne "root"){
-    die("\nYou need to be root to use this program\n");
+if ( $DESTDIR eq "" ) {
+    $who=`whoami`;
+    chomp $who;
+    if ($who ne "root"){
+	die("\nYou need to be root to use this program\n");
+    }
 }
 
-if ( -x "/usr/bin/lz11.foomatic" ) {
+if ( -x "${DESTDIR}/usr/bin/lz11.foomatic" ) {
     print "\n\n\nYou have installed in the \"Foomatic/linuxprinting.org\" mode.
 Configuring the driver with this tool has no influence then.
 Do your really want to use this tool? (y/n) ";
@@ -18,7 +21,7 @@ Do your really want to use this tool? (y
     }
 }
 
-$config = "/etc/LexmarkZ11/lz11.conf";
+$config = "${DESTDIR}/etc/LexmarkZ11/lz11.conf";
 @defaultpapers=('a4','letter','legal');
 @devices=('cdjcolor','stcolor','epsonc','hpdj');
 @resolutions=('548x548','574x574','582x582','600x600');
--- makefile
+++ makefile	2007-07-17 15:05:40.859095628 +0200
@@ -8,7 +8,7 @@
 # Important compiler and linker options
 CC=gcc
 LD=gcc
-CFLAGS=-O3 -DDEBUG=$(LZ11_DEBUG)
+CFLAGS=$(RPM_OPT_FLAGS) -pipe -DDEBUG=$(LZ11_DEBUG)
 LDFLAGS=
 
 # Required libraries
@@ -24,7 +24,7 @@ MOD=$(SRC:.c=.o)
 	$(CC) -c -Wall $< $(CFLAGS)
 
 # make all
-all: cZ11-V2
+all: cZ11-V2 cZ11
 
 # linking the modules
 cZ11: $(MOD)
@@ -48,8 +48,8 @@ install: all
 	@echo " "
 	@echo "  > ./lz11.install"
 	@echo " "
-	@install -c -m 755 cZ11-V2 /usr/bin/cZ11-V2
-	@install -c -m 755 cZ11 /usr/bin/cZ11
+	@install -c -m 755 cZ11-V2 $(DESTDIR)/usr/bin/cZ11-V2
+	@install -c -m 755 cZ11	   $(DESTDIR)/usr/bin/cZ11
 	@echo "****** Installation successfully finished ********"
 	@echo " "