8 |
dir=`pwd` |
dir=`pwd` |
9 |
|
|
10 |
# |
# |
11 |
# try to guess existing DirectoryIndex (docman.php) |
# try to guess docman installation directory from this script path |
12 |
# |
# |
13 |
|
|
14 |
if [ -e "index.php" ] ; then |
D=`dirname "$0"` |
15 |
docman_php="index.php" |
docman2_dir="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`" |
16 |
elif [ -e ".index.php" ] ; then |
docman2_realm="$docman2_dir/realm" |
17 |
docman_php=".index.php" |
|
18 |
elif [ -e "docman.php" ] ; then |
if [ ! -e "$docman2_realm" -o ! -e "$docman2_dir/docman.php" ] ; then |
19 |
docman_php="docman.php" |
echo "FATAL: You should start this script using full path to" |
20 |
else |
echo "docman installation directory and not from some other" |
21 |
echo "can't find docman.php in current directory," |
echo "path!! (e.g. /home/httpd/docman2/`basename $0`)" |
22 |
echo -n "please enter it's name: " |
exit 1 |
|
read docman_php |
|
|
if [ ! -e "$docman_php" ] ; then |
|
|
echo "FATAL: $docman_php doesn't exits!" |
|
|
exit 1 |
|
|
fi |
|
23 |
fi |
fi |
24 |
|
|
25 |
# |
# |
29 |
|
|
30 |
if [ ! -e "$dir/.htusers" ] ; then |
if [ ! -e "$dir/.htusers" ] ; then |
31 |
echo "FATAL: can't find $dir/.htusers file... aborting automatic migration" |
echo "FATAL: can't find $dir/.htusers file... aborting automatic migration" |
32 |
|
echo "(is this really docman 1.x site directory?)" |
33 |
exit 1 |
exit 1 |
34 |
fi |
fi |
35 |
|
|
36 |
if [ ! -e "$dir/.docman.conf" ] ; then |
if [ ! -e "$dir/.docman.conf" ] ; then |
37 |
echo "FATAL: can't find $dir/.docman.conf file... aborting automatic migration" |
echo "FATAL: can't find $dir/.docman.conf file... aborting automatic migration" |
38 |
|
echo "(is this really docman 1.x site directory?)" |
39 |
exit 1 |
exit 1 |
40 |
fi |
fi |
41 |
|
|
42 |
# |
# |
43 |
# get some version numbers and dirs |
# try to guess existing DirectoryIndex (docman.php) |
44 |
|
# |
45 |
|
|
46 |
|
if [ -e "index.php" ] ; then |
47 |
|
docman_php="index.php" |
48 |
|
elif [ -e ".index.php" ] ; then |
49 |
|
docman_php=".index.php" |
50 |
|
elif [ -e "docman.php" ] ; then |
51 |
|
docman_php="docman.php" |
52 |
|
else |
53 |
|
echo "can't find docman.php in current directory," |
54 |
|
echo -n "please enter it's name: " |
55 |
|
read docman_php |
56 |
|
if [ ! -e "$docman_php" ] ; then |
57 |
|
echo "FATAL: $docman_php doesn't exits!" |
58 |
|
exit 1 |
59 |
|
fi |
60 |
|
fi |
61 |
|
|
62 |
|
# |
63 |
|
# get some version numbers |
64 |
# |
# |
65 |
|
|
66 |
docman1_ver=`grep "gblVersion *=" $docman_php | cut -d\" -f2` |
docman1_ver=`grep "gblVersion *=" $docman_php | cut -d\" -f2` |
67 |
# convert dir to absolute path |
# convert dir to absolute path |
|
D=`dirname "$0"` |
|
|
docman2_dir="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`" |
|
68 |
docman2_ver=`grep "gblVersion *=" $docman2_dir/docman.php | cut -d\" -f2` |
docman2_ver=`grep "gblVersion *=" $docman2_dir/docman.php | cut -d\" -f2` |
69 |
|
|
|
docman2_realm="$docman2_dir/realm" |
|
|
|
|
70 |
# |
# |
71 |
# do some sanity checks |
# do some sanity checks |
72 |
# |
# |
79 |
|
|
80 |
if [ ! -w "$docman2_realm" ] ; then |
if [ ! -w "$docman2_realm" ] ; then |
81 |
echo "FATAL: $docman2_realm is not writable by current user..." |
echo "FATAL: $docman2_realm is not writable by current user..." |
82 |
|
echo "(this is needed to create configuration files there)" |
83 |
|
exit 1 |
84 |
|
fi |
85 |
|
|
86 |
|
if [ ! -w "$dir" -a ! -w "$dir/.html" ] ; then |
87 |
|
echo "FATAL: $dir is not writable by current user..." |
88 |
|
echo "(we needed to create new DocumentRoot dir $dir/.html; you can create" |
89 |
|
echo "$dir/.html directory writable to current user manually)" |
90 |
exit 1 |
exit 1 |
91 |
fi |
fi |
92 |
|
|
93 |
|
|
94 |
# |
# |
95 |
# begin real move |
# begin real move |
96 |
# |
# |
136 |
f="$docman2_realm/$http_virtual_host.trustee" |
f="$docman2_realm/$http_virtual_host.trustee" |
137 |
echo "creating $f" |
echo "creating $f" |
138 |
cat $docman2_realm/localhost.trustee.dist > $f |
cat $docman2_realm/localhost.trustee.dist > $f |
139 |
|
# |
140 |
|
# add some permissions |
141 |
|
# |
142 |
|
echo "# |
143 |
|
# this will give all permissions to all users (to emulate docman 1.x |
144 |
|
# behaviour) -- you *WILL WANT* to change this! |
145 |
|
/:*:RWB |
146 |
|
#" >> $f |
147 |
|
|
148 |
# |
# |
149 |
# now, create new .html directory which will be DocumentRoot |
# now, create new .html directory which will be DocumentRoot |
167 |
read rm_old |
read rm_old |
168 |
if [ "$rm_old" = "y" -o -z "$rm_old" ] ; then |
if [ "$rm_old" = "y" -o -z "$rm_old" ] ; then |
169 |
rm $dir/$docman_php $dir/.docman.conf $dir/.htusers |
rm $dir/$docman_php $dir/.docman.conf $dir/.htusers |
170 |
|
else |
171 |
|
echo "remove files manually: $dir/$docman_php $dir/.docman.conf $dir/.htusers" |
172 |
fi |
fi |
173 |
echo "migration done..." |
echo "migration done..." |