Imported Debian patch 0.63.0-6
[hcoop/debian/courier-authlib.git] / authmigrate.in
CommitLineData
d9898ee8 1#! @SHELL@
2#
3# Migrate script from pre courier-authlib versions of Courier.
4#
8d138742 5# $Id: authmigrate.in,v 1.4 2009/02/22 16:58:27 mrsam Exp $
d9898ee8 6#
8d138742 7# Copyright 2004-2009 Double Precision, Inc. See COPYING for
d9898ee8 8# distribution information.
9
10prefix=@prefix@
11exec_prefix=@exec_prefix@
12sbindir=@sbindir@
13
14chk_file() {
15
16file="$1"
17dstfile="$2"
18rc=0
19
20for dir in /etc/courier \
8d138742
CE
21 /etc/courier/authlib \
22 /etc/courier-imap \
d9898ee8 23 /usr/lib/courier/etc \
24 /usr/lib/courier-imap/etc \
25 /usr/local/etc \
26 /usr/local/etc/courier \
27 /usr/local/courier/etc \
28 /usr/local/lib/courier/etc \
29 /usr/local/lib/courier-imap/etc \
30 /usr/local/share/sqwebmail \
31 /usr/local/etc/courier-imap
32do
33 if test -f "$dstfile"
34 then
35 if test -r "$dir/$file"
36 then
37 echo "Obsolete: $dir/$file""(.dist)?"
38 fi
39 continue
40 fi
41
42 if test -d "$dstfile"
43 then
44 if test -r "$dir/$file"
45 then
46 echo "Obsolete: $dir/$file""(.dist)?"
47 fi
48 continue
49 fi
50
51 if test ! -r $dir/$file
52 then
53 continue
54 fi
55
56 if test -f "$dir/$file"
57 then
58 if test "$file" = "userdb"
59 then
60 :
61 else
62 if test "`sed -n 1p $dir/$file | sed -n '/^##VERSION/p'`" = ""
63 then
64 continue
65 fi
66 fi
67 fi
68
69 echo "$dir/$file => $dstfile"
70 cp -pr "$dir/$file" "$dstfile"
71 rc=1
72done
73return $rc
74}
75
8d138742
CE
76chk_file authdaemonrc ${DESTDIR}@authdaemonrc@
77chk_file authmysqlrc ${DESTDIR}@authmysqlrc@
78chk_file authpgsqlrc ${DESTDIR}@authpgsqlrc@
79chk_file authldaprc ${DESTDIR}@authldaprc@
80chk_file userdb ${DESTDIR}@userdb@
d9898ee8 81
82if test "$?" = "1"
83then
84 echo "makeuserdb..."
85 $sbindir/makeuserdb
86fi