Advertisement
Guest User

diaspora setup on TKL lamp

a guest
Nov 12th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.44 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. apt_prepare()
  4. {
  5.     if [ $exist = 0 ] ; then
  6.       echo "deb http://ppa.launchpad.net/maco.m/ruby/ubuntu lucid main" >>$apt_srcfn
  7.       apt-key adv --keyserver keyserver.ubuntu.com --recv 85960EAD
  8.     fi
  9.     apt-get update
  10. }
  11.  
  12. apt_install()
  13. {
  14.     DEBIAN_FRONTEND=noninteractive apt-get -y \
  15.         -o DPkg::Options::=--force-confdef \
  16.         -o DPkg::Options::=--force-confold \
  17.         --no-install-recommends \
  18.        install $@
  19. }
  20. cleanup_apt()
  21. {
  22.     rm -r /var/cache/apt/*
  23.     mkdir /var/cache/apt/archives
  24.     mkdir /var/cache/apt/archives/partial
  25. }
  26.  
  27. make_startscript()
  28. {
  29.   cat <<EOF
  30. #!/bin/bash
  31. #
  32. export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  33. cd /root/git/diaspora
  34. #
  35. # -- check if already running
  36. pid=\$(ps awx | grep 'thin start -p 3000' | grep -v grep | awk '{print \$1}')
  37. if [ -n "\$pid" ] ; then
  38.    echo "Killing current running diaspora version"
  39.    kill \$pid
  40. fi
  41. #
  42. # test if we need to sync first
  43. if [ "\$1" = "update"  ] ; then
  44.    echo "Updating version...."
  45.    git pull
  46.    bundle install
  47.    bundle update
  48. fi
  49. #
  50. echo "Starting Diaspora "
  51. cd /root/git/diaspora
  52. ./script/server
  53. # --- give it some time...
  54. sleep 5
  55. echo "Done"
  56. #
  57. exit 0
  58. EOF
  59. }
  60. #
  61. #
  62. apt_srcfn=/etc/apt/sources.list.d/sources.list
  63. apt_prepare
  64. #
  65. apt_install build-essential libxslt1.1 libxslt1-dev libxml2
  66. apt_install libmysqlclient-dev libmysql-ruby
  67. apt_install ruby-full
  68. apt_install libssl-dev libopenssl-ruby libcurl4-openssl-dev
  69. apt_install imagemagick libmagickwand-dev
  70. apt_install libsqlite3-dev libpq-dev libreadline5-dev
  71. apt_install git-core
  72. apt_install redis-server
  73. apt_install libffi-dev libffi-ruby
  74. #
  75. apt_install rubygems
  76. gem install bundler --no-ri --no-rdoc
  77. gem install oauth2 --no-ri --no-rdoc
  78. gem install omniauth --no-ri --no-rdoc
  79. #
  80. # check bundler
  81. ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle
  82. PATH=$PATH:/usr/local/bin
  83. #
  84. [ ! -d /root/git ] && mkdir /root/git
  85. cd /root/git
  86. [ ! -d /root/git/diaspora ] &&  git clone http://github.com/diaspora/diaspora.git
  87. cd diaspora
  88. export DB="mysql"
  89. bundle install --without development test
  90. bundle update
  91. #
  92. make_startscript >/root/diaspora.sh
  93. chmod 0700 /root/diaspora.sh
  94. #
  95. # simple way to start it automatically
  96. #echo "/root/diaspora.sh >/root/diaspora_rclocal.log 2>&1" >/etc/rc.local
  97. echo "exit 0" >>/etc/rc.local
  98. #
  99. # tell the world what we've done!
  100. #echo 'TKL Diaspora' >> /etc/issue
  101. #
  102. cleanup_apt
  103. #
  104. echo "Done"
  105. #EOF
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement