File: postinst

package info (click to toggle)
efax 08a-6
  • links: PTS
  • area: main
  • in suites: slink
  • size: 356 kB
  • ctags: 529
  • sloc: ansic: 4,161; sh: 624; makefile: 66
file content (131 lines) | stat: -rw-r--r-- 3,188 bytes parent folder | download | duplicates (2)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/sh
#
# This is the postinst script for the Debian GNU/Linux efax package
#
# Written by Dirk Eddelbuettel <edd@debian.org>   

#
# Some bash functions 
#

efax_configure()
{
    cat <<EOF

The "efax" package has been installed on your system. You presumably have 
to adapt some settings in the resource file "/etc/efax.rc" to your system.

EOF
    # see if dialout group is set up for users
    #
    one=`grep dialout /etc/group | cut -c -16`	# up to uucp user
    two=`grep dialout /etc/group`			# all of it
    if [ "$one" = "$two" ]				# equal if unchanged
    then 
	cat <<EOF

Users must be added to the "dialout" group in file "/etc/group" to 
allow access to the modem device in order to use "efax" or "fax".

EOF
    fi

    # Log files ought to live in /var/log/$(package)
    # Move old log files from versions <= efax-07a-5
    OLDLOG=/var/spool/fax/log
    NEWLOG=/var/log/efax
    if [ -d $OLDLOG ]
    then
	echo -n "Moving efax logfiles from $OLDLOG to $NEWLOG."
	install -d -m 775 -o root -g dialout $NEWLOG && \
	mv $OLDLOG/* $NEWLOG && \
	rmdir $OLDLOG && \
	echo " Done."
    fi

    # The Debian versions 07a-2 to 07a-6 were patched for use with qfax 
    # This version no longer is, so we send out a message that the dirs are
    # now unused
    QFAXSPOOL=/var/spool/fax
    if [ -d $QFAXSPOOL/recvq -o -d $QFAXSPOOL/sendq -o -d $QFAXSPOOL/result ]
    then
    	cat <<EOF

You are upgrading from a version of efax that was patched for use with qfax.  
As qfax was never released for Debian, the present efax package no longer 
includes such a patch. You might therefore delete any of the subdirectories 
that still exist below $QFAXSPOOL as they are no longer used. 
However, please do not delete the directory $QFAXSPOOL itself.

EOF
    fi
}

# efax_upgrade()
# {
#     # Deal with old /usr/bin/fax files that could contain local information 
#     # This is only relevant for folks that upgrade from efax-07a-{0,1}
#     FAX=/usr/bin/fax
#     OLDFAX=/tmp/old.fax
#     NEWFAX=/tmp/new.fax
#     DIFFFAX=/tmp/diff.fax
#     FAXRC=/etc/efax.rc
#     #
#     # see whether debian.preinst has left some stuff for us
#     if [ -f $OLDFAX ]
#     then
# 	sed -n -e '/^[\ \t]*[A-Z][A-Z]*\=/p' \
# 	       -e '/^# --- End/q' $FAX >$NEWFAX
# 	# need ( ) to survive 'set -e'
# 	(diff $NEWFAX $OLDFAX > $DIFFFAX)
# 	# now if the files are different, report it
# 	# test for -s ie size of the difffile >0 
# 	if [ -s $DIFFFAX ]
# 	then
# 	    cat <<EOF
# A very old version of the fax script was installed as $FAX. 
# Information from that file has been extracted into $OLDFAX. 
# Information from the new $FAX has been extracted into $NEWFAX.
# You might want to look at the difference between the two files, $DIFFFAX,
# and add some of its content to the resource file $FAXRC.
# EOF
# 	else
# 		rm -f $OLDFAX $NEWFAX $DIFFFAX
# 	fi
#     fi
# }

#
# Main starts here
#

set -e

case "$1" in
    configure)
    	efax_configure
# 	if [ "$2" = "07a-0" -o "$2" = "07a-1" ]
# 	then 
# 	    efax_upgrade
# 	fi
	;;
    abort-upgrade|abort-remove|abort-deconfigure)
	;;
    *)
	echo "postinst called with unknown argument \`$1'" >&2
	exit 1
	;;
esac

exit 0