blob: a50fefd9d6e7606eee4baef1586709872473476b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#!/bin/bash
function export_files() {
local srcbase=$1
local dstbase=$2
echo "Copying files..."
while read src dst
do
[ -d "$dstbase/$dst" ] || mkdir -p "$dstbase/$dst"
cp "$srcbase/$src" "$dstbase/$dst"
done
}
echo "Cleaning up work/ directory..."
[ -d work.old/ ] && chmod 777 -R work.old/ && rm -rf work.old/
[ -d work ] && mv work/ work.old/
mkdir work/
srcbase=".."
dstbase="work/tarball"
commit=$(cd $srcbase ; git describe --always HEAD)
buildname=editablesite-$commit
srclocale=$srcbase/locale
dstlocale="$dstbase/$buildname/admin/locale"
archfile=out/$buildname
installdir=/var/www
export_files $srcbase $dstbase/$buildname <<EOT
./README ./
./code/index.php ./
./code/admin/add.php ./admin/
./code/admin/admin.css ./admin/
./code/admin/admin.js ./admin/
./code/admin/ajax.php ./admin/
./code/admin/auth.php ./admin/
./code/admin/editor-bind-code.html ./admin/
./code/admin/index.php ./admin/
./code/admin/render.php ./admin/
./code/admin/utils.php ./admin/
./libs/microajax/microajax.minified.js ./admin/
./libs/treeview/treeview.css ./admin/
./libs/treeview/treeview_icons.png ./admin/
./samplefiles/templates/default/layout-article.php ./admin/templates/default/
./samplefiles/templates/default/screen.css ./admin/templates/default/
EOT
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"
#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/
./samplefiles/content/fr/accueil/div-content.html ./admin/content/fr/accueil/
./samplefiles/content/fr/accueil/div-teaser.html ./admin/content/fr/accueil/
./samplefiles/content/fr/accueil/props.ini ./admin/content/fr/accueil/
./samplefiles/content/site_conf.ini ./admin/content/
./samplefiles/templates/aloha/images/background.png ./admin/templates/aloha/images/
./samplefiles/templates/aloha/images/external-link-ltr-icon.png ./admin/templates/aloha/images/
./samplefiles/templates/aloha/layout-article.php ./admin/templates/aloha/
./samplefiles/templates/aloha/screen.css ./admin/templates/aloha/
EOT
echo "Adjusting perms..."
(
cd $dstbase/$buildname || exit 1
find -type d -print0 | xargs -0r chmod 775
chmod 755 admin/ admin/locale
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 root --group www-data $buildname/
echo "Compressing..."
gzip -9 -c $archfile.tar > $archfile.tar.gz
( cd "$dstbase" ; zip -9 -q -r - $buildname/) > $archfile.zip
rm $archfile.tar
echo "Deploying for test in $installdir"
sudo tar -xf $archfile.tar.gz -C $installdir
|