Package: roger-router / 1.8.14-4

fix-cups-quoting.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Fix quoting errors.
# Add basic error handling.
--- a/share/roger-cups
+++ b/share/roger-cups
@@ -1,20 +1,21 @@
-#!/bin/bash
+#!/bin/sh
 
-if [ $# == 0 ] ; then
-	echo  "file roger-cups:/ \"Unknown\" \"Tabos.org Roger Router Fax Printer\""
-	exit 0
+if [ $# -eq 0 ] ; then
+	# Device Discovery
+	echo "file roger-cups:/ \"Unknown\" \"Tabos.org Roger Router Fax Printer\""
+	exit 0 # CUPS_BACKEND_OK
 fi
 
-RNAME=$2-Fax-ID$1
-SPOOL_DIR=/var/spool/roger/
+RNAME="$2-Fax-ID$1"
+SPOOL_DIR="/var/spool/roger"
 
 if [ $# -eq 6 ]; then
-	cp $6 $SPOOL_DIR/$RNAME.tmp
+	cp "$6" "$SPOOL_DIR/$RNAME.tmp" || exit 1 # CUPS_BACKEND_FAILED
 else
-	cat > $SPOOL_DIR/$RNAME.tmp
+	cat > "$SPOOL_DIR/$RNAME.tmp" || exit 1 # CUPS_BACKEND_FAILED
 fi
 
-chmod 660 $SPOOL_DIR/$RNAME.tmp
-mv $SPOOL_DIR/$RNAME.tmp $SPOOL_DIR/$RNAME
+chmod 660 "$SPOOL_DIR/$RNAME.tmp"
+mv "$SPOOL_DIR/$RNAME.tmp" "$SPOOL_DIR/$RNAME"
 
-exit 0
+exit 0 # CUPS_BACKEND_OK