Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- apt_prepare()
- {
- if [ $exist = 0 ] ; then
- echo "deb http://ppa.launchpad.net/maco.m/ruby/ubuntu lucid main" >>$apt_srcfn
- apt-key adv --keyserver keyserver.ubuntu.com --recv 85960EAD
- fi
- apt-get update
- }
- apt_install()
- {
- DEBIAN_FRONTEND=noninteractive apt-get -y \
- -o DPkg::Options::=--force-confdef \
- -o DPkg::Options::=--force-confold \
- --no-install-recommends \
- install $@
- }
- cleanup_apt()
- {
- rm -r /var/cache/apt/*
- mkdir /var/cache/apt/archives
- mkdir /var/cache/apt/archives/partial
- }
- make_startscript()
- {
- cat <<EOF
- #!/bin/bash
- #
- export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- cd /root/git/diaspora
- #
- # -- check if already running
- pid=\$(ps awx | grep 'thin start -p 3000' | grep -v grep | awk '{print \$1}')
- if [ -n "\$pid" ] ; then
- echo "Killing current running diaspora version"
- kill \$pid
- fi
- #
- # test if we need to sync first
- if [ "\$1" = "update" ] ; then
- echo "Updating version...."
- git pull
- bundle install
- bundle update
- fi
- #
- echo "Starting Diaspora "
- cd /root/git/diaspora
- ./script/server
- # --- give it some time...
- sleep 5
- echo "Done"
- #
- exit 0
- EOF
- }
- #
- #
- apt_srcfn=/etc/apt/sources.list.d/sources.list
- apt_prepare
- #
- apt_install build-essential libxslt1.1 libxslt1-dev libxml2
- apt_install libmysqlclient-dev libmysql-ruby
- apt_install ruby-full
- apt_install libssl-dev libopenssl-ruby libcurl4-openssl-dev
- apt_install imagemagick libmagickwand-dev
- apt_install libsqlite3-dev libpq-dev libreadline5-dev
- apt_install git-core
- apt_install redis-server
- apt_install libffi-dev libffi-ruby
- #
- apt_install rubygems
- gem install bundler --no-ri --no-rdoc
- gem install oauth2 --no-ri --no-rdoc
- gem install omniauth --no-ri --no-rdoc
- #
- # check bundler
- ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle
- PATH=$PATH:/usr/local/bin
- #
- [ ! -d /root/git ] && mkdir /root/git
- cd /root/git
- [ ! -d /root/git/diaspora ] && git clone http://github.com/diaspora/diaspora.git
- cd diaspora
- export DB="mysql"
- bundle install --without development test
- bundle update
- #
- make_startscript >/root/diaspora.sh
- chmod 0700 /root/diaspora.sh
- #
- # simple way to start it automatically
- #echo "/root/diaspora.sh >/root/diaspora_rclocal.log 2>&1" >/etc/rc.local
- echo "exit 0" >>/etc/rc.local
- #
- # tell the world what we've done!
- #echo 'TKL Diaspora' >> /etc/issue
- #
- cleanup_apt
- #
- echo "Done"
- #EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement