4 # ./createBlog.sh type owner baseurl
5 # type = user | group-member | group-admin
6 # * user: this is a blog for a user
7 # * group-member: this is a blog for a group, all the members of the group can post
8 # * group-admin: this is a blog for a group, only group admins can post
9 # owner = name of the owner
10 # * user blog: forlife of the owner of the blog
11 # * group blog: 'diminutif' of the group (from X.net database)
12 # baseurl = base url of the blog.
14 # WARNING: The script generates a .htaccess. The rewrite base might be edited to match
15 # the installation. Default value is based on a blog-farm of the form
16 # http://base.url/$owner/
18 # Once the blog has been installed and the .htaccess set-up, you can go on the administration
19 # page of the blog at baseurl/admin/
21 # Their, go to the section 'Widget' and add (by drag-n-drop) the widgets 'Auth X.org' and 'Copyright'.
22 # (should be set up by default in near future).
28 rootpath
=/home
/web
/blogs
31 serviceurl
="http://blog.polytechnique.org/xorgservice/createBlog"
38 ( wget
"$serviceurl?owner=$owner&type=$type&url=$3" -O
- 2> /dev
/null |
grep 'blog created' ) || die
"Blog creation failed"
40 ( cd $rootpath && mkdir
$owner ) || die
"Can't create the repository for the blog"
43 for i
in admin db inc index.php locales plugins themes
; do
44 ln -s
$rootpath/$templatepath/$i || die
"Can't add path to $i"
46 mkdir
-p
"$rootpath/$templatepath/public/$owner"
47 chgrp
-R
"$apache_group" "$rootpath/$templatepath/public/$owner"
48 chmod g
+wr
"$rootpath/$templatepath/public/$owner"
49 ln -s
$rootpath/$templatepath/public
/$owner public
53 RewriteBase $baseurl/$owner
54 RewriteCond %{REQUEST_FILENAME} !-f
55 RewriteCond %{REQUEST_FILENAME} !-d
56 RewriteRule (.*) index.php/\$1
57 RewriteRule ^index.php\$ index.php/
58 SetEnv DC_BLOG_ID $owner