]> gerrit.simantics Code Review - simantics/platform.git/blob - releng/doc/tag-dev-wiki.sh
Fixed release engineering target platform preparation instructions
[simantics/platform.git] / releng / doc / tag-dev-wiki.sh
1 #!/bin/bash
2
3 major=$1
4 minor=$2
5 www=/var/www
6 wikiname=http-dev.simantics.org
7 wikidb=devwikidb
8 wikidbuser=devwikiuser
9
10 releasewww=${www}/${major}.${minor}
11
12 srcdb=${wikidb}
13 tgtdb=${wikidb}_${major}_${minor}
14
15 echo "Release version: $major.$minor"
16
17 function myexecute() {
18         echo "Sending to mysql using database $1: $2"
19         echo $2 | mysql -u root -p $1
20 }
21
22 # dump wiki db to file
23 echo "Dumping $srcdb"
24 mysqldump -p ${srcdb} > ${tgtdb}.dump
25 # load wiki db from file to name ${wikidb}_x_y, where x_y are major.minor version numbers
26 # add privileges for ${wikidbuser} to ${wikidb}_x_y
27 echo "Importing ${tgtdb}"
28 cat > import_${major}_${minor}.sql <<EOF
29 drop database ${tgtdb};
30 create database ${tgtdb};
31 grant all privileges on $tgtdb.* to '${wikidbuser}'@'localhost';
32 grant all privileges on $tgtdb.* to '${wikidbuser}'@'%';
33 use $tgtdb;
34 source ${tgtdb}.dump;
35 EOF
36 myexecute $srcdb "source import_${major}_${minor}.sql;"
37
38 # copy /var/www/http-dev.simantics.org/ to /var/www/http-dev.simantics.org/x.y/wiki
39 echo "Copying wiki www-directory $www to $releasewww"
40 mkdir -p ${releasewww}
41 cp -a ${www}/${wikiname} ${releasewww}
42
43 # change /var/www/https-www.simantics.org/x.y/wiki/LocalSettings.php to use simwikidb_x_y
44 echo "Fixing released wiki settings"
45 cat $www/$wikiname/LocalSettings.php | sed -e "s/$srcdb/$tgtdb/" |sed -e "s/\/${wikiname}/\/$major\.$minor\/${wikiname}/"> $releasewww/${wikiname}/LocalSettings.php
46 echo '$wgReadOnly = "Released version, no further changes allowed.";' >> $releasewww/${wikiname}/LocalSettings.php
47