-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
INSTALL_linux.sh
executable file
·75 lines (69 loc) · 2.08 KB
/
INSTALL_linux.sh
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
63
64
65
66
67
68
69
70
71
72
73
74
75
#/bin/bash
echo ''
echo '[*] Welcome to the installer for edit.tosdr.org!'
echo ''
echo ' ###############'
echo ' ###############'
echo ' ########### I have read and agreed to the terms'
echo ' ########### is the biggest lie on the web.'
echo ' #######'
echo ' ####### We aim to fix that.'
sleep 1;
echo ''
export PATH="$HOME/.rbenv/bin:$PATH"
if [ -d ~/.rbenv/plugins/ruby-build ]; then
echo 'You have Rbenv!'
else
echo '[*] Installing Rbenv'
export PATH="$HOME/.rbenv/shims:$PATH"
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash
echo "Setting up rbenv in your shell..."
fi
eval "$(rbenv init -)"
if rbenv versions --bare | grep -q 2.7.2 ; then
echo "You have Ruby 2.7.2!"
else
echo '[*] Installing Ruby 2.7.2, it might take a while...'
rbenv install 2.7.2
fi
if hash yarn 2>/dev/null; then
echo 'You have yarn!'
else
echo '[*] Installing yarn'
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get -y install yarn
fi
if hash psql 2>/dev/null; then
echo 'You have postgres!'
else
echo '[*] Installing postgres'
sudo apt-get install -y postgresql postgresql-contrib libpq-dev build-essential
# TODO: find a way to setup postgres for the user
#echo `whoami` > /tmp/caller
#sudo su - postgres
#psql --command "CREATE ROLE `cat /tmp/caller` LOGIN createdb;"
#exit
#rm -f /tmp/caller
fi
if command -v phantomjs > /dev/null ; then
echo 'You have phantomjs!'
else
echo '[*] Installing phantomjs'
sudo apt-get -y install phantomjs
fi
echo '[*] Setting local ruby version to 2.7.2'
rbenv local 2.7.2
if rbenv which bundle 2&>1 > /dev/null ; then
echo 'You have bundler!'
else
echo '[*] Installing budler'
gem install bundler
fi
echo '[*] Installing gems'
bundle install
echo '[*] Compiling JS'
yarn install
echo '[*] Setting up the database'
rails db:create db:migrate
echo '[*] You are ready to go! Run "rails server" to start the server'