Merge branch 'upstream' into debian
[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.2 2005/02/13 11:26:19 mrsam Exp $
6 #
7 # Copyright 2004 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 /usr/lib/courier/etc \
22 /usr/lib/courier-imap/etc \
23 /usr/local/etc \
24 /usr/local/etc/courier \
25 /usr/local/courier/etc \
26 /usr/local/lib/courier/etc \
27 /usr/local/lib/courier-imap/etc \
28 /usr/local/share/sqwebmail \
29 /usr/local/etc/courier-imap
30 do
31 if test -f "$dstfile"
32 then
33 if test -r "$dir/$file"
34 then
35 echo "Obsolete: $dir/$file""(.dist)?"
36 fi
37 continue
38 fi
39
40 if test -d "$dstfile"
41 then
42 if test -r "$dir/$file"
43 then
44 echo "Obsolete: $dir/$file""(.dist)?"
45 fi
46 continue
47 fi
48
49 if test ! -r $dir/$file
50 then
51 continue
52 fi
53
54 if test -f "$dir/$file"
55 then
56 if test "$file" = "userdb"
57 then
58 :
59 else
60 if test "`sed -n 1p $dir/$file | sed -n '/^##VERSION/p'`" = ""
61 then
62 continue
63 fi
64 fi
65 fi
66
67 echo "$dir/$file => $dstfile"
68 cp -pr "$dir/$file" "$dstfile"
69 rc=1
70 done
71 return $rc
72 }
73
74 chk_file authdaemonrc @authdaemonrc@
75 chk_file authmysqlrc @authmysqlrc@
76 chk_file authpgsqlrc @authpgsqlrc@
77 chk_file authldaprc @authldaprc@
78 chk_file userdb @userdb@
79
80 if test "$?" = "1"
81 then
82 echo "makeuserdb..."
83 $sbindir/makeuserdb
84 fi