# How to update ppds automatically on cups/hplip updates?

## Bircoph

Hello there,

for a quite long while I noticed unpleasant thing: after most hplip or cups updates my printers cease to work with different errors, but usually segfault in /usr/libexec/cups/filter/hpcups.

This can be always fixed by reinstalling the printers via cups http interface. I made a diff between old and new /etc/cups/ and it occurs that vital changes are in /etc/cups/ppd/*.ppd files. So it seems that older ppd files are often not compatible with newer hplip/cups releases.

What annoys me is the need of manual regeneration of ppd file for each printer. It would be great to automate this, but I have no idea how. This should be definitely possible because I use the same printers and the same drivers (I select the same drivers each time from cups menu).

----------

## slycordinator

Thread necromancy ftw.

I was having the same annoyance so I wrote a script to do it, although this isn't quite as automagic as I'd like and really only works if you're connected to the printer you want to update. But it's better than nothing

```
LPSTAT=/usr/bin/lpstat

LPADMIN=/usr/sbin/lpadmin

AWK=/bin/awk

HP_SETUP=/usr/bin/hp-setup

PRINTER_IP=XXX.XXX.XXX.XXX

$LPSTAT -p | $AWK '{print $2}'

echo "Enter the printer queues you want to remove/update, separated by a space"

read printer

for x in $printer

do

$LPADMIN -x $x

done

$HP_SETUP -i -a -x $PRINTER_IP >/dev/null

if [ $? -eq 0 ]

then

        echo "Success!!"

fi
```

And of course, you can change this around to not specify the IP (and instead do it by autodetect; I do it this way because hplip gives an error if I try the network autodetect). And of course, you could change the IP to be specified by reading it on user input.

----------

