-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_deps.sh
123 lines (114 loc) 路 1.98 KB
/
install_deps.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
DEPS_ALPINE=(
build-base
gmp-dev
mpc
mpfr-dev
bison
flex
texinfo
nasm
mtools
qemu-system-x86_64
python3
py3-pip
scons
py3-parted
py3-sh
)
DEPS_DEBIAN=(
build-essential
bison
flex
libgmp3-dev
libmpc-dev
libmpfr-dev
texinfo
nasm
mtools
qemu-system-x86
python3-pip
scons
)
DEPS_FEDORA=(
gcc
gcc-c++
make
bison
flex
gmp-devel
libmpc-devel
mpfr-devel
texinfo
nasm
mtools
qemu-system-x86
python3-pip
python3-scons
)
DEPS_ARCH=(
gcc
make
bison
flex
libgmp-static
libmpc
mpfr
texinfo
nasm
mtools
qemu-system-x86
python3-pip
scons
)
DEPS_SUSE=()
OS=
PACKAGE_UPDATE=
PACKAGE_INSTALL=
DEPS=
# Detect distro
if [ -x "$(command -v apk)" ]; then
OS='alpine'
PACKAGE_UPDATE='apk update'
PACKAGE_INSTALL='apk add --no-cache'
echo "Alpine not supported."
exit 1
elif [ -x "$(command -v apt-get)" ]; then
OS='debian'
PACKAGE_UPDATE='apt-get update'
PACKAGE_INSTALL='apt-get install'
DEPS="${DEPS_DEBIAN[@]}"
elif [ -x "$(command -v dnf)" ]; then
OS='fedora'
PACKAGE_INSTALL='dnf install'
DEPS="${DEPS_FEDORA[@]}"
elif [ -x "$(command -v yum)" ]; then
OS='fedora'
PACKAGE_INSTALL='yum install'
DEPS="${DEPS_FEDORA[@]}"
elif [ -x "$(command -v zypper)" ]; then
OS='suse'
PACKAGE_INSTALL='zypper install'
DEPS="$DEPS_SUSE"
elif [ -x "$(command -v pacman)" ]; then
OS='arch'
PACKAGE_UPDATE='pacman -Syy'
PACKAGE_INSTALL='pacman -S'
DEPS="${DEPS_ARCH[@]}"
else
echo "Unknown operating system!";
fi
# Install dependencies
echo ""
echo "Will install dependencies by running the following command."
echo ""
echo " $ $PACKAGE_INSTALL ${DEPS[@]}"
echo ""
read -p "Continue (y/n)?" choice
case "$choice" in
y|Y ) ;;
* ) echo "Exiting..."
exit 0
;;
esac
$PACKAGE_UPDATE
$PACKAGE_INSTALL ${DEPS[@]}