Added handling of ppd files

main
Jonas Lührig 2 years ago
parent 01c6674bdd
commit d3434b482c

@ -87,9 +87,14 @@ function printer_duplicate {
sed -i 's/^StateMessage .\+$//' ${TEMP_CONF_FILE}
sed -i 's/^Reason .\+$//' ${TEMP_CONF_FILE}
# Add new configuration to CUPS
# Add new configuration to CUPS and copy PPD file if exists
systemctl stop cups
cat ${TEMP_CONF_FILE} >> /etc/cups/printers.conf
if [ -f "/etc/cups/ppd/${PRINTER}.ppd" ]; then
cp "/etc/cups/ppd/${PRINTER}.ppd" "/etc/cups/ppd/${PRINTER}_duplicate.ppd"
else
echo "Info: No printer definition file copied"
fi
systemctl start cups
rm "${TEMP_CONF_FILE}"
@ -143,6 +148,11 @@ function printer_rename {
# Stop CUPS, rename, restart CUPS
systemctl stop cups
sed -i 's/<Printer '${PRINTER}'>$/<Printer '${NEW_NAME}'>/' /etc/cups/printers.conf
if [ -f "/etc/cups/ppd/${PRINTER}.ppd" ]; then
mv "/etc/cups/ppd/${PRINTER}.ppd" "/etc/cups/ppd/${NEW_NAME}.ppd"
else
echo "Info: No printer definition file moved"
fi
systemctl start cups
echo "OK"

Loading…
Cancel
Save