Subversion Repositories wimsdev

Rev

Rev 827 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 reyssat 1
#! /bin/sh
2
 
3
cd `dirname $0`
4475 bpr 4
## do not seem no more useful, except for updating very old versions of wims
5
### should be commented
3 reyssat 6
./classupdate
7
cd ..
8
wimshome=`pwd`
9
 
10
if [ -z "$1" ]; then wimshome2=$wimshome; else wimshome2=$1; fi
11
 
12
if [ ! -e s2 ]; then
13
 if [ -f /cdrom/knowims-hd-install ]; then
14
  mkdir -p -m og-rwx /ramdisk/s2
15
  ln -s /ramdisk/s2 .
16
 else
17
  mkdir -m og-rwx s2
18
 fi
19
fi
20
 
21
for d in public_html/modules public_html/modules/devel public_html/modules/local \
22
	public_html/bases public_html/bases/doc other log/classes \
23
	public_html/modules/adm/local
24
do
25
 mkdir -p $d
26
 echo $wimshome2 >$d/.wimshome 2>/dev/null
27
done
28
rm -fr public_html/modules/adm/coqw* 2>/dev/null
29
 
4475 bpr 30
#########################
31
 
32
VERSION=357
33
 
3 reyssat 34
v=`cat log/update-version 2>/dev/null`
35
if [ "$v" != "" ] && [ "$v" -ge "$VERSION" ]; then exit; fi
36
 
4475 bpr 37
## this is for update very old version of wims.
38
## depend of the log/update-version
39
## should be in an other file
40
 
41
echo "cleanup"
3 reyssat 42
# cleanup list
43
rmlist="scripts/chrono.js
44
html/classes
45
modules/home/modules
46
modules/home/tool
47
bin/frename
48
bases/dic/en/.cnt.en.*
49
bases/dic/fr/.cnt.fr.*
50
"
51
for f in $rmlist
52
do
53
 rm -f public_html/$f 2>/dev/null
54
done
55
 
56
mv -f public_html/html/motd.* log 2>/dev/null
57
find public_html/modules -name writable -exec rm -R '{}' \; 2>/dev/null
58
rm -Rf public_html/html/default public_html/bin/instex* public_html/instex public_html/w/instex/* public_html/mathfonts/texgif 2>/dev/null
59
# rm -f log/wimslogd.pid 2>/dev/null
60
chmod og-w tmp
61
cd $wimshome/public_html/bases/sys
62
find . -type l -exec rm '{}' \;
63
for l in cn es it tw nl si
64
do
65
 if [ ! -r indignore.$l ]; then
66
  cp indignore.en indignore.$l >/dev/null 2>/dev/null
67
 fi
68
done
69
 
70
cd $wimshome/public_html/scripts/authors
71
find . -type l -exec rm '{}' \;
72
cd $wimshome/public_html/modules/classes
73
find . -type l -exec rm '{}' \;
74
for l in ??
75
do
76
 cp -p com/* $l
77
done
78
cd $wimshome/public_html/modules/template
79
find . -type l -exec rm '{}' \;
80
for l in oef.??
81
do
82
 cp oef.com/* $l
83
done
84
for l in deductio.??
85
do
86
 cp deductio.com/* $l 2>/dev/null
87
done
88
cd $wimshome/public_html/modules/adm
89
find texo.?? -type l -exec rm '{}' \;
90
for l in texo.??
91
do
92
 cp texo/* $l
93
done
94
 
95
cd $wimshome
96
if [ -f public_html/wims.conf ]; then mv public_html/wims.conf log/wims.conf; fi
97
if [ -f .wimspass ]; then mv .wimspass log/.wimspass; fi
98
if [ -d forums ]; then
99
 mv forums/[0-9]* log/forums 2>/dev/null
100
 rm -f public_html/modules/adm/forum/forums
101
 ln -s ../../../../log/forums public_html/modules/adm/forum
102
 cd log/forums
103
 ./.build-index
104
fi
105
cd $wimshome
106
oldcrontab=`crontab -l 2>/dev/null`
107
accountest=`echo "$oldcrontab" | grep -v '#' | grep 'log/account.sh'`
108
if [ ! -z "$accountest" ]; then
109
 echo site_accounting=1 >>log/wims.conf
110
 newcrontab=yes
111
fi
112
backtest=`echo "$oldcrontab" | grep -v '#' | grep 'bin/backup'`
113
if [ ! -z "$backtest" ]; then
114
 bh=`echo "$backtest" | cut -d' ' -f2`
827 bpr 115
 if [ "$bh" = "1" ]; then bh=2; fi
116
 if [ "$bh" = "23" ]; then bh=22; fi
3 reyssat 117
 echo backup_hour=$bh >>log/wims.conf
118
 newcrontab=yes
119
fi
120
 
121
if [ "$newcrontab" = "yes" ]; then
122
 chmod og-rwx log/wims.conf
123
 echo "$oldcrontab" | grep -v 'log/account.sh' | grep -v 'bin/backup' >tmp/crontab
124
 crontab tmp/crontab
125
fi
126
 
127
# Clean up modules
128
cd $wimshome/public_html/modules
129
oeflist=`find . -name INDEX -exec egrep -l '^category=.*(oef|deductio|document)' '{}' \; | sed 's!/INDEX$!!'`
130
for m in $oeflist; do
131
 cd $wimshome/public_html/modules/$m
132
 rm -f mkindex src/Makefile src/cpp/Makefile
133
 if [ -L proc ]; then
134
  echo $m
135
  cat=`grep '^category=' INDEX`
136
  oeftest=`grep '^category=.*oef' INDEX`
137
  typ=
138
  if [ -n "$oeftest" ]; then typ=oef; typ2=oef; fi
139
  dedtest=`grep '^category=.*deductio' INDEX`
140
  if [ -n "$dedtest" ]; then typ=deductio; typ2=deduc; fi
141
  if [ -n "$typ" ]; then
142
   rm -f proc
143
   deftest=`find var.def -type l`
144
   if [ -n "$deftest" ]; then
145
    rm -f var.def
146
    echo "vardef=$typ2/var.def" >>INDEX
147
   fi
148
   links=`find . -maxdepth 1 -type l | sed 's!^./!!'`
149
   rm -f $links
150
   for f in `grep -l 'proc/' * 2>/dev/null`; do
151
    echo "$m/$f:"
152
    ed $f <<@
153
,s!proc/!$typ2/!g
154
,w
155
@
156
   done
157
   for f in $links; do
158
    cp -f $wimshome/public_html/modules/template/$typ.com/$f .
159
   done
160
  fi
161
 fi
162
done
163
# This one should be removed in order to accept new version.
164
# Otherwise it destroys the oef managing module.
165
# rm -Rf $wimshome/public_html/modules/H1/algebra/oefprop.cn
166
 
167
cd $wimshome
168
echo $VERSION >log/update-version
169
exit 0
170