13af9375cf8158382963d11a0d0ca91a6b5c854f
[dotclear.git] / createBlog.sh
1 #!/bin/sh
2
3 type=$1
4 owner=$2
5 url=$3
6 apache_group=www-data
7 rootpath=/home/x2003bruneau/public_html/
8 templatepath=dotclear
9 baseurl=/~x2003bruneau
10 serviceurl="http://murphy.m4x.org/~x2003bruneau/dotclear2/xorgservice/createBlog"
11
12 die() {
13 echo $1
14 exit 1
15 }
16
17 ( wget "$serviceurl?owner=$owner&type=$type&url=$3" -O - 2> /dev/null | grep 'blog created' ) || die "Blog creating failed"
18
19 ( cd $rootpath && mkdir $owner ) || die "Can't create the repository for the blog"
20
21 cd $owner
22 for i in admin db inc index.php locales plugins themes ; do
23 ln -s $rootpath/$templatepath/$i || die "Can't add path to $i"
24 done
25 mkdir public && chmod a+rwx public
26
27 ( cat <<EOF
28 RewriteEngine On
29 RewriteBase $baseurl/$owner
30 RewriteCond %{REQUEST_FILENAME} !-f
31 RewriteCond %{REQUEST_FILENAME} !-d
32 RewriteRule (.*) index.php/\$
33 RewriteRule ^index.php\$ index.php/
34 SetEnv DC_BLOG_ID $owner
35 EOF
36 ) > .htaccess