Newer
Older
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
#!/bin/bash
#
# Do what's needed to initiate diaspora.
#
test "$( perl -e 'print $<')" = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
services=$( netstat -nl | grep '[^:]:3000[ \t]')
test -n "$services" && {
echo "Warning: something is already using port 3000"
echo " $services"
}
/usr/sbin/service mongodb start || :
cd /usr/share/diaspora/master
test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml
if rake db:seed:dev; then
echo "Database config OK, new user tom/evankorth in place"
else
cat <<- EOF
Database config failed. You might want to remove all db files with
'rm -rf /var/lib/mongodb/*' and/or resetting the config file by
'cp config/app_config.yml.example config/app_config.yml' before
making a new try. Also, make sure the mongodb server is running
e. g., using '/sbin/service mongod status'.
EOF
exit 1
fi
chmod 777 /var/lib/diaspora/uploads
chown -R diaspora /var/log/diaspora
hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml)
while : ; do
echo "Current hostname is \"$hostname\""
echo -n "Enter new hostname [$hostname] :"
read new_hostname garbage
echo -n "Use hostname \"$new_hostname\" as pod_url (Yes/No) [Yes]? :"
read yesno garbage
test "${yesno:0:1}" = 'y' -o "${yesno:0:1}" = 'Y' -o -z "$yesno" && {
sed -i "/pod_url:/s/$hostname/$new_hostname/g" config/app_config.yml &&
echo "config/app_config.yml updated."
break
}
done