forked from NZOI/nztrain
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·49 lines (33 loc) · 898 Bytes
/
install.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
#!/bin/bash
for ARG in "$@"
do
case $ARG in
"--skip-update")
update=false
;;
*)
;;
esac
done
# note, we are bashing the echoes so that "sh update.sh" will still print coloured output
cd `dirname $0`
# TODO: create db if it doesn't exist (and prompt for db details to create, or option to change details)
# install imagemagick
cmd="sudo apt-get install imagemagick"
bash -c "echo -e '\E[34m\033[1m$cmd\033[0m'"
$cmd
# check if database.yml exists, if not, copy from database.yml.default
if [ ! -f config/database.yml ];
then
cmd="cp config/database.yml.default config/database.yml"
bash -c "echo -e '\E[34m\033[1m$cmd\033[0m'"
$cmd
fi
# make directories for storage
cmd="mkdir db/data/uploads/user/avatar/ -p"
bash -c "echo -e '\E[34m\033[1m$cmd\033[0m'"
$cmd
# update as normal
if ${update:=true} ; then
bash update.sh --skip-pull
fi