-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupgrade.cfgxml.sh
More file actions
executable file
·67 lines (56 loc) · 1.49 KB
/
upgrade.cfgxml.sh
File metadata and controls
executable file
·67 lines (56 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# author: lilong'en(lilongen@163.com)
# date: 11/02/2010
#
function upgradeAll() {
echo
echo "Start CCV module config files upgrade ..."
echo
cd config
if [ ! -e _cfgsbk ]
then
mkdir _cfgsbk
fi
for i in *.xml
do
bkFile=_cfgsbk/$i.ubk
if [ ! -e $bkFile ]
then
echo "backup $i ... "
cp -f $i $bkFile
fi
echo "upgrade $i ..."
upgrade $i
done
cd ..
echo "CCV module config files upgrade: done!"
echo
}
function upgrade() {
cfgFile=$1
sed -i -r 's/<(\/)?cvs_module>/<\1module>/g' $cfgFile
sed -i -r 's/<(\/)?cvs_access_mode>/<\1access_mode>/g' $cfgFile
sed -i -r 's/<(\/)?cvs_account_id>/<\1account_id>/g' $cfgFile
sed -i -r 's/<(\/)?cvs_account_pw>/<\1account_pw>/g' $cfgFile
sed -i -r 's/<(\/)?viewvc_cvsroot>/<\1viewvc_repository>/g' $cfgFile
#replacce global id/pwd/mode form account_id/account_pw/account_mode to prefixed by cvs
sed -i -r 's/^<account_id>(.*)<\/account_id>/<cvs_account_id>\1<\/cvs_account_id>/g' $cfgFile
sed -i -r 's/^<account_pw>(.*)<\/account_pw>/<cvs_account_pw>\1<\/cvs_account_pw>/g' $cfgFile
sed -i -r 's/^<access_mode>(.*)<\/access_mode>/<cvs_account_mode>\1<\/cvs_account_mode>/g' $cfgFile
}
if [ $# -gt 0 ]
then
cfgFile=$1
echo
if [ -e $cfgFile ]
then
echo "upgrade $cfgFile ..."
upgrade $cfgFile
echo "done!"
else
echo "Eror: $cfgFile not exist!"
fi
echo
else
upgradeAll
fi