-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
187 lines (169 loc) · 5.75 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/bash
#
# This is a complex installer that allows internationalization
# The goal behind it is allowing as many people getting access to this
# knowledge as possible by giving them the chance to read what is being
# done in their computers in their own language
#
# Please contribute translating the *.po files to as many languages as possible
# I accept pull-requests in exchange for credit
#
# (Copyleft) D. Cuartielles, 2016, GPLv3
##
# POC around i18n/Localization in a bash script
# create the localization files for all available languages
cd locale
source ./generate_translations.sh
cd ..
# initialiaze the global variables needed for your default language
export TEXTDOMAINDIR=locale
export TEXTDOMAIN=install.sh
I18NLIB=libs/i18n-lib.sh
# source in I18N library - shown above
# this is the only message that cannot be translated
if [[ -f $I18NLIB ]]
then
. $I18NLIB
else
printf "ERROR - $I18NLIB NOT FOUND"
exit 1
fi
## Start of script
# clear the screen
clear
# are we root yet? You need to be sudo if you're gonna install things
if [ $(whoami) != 'root' ]; then
i18n_display "Need to be root"
# printf "$0"
exit 1;
fi
## ALLOW USER TO SET LANG PREFERENCE
## assume lang and country code follows
##XXX this part isn't working yet, I comment it away
#if [[ "$1" = "-lang" ]]
#then
# export LC_ALL="$2_$3.UTF-8"
#fi
# Display initial greeting
printf "\n#######################################################################\n\n"
i18n_display "Greeting"
# Install all dependencies
printf "\n#######################################################################\n\n"
i18n_display "Install dependencies"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm installation")
if [[ $install == I* ]]; then
i18n_display "Confirmed action"
sudo apt-get install build-essential clang bison flex libreadline-dev \
gawk tcl-dev libffi-dev git mercurial graphviz \
xdot pkg-config python python3 libftdi-dev git
else
i18n_display "Skipped action"
fi
# create a temporary installation folder
mkdir install.tmp
# Install Icestorm
printf "\n#######################################################################\n\n"
i18n_display "Install icestorm"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm installation")
if [[ $install == I* ]]; then
i18n_display "Confirmed action"
cd install.tmp
git clone https://github.com/cliffordwolf/icestorm.git icestorm
cd icestorm
make -j$(nproc)
sudo make install
cd ..
cd ..
else
i18n_display "Skipped action"
fi
# Install Arachne-pnr
printf "\n#######################################################################\n\n"
i18n_display "Install arachnepnr"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm installation")
if [[ $install == I* ]]; then
i18n_display "Confirmed action"
cd install.tmp
git clone https://github.com/cseed/arachne-pnr.git arachne-pnr
cd arachne-pnr
make -j$(nproc)
sudo make install
cd ..
cd ..
else
i18n_display "Skipped action"
fi
# Install Yosys
printf "\n#######################################################################\n\n"
i18n_display "Install yosys"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm installation")
if [[ $install == I* ]]; then
i18n_display "Confirmed action"
cd install.tmp
git clone https://github.com/cliffordwolf/yosys.git yosys
cd yosys
make -j$(nproc)
sudo make install
cd ..
cd ..
else
i18n_display "Skipped action"
fi
# Install Icarus Verilog
printf "\n#######################################################################\n\n"
i18n_display "Install icarus"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm installation")
if [[ $install == I* ]]; then
i18n_display "Confirmed action"
sudo add-apt-repository ppa:team-electronics/ppa
sudo apt-get update
sudo apt-get install iverilog
else
i18n_display "Skipped action"
fi
# Install GTKWave
printf "\n#######################################################################\n\n"
i18n_display "Install gtkwave"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm installation")
if [[ $install == I* ]]; then
i18n_display "Confirmed action"
sudo apt-get install gtkwave
else
i18n_display "Skipped action"
fi
# Delete temp files
printf "\n#######################################################################\n\n"
i18n_display "Delete temp files"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm deletion")
if [[ $install == C* ]]; then
i18n_display "Confirmed action"
rm -fR install.tmp
else
i18n_display "Skipped action"
fi
# Download courseware
printf "\n#######################################################################\n\n"
i18n_display "Download courseware"
printf "\n#######################################################################\n\n"
install=$(i18n_prompt "Confirm installation")
if [[ $install == I* ]]; then
i18n_display "Confirmed action"
git clone https://github.com/Obijuan/open-fpga-verilog-tutorial.git open-fpga-verilog-tutorial
else
i18n_display "Skipped action"
fi
# Display final remarks
printf "\n#######################################################################\n\n"
i18n_display "Credits"
printf "\n#######################################################################\n\n"
i18n_display "Copyright"
printf "\n#######################################################################\n\n"
# Install ends here
exit 0