File: preinst

package info (click to toggle)
fml 4.0.3.dfsg-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,528 kB
  • ctags: 5
  • sloc: perl: 711; sh: 95; makefile: 88
file content (51 lines) | stat: -rw-r--r-- 1,420 bytes parent folder | 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh -e
#

checkgroup() {
    dir=$1
    group=$2
    find $dir -maxdepth 0 -group $group 2>/dev/null | grep -q $dir
}

if [ "$1" = "upgrade" ]; then
    if [ -x /etc/init.d/sendmail ]; then
	echo 'For the case that someone post the list,'
	echo 'it should be safe to stop the sendmail while upgrading'
	echo 'Stopping sendmail...'
	if which invoke-rc.d > /dev/null 2>&1; then
	    invoke-rc.d sendmail stop
	else
	    /etc/init.d/sendmail stop
	fi
    fi
    if [ -x /etc/init.d/postfix ]; then
	echo 'For the case that someone post the list,'
	echo 'it should be safe to stop the postfix while upgrading'
	echo 'Stopping postifx...'
	if which invoke-rc.d > /dev/null 2>&1; then
	    invoke-rc.d postfix stop
	else
	    /etc/init.d/postfix stop
	fi
    fi
    # /usr/lib/fml/.fml/system -> /etc/fml/system
    if [ -f /usr/lib/fml/.fml/system -a ! -L /usr/lib/fml/.fml/system ]; then
	mv /usr/lib/fml/.fml/system /etc/fml/system
	rm -rf /usr/lib/fml/.fml
    fi
    # group fml -> list
    if checkgroup /var/spool/ml fml; then
    	echo 'group fml has been obsoleted, use group list instead'
	echo 'changing group in /var/spool/ml...'
	chgrp -R list /var/spool/ml
    fi
    # /usr/lib/fml -> /usr/share/fml
    for i in /etc/fml/*/*
    do
	if [ -f $i ] && grep -q /usr/lib/fml $i; then
	    sed -e 's,/usr/lib/fml,/usr/share/fml,g' $i > $i.new && cp $i.new $i && rm -f $i.new
	fi
    done
fi
#DEBHELPER#
exit 0