blob: 5ae0f39fa08bad692547773b14adc7bc75250e2a (
plain)
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
|
#!/bin/sh
set -e
log() {
echo 1>&2
echo "== $* ==" 1>&2
}
here=`dirname "$0"`
APP_ROOT=`cd "$here"/.. && env - pwd`
cd "$APP_ROOT"
log Beginning system bootstrap
# System-specific bootstrapping
# TODO: Add support for more systems
# TODO: Add system detection
if test -r /etc/os-release; then
id=`. /etc/os-release && echo "$ID"`
if test -r bin/bootstrap.d/"$id".sh; then
. bin/bootstrap.d/"$id".sh
fi
fi
log Initializing the database
echo "CREATE ROLE derpibooru WITH createdb LOGIN PASSWORD 'password';" | (cd / && exec sudo sudo -u $DB_USER $DB_PROG)
log System bootstrap complete
log Beginning user bootstrap
if ! test -x "$HOME"/.rbenv/bin/rbenv; then
log Installing rbenv
git clone https://github.com/rbenv/rbenv.git "$HOME"/.rbenv
(cd "$HOME"/.rbenv && src/configure && exec make -C src)
fi
if ! test -d "$HOME"/.rbenv/plugins/ruby-build; then
log Installing ruby-build
git clone https://github.com/rbenv/ruby-build.git "$HOME"/.rbenv/plugins/ruby-build
fi
PATH=$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH
export PATH
echo 'eval "$(rbenv init -)"' >>"$HOME"/.bashrc
RUBY_VERSION=`head -1 <.ruby-version`
log Installing Ruby $RUBY_VERSION
rbenv install -s "$RUBY_VERSION"
rbenv global "$RUBY_VERSION"
log Installing Ruby gems
gem install bundler
log User bootstrap complete
|