Added handling of ppd files
This commit is contained in:
12
printer.sh
12
printer.sh
@@ -87,9 +87,14 @@ function printer_duplicate {
|
|||||||
sed -i 's/^StateMessage .\+$//' ${TEMP_CONF_FILE}
|
sed -i 's/^StateMessage .\+$//' ${TEMP_CONF_FILE}
|
||||||
sed -i 's/^Reason .\+$//' ${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
|
systemctl stop cups
|
||||||
cat ${TEMP_CONF_FILE} >> /etc/cups/printers.conf
|
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
|
systemctl start cups
|
||||||
|
|
||||||
rm "${TEMP_CONF_FILE}"
|
rm "${TEMP_CONF_FILE}"
|
||||||
@@ -143,6 +148,11 @@ function printer_rename {
|
|||||||
# Stop CUPS, rename, restart CUPS
|
# Stop CUPS, rename, restart CUPS
|
||||||
systemctl stop cups
|
systemctl stop cups
|
||||||
sed -i 's/<Printer '${PRINTER}'>$/<Printer '${NEW_NAME}'>/' /etc/cups/printers.conf
|
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
|
systemctl start cups
|
||||||
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
|||||||
Reference in New Issue
Block a user