File: 10device_halted.dpatch

package info (click to toggle)
efax 1%3A0.9a-20
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 452 kB
  • sloc: ansic: 4,629; sh: 932; makefile: 77
file content (82 lines) | stat: -rw-r--r-- 2,214 bytes parent folder | download | duplicates (3)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#! /bin/sh -e
## 10device_halted by DEXTARR (at freemail.hu)
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: handle case when fax device is stopped (and so $logfile disappears)

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
	-patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0;;
	-unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac
exit 0

@DPATCH@
--- efax-0.9a/fax	2005-10-28 14:46:29.000000000 +0200
+++ efax-0.9a/fax	2006-01-06 15:31:19.000000000 +0100
@@ -668,17 +668,21 @@
 	cd $FAXDIR ; 
 	case $? in 0) ;; *) echo "cannot cd to $FAXDIR" ; break ;; esac
 
-	n= ; for f in ${DEVN}.[0-9]* ; do logfile="$f" ; n=x$n ; done
+# if fax device is halted no infos are available
+	if [ ! -f ${DEVN}.stop ]
+	then 
+	    n= ; for f in ${DEVN}.[0-9]* ; do logfile="$f" ; n=x$n ; done
+
+	    case $n in 
+	    xx*) echo Warning: multiple logs for $DEV : ; ${LS} ${DEVN}.[0-9]* ;;
+	    esac
+
+	    case $logfile in 
+	    *\*) echo no fax answer process for device $DEV ; break ;;
+	    esac
 
-	case $n in 
-	xx*) echo Warning: multiple logs for $DEV : ; ${LS} ${DEVN}.[0-9]* ;;
-	esac
-
-	case $logfile in 
-	*\*) echo no fax answer process for device $DEV ; break ;;
-	esac
-
-	efaxpid=`echo $logfile | sed -e "s/${DEVN}\.//g"`
+	    efaxpid=`echo $logfile | sed -e "s/${DEVN}\.//g"`
+	fi
 
 	case $cmd in
 
@@ -695,6 +699,13 @@
 
 	stop)
 
+# if fax device is halted, just print message, no other infos are available
+	if [ -f ${DEVN}.stop ]
+	then
+	    echo fax daemon for ${DEV} already stopped.
+	    break
+	fi
+
 	if [ ! -w . ] ; then echo "can't write `pwd`" ; break ; fi
 	touch ${DEVN}.stop
 	echo stopping fax daemon for ${DEV}, pid=$efaxpid
@@ -707,7 +718,12 @@
 
 	st*)
 
-	if [ -f ${DEVN}.stop ] ; then stat="(set to stop)" ; fi
+# if fax device is halted, just print message, no other infos are available
+	if [ -f ${DEVN}.stop ]
+	then
+	    echo "(set to stop)"
+	    break
+	fi
 
       	if ps -u $efaxpid 2>/dev/null ; then :
       	else