forked from zotonic/zotonic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zotonic_install
62 lines (53 loc) · 1.91 KB
/
zotonic_install
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
#!/bin/bash
set -e
ZOTONIC=/home/zotonic
SHELL=/bin/bash
apt-get update
apt-get install -y \
build-essential \
postgresql \
imagemagick \
exif \
wget \
git
wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_16.b.3-1~debian~wheezy_amd64.deb
dpkg -i esl-erlang_16.b.3-1~debian~wheezy_amd64.deb
echo "CREATE USER zotonic WITH PASSWORD 'zotonic';
ALTER ROLE zotonic WITH CREATEDB;
CREATE DATABASE zotonic WITH OWNER = zotonic ENCODING = 'UTF8';
\c zotonic
CREATE LANGUAGE \"plpgsql\";" | su -l postgres -c psql
echo "# Zotonic settings
local all zotonic ident
host all zotonic 127.0.0.1/32 md5
host all zotonic ::1/128 md5" >> /etc/postgresql/*.*/main/pg_hba.conf
/etc/init.d/postgresql reload
mkdir -p $ZOTONIC
grep zotonic /etc/passwd || useradd -d $ZOTONIC -s /bin/bash zotonic
chown -R zotonic:zotonic $ZOTONIC
if [ ! -d $ZOTONIC/zotonic ]; then
echo "git clone git://github.com/zotonic/zotonic.git zotonic && \
cd zotonic/ && \
make && \
echo export PATH=\$PATH:\$HOME/zotonic/bin > \$HOME/.profile && \
. \$HOME/.profile" | su -l zotonic
fi
echo "zotonic start" | su -l zotonic
CONFIG=$(find $ZOTONIC/.zotonic -name zotonic.config | head -n 1)
while [ ! -f $CONFIG ]
do
sleep 2
done
PASSWORD=`cat $CONFIG | grep {password | sed -E 's/^\s\{\s*password\s*,\s*"(.*?)".*/\1/'`
if wget -q -O /dev/null http://localhost:8000/; then
echo "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Zotonic has been successfully installed:
- Visit http://localhost:8000/ to see the sites administration page.
- The password for login to this page is $PASSWORD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
else
echo "Error running Zotonic!"
# run debug mode to see whats going on
echo "zotonic debug" | su -l zotonic
fi