File: hylafax-client.postinst

package info (click to toggle)
hylafax 3%3A6.0.6-8.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 9,508 kB
  • sloc: sh: 15,371; ansic: 13,242; makefile: 1,545; cpp: 781; awk: 529
file content (71 lines) | stat: -rw-r--r-- 2,019 bytes parent folder | download | duplicates (4)
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
#! /bin/sh -e


#DEBHELPER#

# generate /etc/hylafax/pagesizes

newfile=`tempfile`
chmod a+r "$newfile"
cat /usr/share/hylafax/pagesizes | sed -e 's/^default/#default/' >> "$newfile"
perl -e 'print "default\t\t\t" . `paperconf -N|tr -d "\n"` . "\t";
	print int(`paperconf -mw` * 1200 / 25.4) . "\t";
	print int(`paperconf -mh` * 1200 / 25.4) . "\t";
	print int((`paperconf -mw` * 1200 / 25.4 - 300)*0.962) . "\t";
	print int((`paperconf -mh` * 1200 / 25.4 - 100)*0.948) . "\t";
	print "472\t345\n";' >> "$newfile"

#
# Copy the new configuration file in /var/spool/hylafax
# or copy the old one in /etc/hylafax
#

if [ -f /var/spool/hylafax/etc/pagesizes ] && [ -f /etc/hylafax/pagesizes ];
then
	a=$(md5sum /var/spool/hylafax/etc/pagesizes| awk '{print $1}')
	b=$(md5sum /etc/hylafax/pagesizes| awk '{print $1}')
	if [ "$a" != "$b" ]
	then
		if [ /etc/hylafax/pagesizes -nt /var/spool/hylafax/etc/pagesizes ]
		then
			ucf "$newfile" /etc/hylafax/pagesizes
			cp -p /etc/hylafax/pagesizes /var/spool/hylafax/etc/pagesizes
		else
			ucf /var/spool/hylafax/etc/pagesizes /etc/hylafax/pagesizes
		fi
	fi
else
	ucf "$newfile" /etc/hylafax/pagesizes
fi

# register config file with package name to ucf
ucfr hylafax-client /etc/hylafax/pagesizes

rm -f "$newfile"

#
# Copy all client configuration files from /etc/hylafax to /var/spool/hylafax
# but only if the hylafax-server is installed, i.e., if /var/spool/hylafax/etc
# exists.
#

# copy only if not bind mounted from /etc/hylafax
if [ 0 -eq $(findmnt --noheadings --target /var/spool/hylafax/etc | grep -Fc '[/etc/hylafax]') ]
then

	if [ -d /var/spool/hylafax/etc ] && [ ! -h /var/spool/hylafax/etc ];
	then
	#
	# on a specific system there was a problem with faxmail.ps so I have to check
	# for the existence of every file before copying it.
	#
		for f in /etc/hylafax/pagesizes /etc/hylafax/typerules \
			/etc/hylafax/hyla.conf /etc/hylafax/faxcover.ps \
			/etc/hylafax/faxmail.ps
		do
			[ -f "$f" ] && cp -p "$f" /var/spool/hylafax/etc/
		done
	fi
fi

exit 0