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