forked from includeos/IncludeOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·91 lines (76 loc) · 2.44 KB
/
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
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
#!/bin/sh
# OPTIONS:
#
# Location of the IncludeOS repo (assumes current folder if not defined), e.g.:
# $ export INCLUDEOS_SRC=your/github/cloned/IncludeOS
export INCLUDEOS_SRC=${INCLUDEOS_SRC-`pwd`}
SYSTEM=`uname -s`
RELEASE=$([ $SYSTEM = "Darwin" ] && echo `sw_vers -productVersion` || echo `lsb_release -is`)
[ "$RELEASE" = "neon" ] && RELEASE="Ubuntu"
check_os_support() {
SYSTEM=$1
RELEASE=$2
case $SYSTEM in
"Darwin")
return 0;
;;
"Linux")
case $RELEASE in
"Ubuntu"|"LinuxMint")
return 0;
;;
"Fedora")
export INCLUDEOS_SRC=`pwd`
return 0;
;;
"Arch")
return 0;
;;
esac
esac
return 1;
}
# check if sudo is available
if ! command -v sudo > /dev/null 2>&1; then
echo -e ">>> Sorry <<< \n\
The command sudo was not found. \n"
exit 1
fi
# check if system is supported at all
if ! check_os_support $SYSTEM $RELEASE; then
echo -e ">>> Sorry <<< \n\
Currently only Ubuntu, Fedora, Arch, and OSX are actively supported for *building* IncludeOS. \n\
On other Linux distros it shouldn't be that hard to get it to work - take a look at\n \
./etc/install_from_bundle.sh \n"
exit 1
fi
# now install build requirements (compiler, etc). This was moved into
# a function of its own as it can easen the setup.
if ! ./etc/install_build_requirements.sh $SYSTEM $RELEASE; then
echo -e ">>> Sorry <<< \n\
Could not install build requirements. \n"
exit 1
fi
# if the --all-source parameter was given, build it the hard way
if [ "$1" = "--all-source" ]; then
echo ">>> Installing everything from source"
./etc/install_all_source.sh
elif [ "Darwin" = "$SYSTEM" ]; then
# TODO: move build dependencies to the install build requirements step
./etc/install_osx.sh
elif [ "Linux" = "$SYSTEM" ]; then
echo -e "\n\n>>> Calling install_from_bundle.sh script"
if ! ./etc/install_from_bundle.sh; then
echo -e ">>> Sorry <<< \n\
Could not install from bundle. \n"
exit 1
fi
echo -e "\n\n>>> Creating a virtual network, i.e. a bridge. (Requires sudo)"
if ! ./etc/create_bridge.sh; then
echo -e ">>> Sorry <<< \n\
Could not create or configure bridge. \n"
exit 1
fi
echo -e "\n\n>>> Done! Test your installation with ./test.sh"
fi
exit 0