--- migrate.sh 2003/06/11 02:32:13 1.1 +++ migrate.sh 2003/06/11 14:07:23 1.3 @@ -8,6 +8,21 @@ dir=`pwd` # +# try to guess docman installation directory from this script path +# + +D=`dirname "$0"` +docman2_dir="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`" +docman2_realm="$docman2_dir/realm" + +if [ ! -e "$docman2_realm" -o ! -e "$docman2_dir/docman.php" ] ; then + echo "FATAL: You should start this script using full path to" + echo "docman installation directory and not from some other" + echo "path!! (e.g. /home/httpd/docman2/`basename $0`)" + exit 1 +fi + +# # try to guess existing DirectoryIndex (docman.php) # @@ -43,17 +58,13 @@ fi # -# get some version numbers and dirs +# get some version numbers # docman1_ver=`grep "gblVersion *=" $docman_php | cut -d\" -f2` # convert dir to absolute path -D=`dirname "$0"` -docman2_dir="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`" docman2_ver=`grep "gblVersion *=" $docman2_dir/docman.php | cut -d\" -f2` -docman2_realm="$docman2_dir/realm" - # # do some sanity checks # @@ -66,9 +77,18 @@ if [ ! -w "$docman2_realm" ] ; then echo "FATAL: $docman2_realm is not writable by current user..." + echo "(this is needed to create configuration files there)" + exit 1 +fi + +if [ ! -w "$dir" -a ! -w "$dir/.html" ] ; then + echo "FATAL: $dir is not writable by current user..." + echo "(we needed to create new DocumentRoot dir $dir/.html; you can create" + echo "$dir/.html directory writable to current user manually)" exit 1 fi + # # begin real move # @@ -114,6 +134,14 @@ f="$docman2_realm/$http_virtual_host.trustee" echo "creating $f" cat $docman2_realm/localhost.trustee.dist > $f +# +# add some permissions +# +echo "# +# this will give all permissions to all users (to emulate docman 1.x +# behaviour) -- you *WILL WANT* to change this! +/:*:RWB +#" >> $f # # now, create new .html directory which will be DocumentRoot @@ -137,5 +165,7 @@ read rm_old if [ "$rm_old" = "y" -o -z "$rm_old" ] ; then rm $dir/$docman_php $dir/.docman.conf $dir/.htusers +else + echo "remove files manually: $dir/$docman_php $dir/.docman.conf $dir/.htusers" fi echo "migration done..."