Update dotclear plugin to properly display auth link on the public page.
[dotclear.git] / createBlog.sh
... / ...
CommitLineData
1#!/bin/sh -x
2
3# Usage:
4# ./createBlog.sh type owner baseurl
5# type = user | connected | group-member | group-admin
6# * user: this is a blog for a user
7# * connected: this is a blog for a group, all connected users can post
8# * group-member: this is a blog for a group, all the members of the group can post
9# * group-admin: this is a blog for a group, only group admins can post
10# owner = name of the owner
11# * user blog: forlife of the owner of the blog
12# * group blog: 'diminutif' of the group (from X.net database)
13# url = full url of the blog (e.g http://group.blog-x.org/).
14
15# WARNING: The script generates a .htaccess. The rewrite base might be edited to match
16# the installation. Default value is based on a blog-farm of the form
17# http://$owner.base.url/
18
19# Once the blog has been installed and the .htaccess set-up, you can go on the administration
20# page of the blog at baseurl/admin/
21#
22# Their, go to the section 'Widget' and add (by drag-n-drop) the widgets 'Auth X.org' and 'Copyright'.
23# (should be set up by default in near future).
24
25type=$1
26owner=$2
27url=$3
28apache_group=www-data
29rootpath=/home/web/blogs
30templatepath=dotclear
31baseurl=/
32serviceurl="http://blog.polytechnique.org/xorgservice/createBlog"
33
34die() {
35 echo $1
36 exit 1
37}
38
39( wget "$serviceurl?owner=$owner&type=$type&url=$3" -O - 2> /dev/null | grep 'blog created' ) || die "Blog creation failed"
40
41( cd $rootpath && mkdir $owner ) || die "Can't create the repository for the blog"
42
43cd $owner
44for i in admin db inc index.php locales plugins themes; do
45 ln -s $rootpath/$templatepath/$i || die "Can't add path to $i"
46done
47mkdir -p "$rootpath/$templatepath/public/$owner"
48chgrp -R "$apache_group" "$rootpath/$templatepath/public/$owner"
49chmod g+wr "$rootpath/$templatepath/public/$owner"
50ln -s $rootpath/$templatepath/public/$owner public
51
52( cat <<EOF
53RewriteEngine On
54RewriteBase $baseurl
55RewriteCond %{REQUEST_FILENAME} !-f
56RewriteCond %{REQUEST_FILENAME} !-d
57RewriteRule (.*) index.php/\$1
58RewriteRule ^index.php\$ index.php/
59SetEnv DC_BLOG_ID $owner
60EOF
61) > .htaccess