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