summaryrefslogtreecommitdiff
path: root/comms/hylafax/patches/patch-ai
blob: 3f012084b7f90f4f457763073125859ea9a427f8 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
$NetBSD: patch-ai,v 1.7 2001/07/16 13:30:38 wiz Exp $

--- etc/faxsetup.sh.in.orig	Thu Jun 14 07:36:16 2001
+++ etc/faxsetup.sh.in
@@ -41,7 +41,9 @@
 # This script interactively prepares and verifies 
 # a HylaFAX client and/or server machine for use.
 #
-PATH=/bin:/usr/bin:/etc
+PREFIX=@PREFIX@
+#
+PATH=/bin:/usr/bin:${PREFIX}/bin:${PREFIX}/sbin
 test -d /usr/ucb  && PATH=$PATH:/usr/ucb		# Sun and others
 test -d /usr/bsd  && PATH=$PATH:/usr/bsd		# Silicon Graphics
 test -d /usr/5bin && PATH=/usr/5bin:$PATH:/usr/etc	# Sun and others
@@ -59,13 +61,14 @@
 GREP=@GREP@			# grep command for use below
 LN=@LN@				# ln command for use below
 LN_S=@LN_S@			# ln option for creating a symbolic link
+MKDIR=@MKDIR@			# directory creation program for use below
 MKFIFO=@MKFIFO@			# FIFO creation program for use below
 MV=@MV@				# move file for use below
 RMCMD=@RM@			# remove file for use below
 SCRIPT_SH=@SCRIPT_SH@		# shell for use below
 SED=@SED@			# sed for use below
 
-FAX=fax				# identity of the fax user
+FAX=@FAXUID@			# identity of the fax user
 SERVICES=/etc/services		# location of services database
 INETDCONF=/usr/etc/inetd.conf	# default location of inetd configuration file
 ALIASES=/usr/lib/aliases	# default location of mail aliases database file
@@ -143,6 +146,7 @@
 LIBEXEC		DIR_LIBEXEC
 LN
 MANDIR		DIR_MAN
+MKDIR
 MKFIFO
 MV
 PATH
@@ -748,6 +752,61 @@
     boom
 fi
 
+createspool()
+{
+    old_spool="`dirname ${DIR_SPOOL}`/fax"
+    if [ -d "${old_spool}" ]; then
+	cat <<EOF
+=================================================================
+
+  Found an existing ${old_spool}, probably from an older version
+  of the HylaFax package.
+  You might want to copy you customizations to @SPOOL@ after
+  faxsetup is done.
+
+=================================================================
+EOF
+    fi
+    if [ -d "${DIR_SPOOL}" ]; then
+	cat <<EOF
+=================================================================
+
+  @SPOOL@ already exists, probably from a previous run of
+  faxsetup  --  I'm not touching it!
+
+  If you encounter problems, deinstall the HylaFax package,
+  remove @SPOOL@ and reinstall the package.
+
+=================================================================
+EOF
+    else
+	${MKDIR} -p -m 0755 ${DIR_SPOOL}
+	${MKFIFO} -m 0600 ${DIR_SPOOL}/FIFO
+	for i in archive docq doneq pollq sendq tmp ; do
+	    ${MKDIR} -m 0700 ${DIR_SPOOL}/$i
+	done
+	for i in bin client config cover dev etc info log recvq status ; do
+	    ${MKDIR} -m 0755 ${DIR_SPOOL}/$i
+	done
+	for i in `ls ${PREFIX}/share/hylafax/etc_template` ; do
+	    ${CP} -p  ${PREFIX}/share/hylafax/etc_template/$i \
+							${DIR_SPOOL}/etc/$i
+	done
+	for i in `ls ${PREFIX}/share/hylafax/config_template` ; do
+	    ${CP} -p  ${PREFIX}/share/hylafax/config_template/$i \
+							${DIR_SPOOL}/config/$i
+	done
+	for i in `ls ${PREFIX}/libexec/hylafax` ; do
+	    ${CP} -p  ${PREFIX}/libexec/hylafax/$i ${DIR_SPOOL}/bin/$i
+	done
+	${CHOWN} -R ${PROTOUID}:${PROTOGID} ${DIR_SPOOL}
+    fi
+}
+
+Note "Creating spool directory structure"
+
+createspool
+
 onClient && Note "Checking system for proper client configuration."
 onServer && Note "Checking system for proper server configuration."
 
@@ -2083,12 +2142,7 @@
 
     findproc()
     {
-	# NB: ps ax should give an error on System V, so we try it first!
-	pid="`ps ax 2>/dev/null | $AWK \"\
-		/[\/ (]$1[ )]/	{print \\$1;}
-		/[\/ ]$1\$/	{print \\$1;}\"`"
-	test "$pid" ||
-	    pid="`ps -e 2>/dev/null | $AWK \"/ $1[ ]*\$/ {print \\$1;}\"`"
+	pid="`ps -ax | grep -e "[/ (]$1[ )]" -e "[/ ]$1\$" | grep -v grep | head -1 | cut -c1-5`"
 	echo "$pid"
     }