Building Samba Printing Packages | ||
---|---|---|
Prev |
Now that most of the options have been described, it is time to show some examples of how packages can be constructed. These examples will proceed from easy demonstrations where no override options are needed to examples where override options are required due to mkprintpkg.pl being unable to infer one of the pieces of information described in the previous section.
The first example is to build a package for the HP 4050 printer that will provide files for both Windows 95/98 and Windows NT. As such, the first step was to go to www.hp.com and download two driver distributions. The files in question are lj582en.exe and lj586en.exe. Both are self-extracting zip files and there will be no need to unpack them into temporary directories before invoking mkprintpkg.pl. We now need to decide upon the name and version for this Samba printing package. Since the package will be for HP 4050 printers, it makes sense to choose "hp4050" as the package name and 1.00 for the version number. We can now invoke mkprintpkg.pl as follows:
$ mkprintpkg.pl --name="hp4050" --version=1.00 --display-name="HP 4050" lj582en.exe lj586en.exe Package: hp4050-1.00.tar.gz Display Name: HP 4050 Using archive lj582en.exe for files. Using file hpbfdf1.inf for INF information. Architecture: Windows NT X86 (detected from INF) Manufacturer: HP (detected from INF) Model: HP LaserJet 4050 Series PCL 6 (detected from INF) Using archive lj586en.exe for files. Using file HP4050P6.INF for INF information. Architecture: Windows 95/98 (detected from INF) Manufacturer: HP (detected from INF) Model: HP LaserJet 4050 Series PCL 6 (detected from INF) $ |
As you can see from this example, the architecture, INF file, manufacturer, and model were all detected from the archives without any intervention by the user. The resulting output for the package is the file hp4050-1.00.tar.gz. This file can be placed on a Samba printing package retrieval server or moved to a machine with Samba for final installation.
The second example is bit more advanced since it will require two override options because two pieces of information will not be inferred by mkprintpkg.pl. We will build a printing package containing the Windows 95/98 drivers for a Canon BJC-1000 printer. In preparation, the self-extracting ZIP file BJV631.EXE was downloaded from the Canon Web site. The name of the package will be "bjc1000" and the version number will be 0.0.1. The display name will be "Canon BJC-1000". For a first try, we can just try invoking mkprintpkg.pl in a similar manner to what we did for the HP 4050 drivers:
$ mkprintpkg.pl --name="bjc1000" --version=0.0.1 --display-name "BJC 1000" BJV631.EXE Package: bjc1000-0.0.1.tar.gz Display Name: BJC 1000 Using archive BJV631.EXE for files. ERROR: Unable to infer which INF file to use. ERROR: Use the -i option with one of the following files: BJUSBPRN.INF CJOEM95.INF $ |
However, you will notice that this first try did not work since there was more than one INF file. The CJOEM95.INF has a name that sounds like it is the main INF file so we will try specifying that file using the -i override option. All override options must be in front of the archive or temporary directory that they apply to. We can now try a second attempt at building the Canon BJC-1000 package:
$ mkprintpkg.pl --name="bjc1000" --version=0.0.1 --display-name "BJC 1000" -i CJOEM95.INF BJV631.EXE Package: bjc1000-0.0.1.tar.gz Display Name: BJC 1000 Using archive BJV631.EXE for files. Architecture: Windows 95/98 (detected from INF) Manufacturer: Canon (detected from INF) ERROR: Unable to infer which model to use. ERROR: Use the -d option to specify one of the following:. "Canon BJC-6000" "Canon BJC-6100" "Canon BJC-8000" "Canon BJC-6200" "Canon BJC-8200" "Canon BJC-8500" "Canon BJC-85" "Canon BJC-1000" "Canon BJC-7000 Series" "Canon BJC-2000" "Canon BJC-2100" "Canon LR1" "Canon BJC-3000" $ |
This second attempt to build the package has failed because the INF file contains more than one model name under the "Canon" manufacturer heading. Since we want to build a printing package for the BJC-1000 printer, it makes sense to use the "Canon BJC-1000" string in the override option. Thus, we come to the third successful try:
$ mkprintpkg.pl --name="bjc1000" --version=0.0.1 --display-name "BJC 1000" -i CJOEM95.INF -d "Canon BJC-1000" BJV631.EXE Package: bjc1000-0.0.1.tar.gz Display Name: BJC 1000 Using archive BJV631.EXE for files. Architecture: Windows 95/98 (detected from INF) Manufacturer: Canon (detected from INF) Model: Canon BJC-1000 $ |
Both of the previous two examples have only dealt with creating packages from vendor archives. For this next example, it will be instructive to actually unpack a vendor archive into its own temporary directory before invoking mkprintpkg.pl. For this example, we will again use the printer drivers downloaded for the HP 4050. When unpacking the archive, you should first obtain a list of files in it to see how it will unpack:
$ unzip -l lj582en.exe Archive: lj582en.exe Length Date Time Name -------- ---- ---- ---- 45056 11-17-99 16:38 hpbafd32.dll 10512 11-17-99 16:38 hpbfdf0.dll 94480 11-17-99 16:38 hpbfdf1.dll 51685 11-17-99 16:38 hpbfdf1.hlp 2688 11-17-99 16:38 hpbfdf1.inf 909072 11-17-99 16:38 hpbfdf2.dll 736528 11-17-99 16:38 hpbfdf3.dll 279824 11-17-99 16:38 hpbfdf5.dll 68873 11-17-99 16:38 hpbfdf5.pmd 152336 11-17-99 16:38 hpbfdf6.dll 99328 11-17-99 16:38 hpbftm32.dll 58368 12-04-98 17:49 hpdcmon.dll 6020 10-07-96 15:53 HPLicEN.txt 459264 11-17-99 16:38 mtl70um.dll -------- ------- 2974034 14 files $ |
From this file listing, we can see that all of the files will unpack into a single subdirectory. This is the situation that we want since mkprintpkg.pl expects all of the files from the vendor archive to be in the same directory. As we will see later, some vendor's archives have subdirectories. There is no common naming convention so it is easier to require that you, the package builder, unpack the vendor archives into a common subdirectory then have code to try and guess which subdirectory a particular file is stored in. Next, we will make a temporary subdirectory and unpack the files there. mkprintpkg.pl can then be invoked with the temporary directory instead of an archive name and the Samba printing package will still be created as in the first example.
$ mkdir /tmp/unpacked-archive $ unzip lj582en.exe -d /tmp/unpacked-archive/ Archive: lj582en.exe inflating: /tmp/unpacked-archive/hpbafd32.dll inflating: /tmp/unpacked-archive/hpbfdf0.dll inflating: /tmp/unpacked-archive/hpbfdf1.dll inflating: /tmp/unpacked-archive/hpbfdf1.hlp inflating: /tmp/unpacked-archive/hpbfdf1.inf inflating: /tmp/unpacked-archive/hpbfdf2.dll inflating: /tmp/unpacked-archive/hpbfdf3.dll inflating: /tmp/unpacked-archive/hpbfdf5.dll inflating: /tmp/unpacked-archive/hpbfdf5.pmd inflating: /tmp/unpacked-archive/hpbfdf6.dll inflating: /tmp/unpacked-archive/hpbftm32.dll inflating: /tmp/unpacked-archive/hpdcmon.dll inflating: /tmp/unpacked-archive/HPLicEN.txt inflating: /tmp/unpacked-archive/mtl70um.dll $ mkprintpkg.pl --name="hp4050" --version=1.00 --display-name="HP 4050" /tmp/unpacked-archive lj586en.exe Package: hp4050-1.00.tar.gz Display Name: HP 4050 Location: /tmp/unpacked-archive Using file hpbfdf1.inf for INF information. Architecture: Windows NT X86 (detected from INF) Manufacturer: HP (detected from INF) Model: HP LaserJet 4050 Series PCL 6 (detected from INF) Using archive lj586en.exe for files. Using file HP4050P6.INF for INF information. Architecture: Windows 95/98 (detected from INF) Manufacturer: HP (detected from INF) Model: HP LaserJet 4050 Series PCL 6 (detected from INF) $ |
As you can see, we can combine both an unpacked work directory and an archive into the same command and end up with the same result as just passing both archives.
The next example will provide a case where the vendor archive does not unpack neatly into a single directory. If we examine the lj586en.exe self-extracting ZIP file from the previous example, we obtain the following list of files:
[tdyas@lexicon driver-downloads]$ unzip -l lj586en.exe Archive: lj586en.exe Length Date Time Name -------- ---- ---- ---- 0 07-13-99 11:21 DISK1/ 4956 05-06-99 10:20 DISK1/HP4050P6.INF 4469 12-16-98 10:34 DISK1/HPBPST.HL_ 60105 12-16-98 10:58 DISK1/HPBST16.DL_ 31000 12-04-98 18:28 DISK1/HPDCMON.DL_ 19634 09-15-98 15:17 DISK1/HPEXPAND.DL_ 13812 12-04-98 18:31 DISK1/HPNRA.EX_ 12268 11-24-98 17:01 DISK1/HPSETUP.HL_ 15069 12-04-98 18:31 DISK1/HPTDPI.TD_ 29372 12-04-98 18:30 DISK1/HPTDS.DL_ 33867 03-29-99 14:22 DISK1/HPUNINST.EX_ 5876 12-24-98 15:04 DISK1/LICENSE.TXT 63616 12-11-98 19:16 DISK1/READ4050.WRI 531 07-13-99 11:22 DISK1/README.PER 195 09-15-98 15:17 DISK1/RUNONCE.ST_ 126976 09-15-98 15:17 DISK1/SETUP.EXE 664 07-13-99 11:11 DISK1/SETUP.LST 6194 07-13-99 11:11 DISK1/SETUP.STT 57344 03-29-99 14:22 DISK1/SETUPRES.DLL 179978 04-13-99 20:06 DISK1/SETUPUI.DL_ 926 09-15-98 15:17 DISK1/UNINSTAL.ST_ 1519 06-04-99 16:53 DISK1/UNINSTAL.UN_ 14823 07-13-99 11:22 DISK1/XLDRIVER.PER 552042 01-12-99 14:50 DISK1/_SETUP32.DL_ 0 07-13-99 11:21 DISK3/ 10286 05-06-99 10:11 DISK3/HP4050P6.CAT 7498 06-04-99 10:16 DISK3/HPBAFD16.DL_ 23075 06-04-99 10:16 DISK3/HPBFAB.DD_ 943 06-04-99 10:16 DISK3/HPBFAB16.DL_ 11228 06-04-99 10:16 DISK3/HPBFAB32.DL_ 769683 06-04-99 10:16 DISK3/HPBFDB1.DR_ 37341 06-04-99 10:16 DISK3/HPBFDB1.HL_ 48802 06-04-99 10:16 DISK3/HPBFDB2.DL_ 14671 06-04-99 10:16 DISK3/HPBFDB5.PM_ 879 06-04-99 10:16 DISK3/HPBFTM16.DL_ 61212 06-04-99 10:16 DISK3/HPBFTM32.DL_ -------- ------- 2220854 36 files $ |
As you can see, all of the files are stored in two subdirectories called DISK1 and DISK3. We must make sure that the files end up in a single directory with no subdirectories before the unpacked work directory is passed to mkprintpkg.pl. The first method for unpacking into a single directory uses the special -j option of the unzip utility. The -j option forces the unzip utility to unpack everything into a single subdirectory. It is used as follows:
$ mkdir /tmp/unpacked-archive $ unzip -j lj586en.exe -d /tmp/unpacked-archive/ Archive: lj586en.exe inflating: /tmp/unpacked-archive/HP4050P6.INF inflating: /tmp/unpacked-archive/HPBPST.HL_ inflating: /tmp/unpacked-archive/HPBST16.DL_ inflating: /tmp/unpacked-archive/HPDCMON.DL_ inflating: /tmp/unpacked-archive/HPEXPAND.DL_ inflating: /tmp/unpacked-archive/HPNRA.EX_ inflating: /tmp/unpacked-archive/HPSETUP.HL_ inflating: /tmp/unpacked-archive/HPTDPI.TD_ inflating: /tmp/unpacked-archive/HPTDS.DL_ inflating: /tmp/unpacked-archive/HPUNINST.EX_ inflating: /tmp/unpacked-archive/LICENSE.TXT inflating: /tmp/unpacked-archive/READ4050.WRI inflating: /tmp/unpacked-archive/README.PER extracting: /tmp/unpacked-archive/RUNONCE.ST_ inflating: /tmp/unpacked-archive/SETUP.EXE inflating: /tmp/unpacked-archive/SETUP.LST inflating: /tmp/unpacked-archive/SETUP.STT inflating: /tmp/unpacked-archive/SETUPRES.DLL inflating: /tmp/unpacked-archive/SETUPUI.DL_ inflating: /tmp/unpacked-archive/UNINSTAL.ST_ inflating: /tmp/unpacked-archive/UNINSTAL.UN_ inflating: /tmp/unpacked-archive/XLDRIVER.PER inflating: /tmp/unpacked-archive/_SETUP32.DL_ inflating: /tmp/unpacked-archive/HP4050P6.CAT inflating: /tmp/unpacked-archive/HPBAFD16.DL_ inflating: /tmp/unpacked-archive/HPBFAB.DD_ inflating: /tmp/unpacked-archive/HPBFAB16.DL_ inflating: /tmp/unpacked-archive/HPBFAB32.DL_ inflating: /tmp/unpacked-archive/HPBFDB1.DR_ inflating: /tmp/unpacked-archive/HPBFDB1.HL_ inflating: /tmp/unpacked-archive/HPBFDB2.DL_ inflating: /tmp/unpacked-archive/HPBFDB5.PM_ inflating: /tmp/unpacked-archive/HPBFTM16.DL_ inflating: /tmp/unpacked-archive/HPBFTM32.DL_ |
As you can see, the -j option has unpacked everything into a single subdirectory. A second method for moving all the files into a single subdirectory is to just use standard shell commands to move each file. For example, the following sequence of commands could have been used to move the files into place:
$ mkdir /tmp/unpacked-archive $ unzip lj586en.exe -d /tmp/unpacked-archive/ Archive: lj586en.exe creating: /tmp/unpacked-archive/DISK1/ inflating: /tmp/unpacked-archive/DISK1/HP4050P6.INF inflating: /tmp/unpacked-archive/DISK1/HPBPST.HL_ inflating: /tmp/unpacked-archive/DISK1/HPBST16.DL_ inflating: /tmp/unpacked-archive/DISK1/HPDCMON.DL_ inflating: /tmp/unpacked-archive/DISK1/HPEXPAND.DL_ inflating: /tmp/unpacked-archive/DISK1/HPNRA.EX_ inflating: /tmp/unpacked-archive/DISK1/HPSETUP.HL_ inflating: /tmp/unpacked-archive/DISK1/HPTDPI.TD_ inflating: /tmp/unpacked-archive/DISK1/HPTDS.DL_ inflating: /tmp/unpacked-archive/DISK1/HPUNINST.EX_ inflating: /tmp/unpacked-archive/DISK1/LICENSE.TXT inflating: /tmp/unpacked-archive/DISK1/READ4050.WRI inflating: /tmp/unpacked-archive/DISK1/README.PER extracting: /tmp/unpacked-archive/DISK1/RUNONCE.ST_ inflating: /tmp/unpacked-archive/DISK1/SETUP.EXE inflating: /tmp/unpacked-archive/DISK1/SETUP.LST inflating: /tmp/unpacked-archive/DISK1/SETUP.STT inflating: /tmp/unpacked-archive/DISK1/SETUPRES.DLL inflating: /tmp/unpacked-archive/DISK1/SETUPUI.DL_ inflating: /tmp/unpacked-archive/DISK1/UNINSTAL.ST_ inflating: /tmp/unpacked-archive/DISK1/UNINSTAL.UN_ inflating: /tmp/unpacked-archive/DISK1/XLDRIVER.PER inflating: /tmp/unpacked-archive/DISK1/_SETUP32.DL_ creating: /tmp/unpacked-archive/DISK3/ inflating: /tmp/unpacked-archive/DISK3/HP4050P6.CAT inflating: /tmp/unpacked-archive/DISK3/HPBAFD16.DL_ inflating: /tmp/unpacked-archive/DISK3/HPBFAB.DD_ inflating: /tmp/unpacked-archive/DISK3/HPBFAB16.DL_ inflating: /tmp/unpacked-archive/DISK3/HPBFAB32.DL_ inflating: /tmp/unpacked-archive/DISK3/HPBFDB1.DR_ inflating: /tmp/unpacked-archive/DISK3/HPBFDB1.HL_ inflating: /tmp/unpacked-archive/DISK3/HPBFDB2.DL_ inflating: /tmp/unpacked-archive/DISK3/HPBFDB5.PM_ inflating: /tmp/unpacked-archive/DISK3/HPBFTM16.DL_ inflating: /tmp/unpacked-archive/DISK3/HPBFTM32.DL_ $ cd /tmp/unpacked-archive $ ls DISK1 DISK3 $ mv DISK1/* . $ mv DISK3/* . $ rmdir DISK1 $ rmdir DISK3 $ ls HP4050P6.CAT HPBFDB1.HL_ HPDCMON.DL_ LICENSE.TXT SETUPRES.DLL HP4050P6.INF HPBFDB2.DL_ HPEXPAND.DL_ READ4050.WRI SETUPUI.DL_ HPBAFD16.DL_ HPBFDB5.PM_ HPNRA.EX_ README.PER UNINSTAL.ST_ HPBFAB.DD_ HPBFTM16.DL_ HPSETUP.HL_ RUNONCE.ST_ UNINSTAL.UN_ HPBFAB16.DL_ HPBFTM32.DL_ HPTDPI.TD_ SETUP.EXE XLDRIVER.PER HPBFAB32.DL_ HPBPST.HL_ HPTDS.DL_ SETUP.LST _SETUP32.DL_ HPBFDB1.DR_ HPBST16.DL_ HPUNINST.EX_ SETUP.STT $ |
Either method will work to get all of the files into a single subdirectory. Finally, we can wrap up this example by actually building the package:
$ mkprintpkg.pl --name="hp4050" --version=1.00 --display-name="HP 4050" /tmp/unpacked-archive lj582en.exe Package: hp4050-1.00.tar.gz Display Name: HP 4050 Location: /tmp/unpacked-archive Using file HP4050P6.INF for INF information. Architecture: Windows 95/98 (detected from INF) Manufacturer: HP (detected from INF) Model: HP LaserJet 4050 Series PCL 6 (detected from INF) Using archive lj582en.exe for files. Using file hpbfdf1.inf for INF information. Architecture: Windows NT X86 (detected from INF) Manufacturer: HP (detected from INF) Model: HP LaserJet 4050 Series PCL 6 (detected from INF) $ |
And with that, the package is built.