diaspora/pkg/fedora/diaspora-setup
Alec Leamas 4f6f4bc7ec Build breakage point fixes, new user feedback
New user korth is also created when setting up db. Jasmine
handled, for now by disabling rake task. Various fixes
2010-11-03 10:11:39 +01:00

75 lines
2 KiB
Bash
Executable file

#!/bin/bash
#
# Do what's needed to initiate diaspora.
#
# Usage: # ./diaspora-setup [external hostname]
#
export PATH=$PATH:/usr/local/bin
arg_hostname="$1"
test $UID = "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"
}
/sbin/service mongod start || :
cd /usr/share/diaspora/master
libdir=$(rpm --eval %_libdir)
rm -rf vendor
ln -s $libdir/diaspora-bundle/vendor .
ln -sf $libdir/diaspora-bundle/Gemfile .
ln -sf $libdir/diaspora-bundle/Gemfile.lock .
test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml
mv lib/tasks/jasmine.rake lib/tasks/jasmine.no-rake
if bundle exec rake db:seed:dev; then
echo "Database config OK, users tom/evankorth, korth/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 reset 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
fi
chown -R diaspora /var/log/diaspora
sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \
config/app_config.yml
hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml)
if [ -n "$arg_hostname" ]; then
sed -i "/pod_url:/s|$hostname|$arg_hostname|g" config/app_config.yml &&
echo "config/app_config.yml updated."
exit 0
fi
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