/[docman2]/migrate.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /migrate.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Wed Jun 11 02:32:13 2003 UTC (20 years, 10 months ago) by dpavlin
Branch: MAIN
File MIME type: application/x-sh
help migrate existing sites from 1.x to 2.0 version

1 dpavlin 1.1 #!/bin/sh
2    
3     # this shell script will try (when run inside old docman directory) to
4     # migrate docman v1.x installation to new v2.x directory layout
5     #
6     # 2003-06-11 Dobrica Pavlinusic <dpavlin@rot13.org>
7    
8     dir=`pwd`
9    
10     #
11     # try to guess existing DirectoryIndex (docman.php)
12     #
13    
14     if [ -e "index.php" ] ; then
15     docman_php="index.php"
16     elif [ -e ".index.php" ] ; then
17     docman_php=".index.php"
18     elif [ -e "docman.php" ] ; then
19     docman_php="docman.php"
20     else
21     echo "can't find docman.php in current directory,"
22     echo -n "please enter it's name: "
23     read docman_php
24     if [ ! -e "$docman_php" ] ; then
25     echo "FATAL: $docman_php doesn't exits!"
26     exit 1
27     fi
28     fi
29    
30     #
31     # try to find .htusers and .docman.conf which should always exists in
32     # valid existing repository
33     #
34    
35     if [ ! -e "$dir/.htusers" ] ; then
36     echo "FATAL: can't find $dir/.htusers file... aborting automatic migration"
37     exit 1
38     fi
39    
40     if [ ! -e "$dir/.docman.conf" ] ; then
41     echo "FATAL: can't find $dir/.docman.conf file... aborting automatic migration"
42     exit 1
43     fi
44    
45     #
46     # get some version numbers and dirs
47     #
48    
49     docman1_ver=`grep "gblVersion *=" $docman_php | cut -d\" -f2`
50     # convert dir to absolute path
51     D=`dirname "$0"`
52     docman2_dir="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`"
53     docman2_ver=`grep "gblVersion *=" $docman2_dir/docman.php | cut -d\" -f2`
54    
55     docman2_realm="$docman2_dir/realm"
56    
57     #
58     # do some sanity checks
59     #
60    
61     if [ ! -e "$docman2_realm" ] ; then
62     echo "can't guess docman2 realm dir (it should be $docman2_realm),"
63     echo -n "enter it here: "
64     read $docman2_realm
65     fi
66    
67     if [ ! -w "$docman2_realm" ] ; then
68     echo "FATAL: $docman2_realm is not writable by current user..."
69     exit 1
70     fi
71    
72     #
73     # begin real move
74     #
75    
76     d=`hostname -f`
77     echo "upgrading docman repository $dir from $docman1_ver to $docman2_ver..."
78     echo -n "docman2 virtual hostname [$d]: "
79     read http_virtual_host
80    
81     if [ -z "$http_virtual_host" ] ; then
82     http_virtual_host=$d
83     fi
84    
85     #
86     # migrate docman.conf
87     #
88    
89     f="$docman2_realm/$http_virtual_host.conf"
90     echo "creating $f"
91     #
92     # remove gblIncDir, fix gblUsers
93     #
94     cat $dir/.docman.conf | sed \
95     -e 's#\(\$gblIncDir\)#// -- removed in migration -- \1#g' \
96     -e 's#\(\$gblUsers.*\)htusers_#\1#' \
97     -e 's#?>#\
98     \
99     // added by migration script to create valid configuration\
100     \$gblRepositoryDir = "'$dir'";\
101     \
102     ?>#' > $f
103    
104     #
105     # migrate htusers
106     #
107     f="$docman2_realm/$http_virtual_host.htusers"
108     echo "creating $f"
109     cat $dir/.htusers > $f
110    
111     #
112     # copy template trustee file from distribution
113     #
114     f="$docman2_realm/$http_virtual_host.trustee"
115     echo "creating $f"
116     cat $docman2_realm/localhost.trustee.dist > $f
117    
118     #
119     # now, create new .html directory which will be DocumentRoot
120     #
121     echo "creating $dir/.html -- new DocumentRoot"
122     mkdir $dir/.html
123     ln -sf $docman2_dir/docman.php $dir/.html/index.php
124     ln -sf $docman2_dir/html/docman.css $dir/.html/docman.css
125     echo
126     echo "!!!!!!!!!!!!!!!!!"
127     echo "!!! IMPORTANT !!!"
128     echo "!!!!!!!!!!!!!!!!!"
129     echo
130     echo "You will have to change apache's httpd.conf for"
131     echo "virtual host $http_virtual_host as follows:"
132     echo
133     echo " DocumentRoot $dir/.html"
134     echo " DirectoryIndex index.php"
135     echo
136     echo -n "remove old $docman1_ver files (new version are in $docman2_realm)? [y]: "
137     read rm_old
138     if [ "$rm_old" = "y" -o -z "$rm_old" ] ; then
139     rm $dir/$docman_php $dir/.docman.conf $dir/.htusers
140     fi
141     echo "migration done..."

  ViewVC Help
Powered by ViewVC 1.1.26