-
Notifications
You must be signed in to change notification settings - Fork 10
/
invenio-kickstart
executable file
·101 lines (88 loc) · 3.4 KB
/
invenio-kickstart
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
#
# A helper devscript to kickstart Invenio development environment with
# an Invenio demo site on a fresh (virtual) machine in a fully
# automated, unassited way. Tested mostly on Debian, Ubuntu,
# Scientific Linux, CentOS. For more information, please see
# <https://github.com/tiborsimko/invenio-devscripts>.
#
# Tibor Simko <[email protected]>
#
# Copyright (C) 2013, 2014 CERN.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# config section:
export CFG_INVENIO_SRCDIR=${CFG_INVENIO_SRCDIR:=~/private/src/invenio}
export CFG_INVENIO_PORT_HTTP=${CFG_INVENIO_PORT_HTTP:=80}
export CFG_INVENIO_PORT_HTTPS=${CFG_INVENIO_PORT_HTTPS:=443}
# sanity check: CLI confirmation
if [[ "$@" != *"--yes-i-know"* ]]; then
echo "[ERROR] You did not use --yes-i-know. Not going to kickstart Invenio on this machine."
exit 1
fi
if [[ "$@" != *"--yes-i-really-know"* ]]; then
echo "[ERROR] You did not use --yes-i-really-know. Not going to kickstart Invenio on this machine."
exit 1
fi
# which branch are we installing?
BRANCH=master # let's assume invenio/master by default
for arg in "$@"; do
if [ "$arg" != "--yes-i-know" ] && [ "$arg" != "--yes-i-really-know" ]; then
BRANCH=$arg
fi
done
# quit on errors and potentially unbound symbols:
set -o errexit
set -o nounset
# give user a chance to quit:
echo "[INFO] DANGER, DANGER! KICK-STARTING THIS BOX IN 5 SECONDS!"
echo -n "[INFO] THIS IS YOUR LAST CHANCE TO INTERRUPT BY PRESSING Ctrl-C! "
for i in 0 1 2 3 4; do
echo -n "."
sleep 1
done
echo
# does the box have git?
if [ ! -e /usr/bin/git ] && [ ! -e /usr/local/bin/git ] ; then
echo "[ERROR] Cannot find git. Please install it."
echo "[ERROR] Example: sudo apt-get install -y git."
exit 1
fi
# clone devscripts:
mkdir -p $(dirname ${CFG_INVENIO_SRCDIR})
cd $(dirname ${CFG_INVENIO_SRCDIR})
if [ -d invenio-devscripts/.git ]; then
echo "[INFO] invenio-devscripts sources seem to be already installed."
else
git clone https://github.com/tiborsimko/invenio-devscripts.git
fi
if [ -d invenio/.git ]; then
echo "[INFO] invenio sources seem to be already installed."
else
git clone https://github.com/inveniosoftware/invenio.git
(cd invenio && git checkout $BRANCH)
fi
# set up env/opt/home development environment:
invenio-devscripts/invenio-setup-environment --yes-i-know
# Now we have to reread CFG_INVENIO_* variables set up in the previous
# step. Let's use eval here, since e.g. on Ubuntu vagrant box,
# with default settings, non-interactive reloading of ~/.bashrc is
# forbidden
eval $(grep "export CFG_INVENIO" $HOME/.bashrc)
eval $(grep "export PATH=" $HOME/.bashrc)
# install Apache/MySQL/Python/etc prerequisites:
invenio-devscripts/invenio-setup-prerequisites --yes-i-know
# install Invenio demo site instance:
invenio-devscripts/invenio-recreate-demo-site --yes-i-know
# end of file