Script to create a blog.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 1 Jun 2008 15:07:12 +0000 (17:07 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 1 Jun 2008 15:07:12 +0000 (17:07 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
createBlog.sh [new file with mode: 0755]

diff --git a/createBlog.sh b/createBlog.sh
new file mode 100755 (executable)
index 0000000..13af937
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+type=$1
+owner=$2
+url=$3
+apache_group=www-data
+rootpath=/home/x2003bruneau/public_html/
+templatepath=dotclear
+baseurl=/~x2003bruneau
+serviceurl="http://murphy.m4x.org/~x2003bruneau/dotclear2/xorgservice/createBlog"
+
+die() {
+  echo $1
+  exit 1
+}
+
+( wget "$serviceurl?owner=$owner&type=$type&url=$3" -O - 2> /dev/null | grep 'blog created' ) || die "Blog creating failed"
+
+( cd $rootpath && mkdir $owner ) || die "Can't create the repository for the blog"
+
+cd $owner
+for i in admin db inc index.php locales plugins themes ; do
+  ln -s $rootpath/$templatepath/$i || die "Can't add path to $i"
+done
+mkdir public && chmod a+rwx public
+
+( cat <<EOF
+RewriteEngine On 
+RewriteBase $baseurl/$owner
+RewriteCond %{REQUEST_FILENAME} !-f 
+RewriteCond %{REQUEST_FILENAME} !-d 
+RewriteRule (.*) index.php/\$
+RewriteRule ^index.php\$  index.php/ 
+SetEnv DC_BLOG_ID $owner
+EOF
+) > .htaccess