Some fixes on installation scripts.
[dotclear.git] / createBlog.sh
index 13af937..3636c30 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -x
 
 type=$1
 owner=$2
@@ -14,23 +14,23 @@ die() {
   exit 1
 }
 
-( wget "$serviceurl?owner=$owner&type=$type&url=$3" -O - 2> /dev/null | grep 'blog created' ) || die "Blog creating failed"
+( wget "$serviceurl?owner=$owner&type=$type&url=$3" -O - 2> /dev/null | grep 'blog created' ) || die "Blog creation 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
+for i in admin db inc index.php locales plugins themes public ; do
   ln -s $rootpath/$templatepath/$i || die "Can't add path to $i"
 done
-mkdir public && chmod a+rwx public
+mkdir -p "$rootpath/$templatepath/public/$owner"
 
 ( cat <<EOF
-RewriteEngine On 
+RewriteEngine On
 RewriteBase $baseurl/$owner
-RewriteCond %{REQUEST_FILENAME} !-f 
-RewriteCond %{REQUEST_FILENAME} !-d 
-RewriteRule (.*) index.php/\$
-RewriteRule ^index.php\$  index.php/ 
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule (.*) index.php/\$1
+RewriteRule ^index.php\$  index.php/
 SetEnv DC_BLOG_ID $owner
 EOF
 ) > .htaccess