summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <lpouzenc@gmail.com>2013-10-30 00:50:12 +0100
committerLudovic Pouzenc <lpouzenc@gmail.com>2013-10-30 00:50:12 +0100
commit6ab5a946d9b512889d19ae041002cd78156c3ffc (patch)
treea81e2f22583be95c707982e8c72729d05bf40592
parenta66b978eb97229035292a1fdd3851e48d83f5f97 (diff)
downloadeditablesite-6ab5a946d9b512889d19ae041002cd78156c3ffc.tar.gz
editablesite-6ab5a946d9b512889d19ae041002cd78156c3ffc.tar.bz2
editablesite-6ab5a946d9b512889d19ae041002cd78156c3ffc.zip
Amelioration systeme de build. Les tar ball sont nickel maintenant.
-rw-r--r--.gitignore1
-rwxr-xr-xdist/build_all.sh60
2 files changed, 45 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 244db3d..548eae0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+dist/out/
dist/work/
dist/work.old/
diff --git a/dist/build_all.sh b/dist/build_all.sh
index 8dbb287..9f0306a 100755
--- a/dist/build_all.sh
+++ b/dist/build_all.sh
@@ -1,10 +1,9 @@
#!/bin/bash
function export_files() {
- srcbase=$1
- dstbase=$2
+ local srcbase=$1
+ local dstbase=$2
echo "Copying files..."
- IFS=' '
while read src dst
do
[ -d "$dstbase/$dst" ] || mkdir -p "$dstbase/$dst"
@@ -20,9 +19,12 @@ mkdir work/
srcbase=".."
dstbase="work/tarball"
commit=$(cd $srcbase ; git describe --always HEAD)
-archfile=work/editablesite-$commit
+buildname=editablesite-$commit
+srclocale=$srcbase/locale
+dstlocale="$dstbase/$buildname/admin/locale"
+archfile=out/$buildname
-export_files $srcbase $dstbase <<EOT
+export_files $srcbase $dstbase/$buildname <<EOT
./README ./
./code/index.php ./
./code/admin/add.php ./admin/
@@ -41,9 +43,18 @@ export_files $srcbase $dstbase <<EOT
./samplefiles/templates/default/screen.css ./admin/templates/default/
EOT
-scripts/po2mo.sh $srcbase/locale $dstbase/locale
+echo Generating locale binary files...
+for f in $(ls $srclocale/*.po)
+do
+ fname=$(basename "$f")
+ mo_dir="$dstlocale/"${fname%%.po}.utf8/LC_MESSAGES
+ [ -d "$mo_dir" ] || mkdir -p "$mo_dir"
-export_files $srcbase $dstbase <<EOT
+ echo msgfmt -o "'$mo_dir/editablesite.mo'" "'$f'"
+ msgfmt -o "$mo_dir/editablesite.mo" "$f"
+done
+
+export_files $srcbase $dstbase/$buildname <<EOT
./samplefiles/content/en/start/div-content.html ./admin/content/en/start/
./samplefiles/content/en/start/div-teaser.html ./admin/content/en/start/
./samplefiles/content/en/start/props.ini ./admin/content/en/start/
@@ -58,18 +69,35 @@ export_files $srcbase $dstbase <<EOT
EOT
echo "Adjusting perms..."
-find $dstbase -mindepth 1 -type d -print0 | xargs -0r chmod 550
-find $dstbase -type f -name '*.php' -print0 | xargs -0r chmod 550
-find $dstbase -type f \! -name '*.php' -print0 | xargs -0r chmod 440
-find $dstbase/admin/content -type d -print0 | xargs -0r chmod 770
-find $dstbase/admin/content -type f -print0 | xargs -0r chmod 440
+(
+ cd $dstbase/$buildname || exit 1
+ find -type d -print0 | xargs -0r chmod 775
+ find admin/ -type d -print0 | xargs -0r chmod 755
+ find -type f -name '*.php' -print0 | xargs -0r chmod 755
+ find -type f \! -name '*.php' -print0 | xargs -0r chmod 644
+ find admin/content -type f -print0 | xargs -0r chmod 664
+)
+
+echo "Generating sample pages..."
+(
+ umask 002
+ cd $dstbase/$buildname/admin
+ find_dir="./content/"
+ find $find_dir -name 'props.ini' -printf '%h\n' | while read f
+ do
+ #echo php render.php ${f##$find_dir}
+ php render.php ${f##$find_dir} >/dev/null
+ done
+)
echo "Creating tarball..."
# Tarball with samples
-tar cf $archfile.tar -C "$dstbase" --owner www-data --group www-data .
+tar cf $archfile.tar -C "$dstbase" --owner root --group www-data $buildname/
echo "Compressing..."
-gzip -9 $archfile.tar
-#gzip -9 -c $archfile.tar > $archfile.tar.gz
-( cd "$dstbase" ; zip -9 -q -r - .) > $archfile.zip
+gzip -9 -c $archfile.tar > $archfile.tar.gz
+( cd "$dstbase" ; zip -9 -q -r - $buildname/) > $archfile.zip
+rm $archfile.tar
+
+sudo tar -xf $archfile.tar.gz -C /var/www/