8 |
dir=`pwd` |
dir=`pwd` |
9 |
|
|
10 |
# |
# |
11 |
|
# try to guess docman installation directory from this script path |
12 |
|
# |
13 |
|
|
14 |
|
D=`dirname "$0"` |
15 |
|
docman2_dir="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`" |
16 |
|
docman2_realm="$docman2_dir/realm" |
17 |
|
|
18 |
|
if [ ! -e "$docman2_realm" -o ! -e "$docman2_dir/docman.php" ] ; then |
19 |
|
echo "FATAL: You should start this script using full path to" |
20 |
|
echo "docman installation directory and not from some other" |
21 |
|
echo "path!! (e.g. /home/httpd/docman2/`basename $0`)" |
22 |
|
exit 1 |
23 |
|
fi |
24 |
|
|
25 |
|
# |
26 |
# try to guess existing DirectoryIndex (docman.php) |
# try to guess existing DirectoryIndex (docman.php) |
27 |
# |
# |
28 |
|
|
58 |
fi |
fi |
59 |
|
|
60 |
# |
# |
61 |
# get some version numbers and dirs |
# get some version numbers |
62 |
# |
# |
63 |
|
|
64 |
docman1_ver=`grep "gblVersion *=" $docman_php | cut -d\" -f2` |
docman1_ver=`grep "gblVersion *=" $docman_php | cut -d\" -f2` |
65 |
# convert dir to absolute path |
# convert dir to absolute path |
|
D=`dirname "$0"` |
|
|
docman2_dir="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`" |
|
66 |
docman2_ver=`grep "gblVersion *=" $docman2_dir/docman.php | cut -d\" -f2` |
docman2_ver=`grep "gblVersion *=" $docman2_dir/docman.php | cut -d\" -f2` |
67 |
|
|
|
docman2_realm="$docman2_dir/realm" |
|
|
|
|
68 |
# |
# |
69 |
# do some sanity checks |
# do some sanity checks |
70 |
# |
# |
77 |
|
|
78 |
if [ ! -w "$docman2_realm" ] ; then |
if [ ! -w "$docman2_realm" ] ; then |
79 |
echo "FATAL: $docman2_realm is not writable by current user..." |
echo "FATAL: $docman2_realm is not writable by current user..." |
80 |
|
echo "(this is needed to create configuration files there)" |
81 |
|
exit 1 |
82 |
|
fi |
83 |
|
|
84 |
|
if [ ! -w "$dir" -a ! -w "$dir/.html" ] ; then |
85 |
|
echo "FATAL: $dir is not writable by current user..." |
86 |
|
echo "(we needed to create new DocumentRoot dir $dir/.html; you can create" |
87 |
|
echo "$dir/.html directory writable to current user manually)" |
88 |
exit 1 |
exit 1 |
89 |
fi |
fi |
90 |
|
|
91 |
|
|
92 |
# |
# |
93 |
# begin real move |
# begin real move |
94 |
# |
# |
134 |
f="$docman2_realm/$http_virtual_host.trustee" |
f="$docman2_realm/$http_virtual_host.trustee" |
135 |
echo "creating $f" |
echo "creating $f" |
136 |
cat $docman2_realm/localhost.trustee.dist > $f |
cat $docman2_realm/localhost.trustee.dist > $f |
137 |
|
# |
138 |
|
# add some permissions |
139 |
|
# |
140 |
|
echo "# |
141 |
|
# this will give all permissions to all users (to emulate docman 1.x |
142 |
|
# behaviour) -- you *WILL WANT* to change this! |
143 |
|
/:*:RWB |
144 |
|
#" >> $f |
145 |
|
|
146 |
# |
# |
147 |
# now, create new .html directory which will be DocumentRoot |
# now, create new .html directory which will be DocumentRoot |
165 |
read rm_old |
read rm_old |
166 |
if [ "$rm_old" = "y" -o -z "$rm_old" ] ; then |
if [ "$rm_old" = "y" -o -z "$rm_old" ] ; then |
167 |
rm $dir/$docman_php $dir/.docman.conf $dir/.htusers |
rm $dir/$docman_php $dir/.docman.conf $dir/.htusers |
168 |
|
else |
169 |
|
echo "remove files manually: $dir/$docman_php $dir/.docman.conf $dir/.htusers" |
170 |
fi |
fi |
171 |
echo "migration done..." |
echo "migration done..." |