Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
choules committed Feb 25, 2022
1 parent 52ca9f8 commit a40f542
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This updated version implements some cool new things:
* Enables usage of Microsoft Excel to edit the CSV file – **this required switching the separator from comma to semicolon**, you may need to update your files accordingly
* The order of the csv columns do not have to be preserved, but **keep the names of the 1st row**.
* Sanity checks for the csv fields
* Option to setup printers using AirPrint provided PPDs, using [airprint-ppd](https://github.com/wycomco/airprint-ppd)
* Option to define a path to Munki repo and an optional subdirectory
* Option to define a separate name for the Munki pkginfo item
* Besides switching to semicolons as csv separator: **This script should preserve backward compatibility!**
Expand All @@ -30,11 +31,14 @@ The script can either take arguments on the command line, or a CSV file containi
The script will generate a pkginfo file. This pkginfo file is a "nopkg" style, and thus has three separate scripts:

* installcheck_script
* preinstall_script
* postinstall_script
* uninstall_script

The installcheck_script looks for an existing print queue named PRINTERNAME. If it does not find one, it will exit 0 and trigger an installation request. If it does find one, it will compare all of the options provided (DRIVER, ADDRESS, DISPLAYNAME, LOCATION, and OPTIONS) for differences. If there are any differences, it will trigger an installation request.

The preinstall_script is used to retrieve the PPD for the printer on the fly, in case the given printer should be setup using AirPrint. In all other cases, this script will be completely removed.

The postinstall_script will attempt to delete the existing print queue named PRINTERNAME first, and then will reinstall the queue with the specified options.
*Note that it does not check to see if the printer queue is in use at the time, so it is possible that existing print jobs will be cancelled if a user is printing when a Munki reinstall occurs.*

Expand All @@ -47,6 +51,7 @@ A template CSV file is provided to make it easy to generate multiple pkginfos in
```
./print_generator.py --csv /path/to/printers.csv
```

*Note: if a CSV file is provided, all other command line arguments – besides the optional `--repo` – are ignored.*

The CSV file's columns should be pretty self-explanatory:
Expand All @@ -71,39 +76,40 @@ A full description of usage is available with:

```
./print_generator.py -h
usage: print_generator.py [-h] [--printername PRINTERNAME] [--driver DRIVER] [--address ADDRESS] [--location LOCATION] [--displayname DISPLAYNAME] [--desc DESC] [--requires REQUIRES] [--options [OPTIONS ...]] [--version VERSION] [--icon ICON] [--catalogs CATALOGS] [--munkiname MUNKINAME] [--repo REPO]
[--subdirectory SUBDIRECTORY] [--csv CSV]
usage: print_generator.py [-h] [--printername PRINTERNAME] [--driver DRIVER] [--address ADDRESS] [--location LOCATION] [--displayname DISPLAYNAME] [--desc DESC] [--requires REQUIRES] [--options [OPTIONS ...]] [--version VERSION] [--icon ICON] [--catalogs CATALOGS] [--munkiname MUNKINAME] [--repo REPO] [--subdirectory SUBDIRECTORY] [--csv CSV]
Generate a Munki nopkg-style pkginfo for printer installation.
optional arguments:
-h, --help show this help message and exit
--printername PRINTERNAME
Name of printer queue. May not contain spaces, tabs, # or /. Required.
--driver DRIVER Name of driver file in /Library/Printers/PPDs/Contents/Resources/. Can be relative or full path. Required.
--driver DRIVER Either the name of driver file in /Library/Printers/PPDs/Contents/Resources/ (relative or full path) or \'airprint-ppd\' for
AirPrint printers. Required.
--address ADDRESS IP or DNS address of printer. If no protocol is specified, defaults to lpd://. Required.
--location LOCATION Location name for printer. Optional. Defaults to printername.
--displayname DISPLAYNAME
Display name for printer (and Munki pkginfo). Optional. Defaults to printername.
--desc DESC Description for Munki pkginfo only. Optional.
--requires REQUIRES Required packages in form of space-delimited 'CanonDriver1 CanonDriver2'. Optional.
--requires REQUIRES Required packages in form of space-delimited 'CanonDriver1 CanonDriver2'. Be sure to add a reference to airprint-ppd
to setup your printer via AirPrint.Optional.
--options [OPTIONS ...]
Printer options in form of space-delimited 'Option1=Key Option2=Key Option3=Key', etc. Optional.
--version VERSION Version number of Munki pkginfo. Optional. Defaults to 1.0.
--icon ICON Specifies an existing icon in the Munki repo to display for the printer in Managed Software Center. Optional.
--catalogs CATALOGS Space delimited list of Munki catalogs. Defaults to 'testing'. Optional.
--munkiname MUNKINAME
Name of Munki item. Defaults to printername. Optional.
--repo REPO Path to Munki repo. If specified, we will try to write directly to its containing pkgsinfo directory. If not defined, we will write to current working directory. Optional.
--subdirectory SUBDIRECTORY
Subdirectory of Munki's pkgsinfo directory. Optional.
--repo REPO Path to Munki repo. If specified, we will try to write directly to its containing pkgsinfo directory. If not defined, we will write to current working directory. Optional.
--csv CSV Path to CSV file containing printer info. If CSV is provided, all other options besides '--repo' are ignored.
```

As in the above CSV section, the arguments are all the same:

* `--printername`: Name of the print queue. May not contain spaces, tabs, "#" or "/" characters. **Required.**
* `--driver`: Name of the driver file in /Library/Printers/PPDs/Contents/Resources/. This can be either a relative path (i.e. the filename in the path above), or a full path (starting with "/Library"). **Required.**
* `--driver`: Either the name of driver file in /Library/Printers/PPDs/Contents/Resources/ (relative or full path) or \'airprint-ppd\' for AirPrint printers. **Required.**
* `--address`: The IP or DNS address of the printer. If no protocol is specified, `lpd://ADDRESS` will be used. **Required.**
* `--location`: The "location" of the printer. If not provided, this will default to the value of `--printername`.
* `--displayname`: The visual name that shows up in the Printers & Scanners pane of the System Preferences, and in the print dialogue boxes. Also used in the Munki pkginfo. If not provided, this will default to the value of `--printername`.
Expand All @@ -114,8 +120,8 @@ As in the above CSV section, the arguments are all the same:
* `--icon`: Used only in the Munki pkginfo. If not provided, will default to an empty string ("").
* `--catalogs`: Space delimited list of Munki catalogs. Defaults to 'testing'. Optional.
* `--munkiname`: Name of Munki item. Defaults to printername. Optional.
* `--repo`: Path to Munki repo. If specified, we will try to write directly to its containing pkgsinfo directory. If not defined, we will write to current working directory. Optional.
* `--subdirectory`: Subdirectory of Munki's pkgsinfo directory. Optional.
* `--repo`: Path to Munki repo. If specified, we will try to write directly to its containing pkgsinfo directory. If not defined, we will write to current working directory. Optional.

### Figuring out options

Expand Down

0 comments on commit a40f542

Please sign in to comment.