Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / authmigrate.in
1 #! @SHELL@
2 #
3 # Migrate script from pre courier-authlib versions of Courier.
4 #
5 # $Id: authmigrate.in,v 1.4 2009/02/22 16:58:27 mrsam Exp $
6 #
7 # Copyright 2004-2009 Double Precision, Inc. See COPYING for
8 # distribution information.
9
10 prefix=@prefix@
11 exec_prefix=@exec_prefix@
12 sbindir=@sbindir@
13
14 chk_file() {
15
16 file="$1"
17 dstfile="$2"
18 rc=0
19
20 for dir in /etc/courier \
21 /etc/courier/authlib \
22 /etc/courier-imap \
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
32 do
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
72 done
73 return $rc
74 }
75
76 chk_file authdaemonrc ${DESTDIR}@authdaemonrc@
77 chk_file authmysqlrc ${DESTDIR}@authmysqlrc@
78 chk_file authpgsqlrc ${DESTDIR}@authpgsqlrc@
79 chk_file authldaprc ${DESTDIR}@authldaprc@
80 chk_file userdb ${DESTDIR}@userdb@
81
82 if test "$?" = "1"
83 then
84 echo "makeuserdb..."
85 $sbindir/makeuserdb
86 fi