#!/bin/sh

HELPERSDIR="/usr/lib/alterator-printers"
FOOMATIC_OVERVIEW=/usr/bin/foomatic-combo-xml
dump_file="/var/cache/alterator/printers-drivers.dump"

>"$dump_file"

[ -d /usr/share/foomatic ] && "$FOOMATIC_OVERVIEW" -O -l /usr/share/foomatic/|/bin/awk -f "$HELPERSDIR"/dump_foomatic.awk >>"$dump_file"

find -L /usr/share/ppd/ /usr/share/cups/model/ -iname '*.ppd*' | sort | xargs -- zgrep -E --with-filename '^\*(Manufacturer|ModelName)'|
	/bin/awk -f "$HELPERSDIR"/dump_ppds.awk >>"$dump_file"

echo 'Generic;Raw printer without driver;raw' >>"$dump_file"
