forked from eMoflon/emoflon-ibex-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prov.sh
151 lines (127 loc) · 3.47 KB
/
prov.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
#!/bin/bash
#
# Config
#
ECLIPSE_ARCHIVE=eclipse-gips-linux-user
set -e
START_PWD=$PWD
#
# Utils
#
# Displays the given input including "=> " on the console.
log () {
echo "=> $1"
}
#
# Script
#
log "Start provisioning."
# Updates
log "Installing updates."
sudo apt-get update
sudo apt-get upgrade -y
# Java/JDK21
log "Installing OpenJDK."
sudo apt-get install -y openjdk-21-jdk
#java --version
# Packages for building a new kernel
sudo apt-get install -y gcc make perl
# GIPS Eclipse
log "Installing GIPS Eclipse."
sudo apt-get install -y graphviz
mkdir -p ~/eclipse-apps
cd ~/eclipse-apps
# Get eclipse
if [[ ! -f "./$ECLIPSE_ARCHIVE.zip" ]]; then
log "Downloading latest GIPS Eclipse archive from Github."
curl -s --header "Authorization: Bearer ${GITHUB_TOKEN}" \
https://api.github.com/repos/Echtzeitsysteme/gips-eclipse-build/releases/latest \
| grep "$ECLIPSE_ARCHIVE.zip" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -q --header="Authorization: Bearer ${GITHUB_TOKEN}" -i - \
|| :
fi
if [[ ! -f "./$ECLIPSE_ARCHIVE.zip" ]]; then
log "Download of GIPS Eclipse archive failed."
exit 1;
fi
unzip -qq -o $ECLIPSE_ARCHIVE.zip
rm -f $ECLIPSE_ARCHIVE.zip
# Create desktop launchers
mkdir -p /home/vagrant/Desktop
touch /home/vagrant/Desktop/gips.desktop
printf "
[Desktop Entry]\n
Version=1.0\n
Name=GIPS Eclipse\n
Comment=Use GIPS Eclipse\n
GenericName=GIPS Eclipse\n
Exec=bash -c \"cd /home/vagrant/eclipse-apps/eclipse && ./eclipse\"\n
Terminal=false\n
X-MultipleArgs=false\n
Type=Application\n
Icon=/home/vagrant/eclipse-apps/eclipse/icon.xpm\n
StartupNotify=true\n
" > /home/vagrant/Desktop/gips.desktop
chmod u+x /home/vagrant/Desktop/gips.desktop
touch /home/vagrant/Desktop/gips-website.desktop
printf "
[Desktop Entry]
Encoding=UTF-8
Name=GIPS Website
Type=Link
URL=https://gips.dev/
Icon=web-browser
" > /home/vagrant/Desktop/gips-website.desktop
touch /home/vagrant/Desktop/gips-examples.desktop
printf "
[Desktop Entry]
Encoding=UTF-8
Name=GIPS Examples
Type=Link
URL=https://github.com/Echtzeitsysteme/gips-examples
Icon=web-browser
" > /home/vagrant/Desktop/gips-examples.desktop
touch /home/vagrant/Desktop/gips-tests.desktop
printf "
[Desktop Entry]
Encoding=UTF-8
Name=GIPS Test Suite
Type=Link
URL=https://github.com/Echtzeitsysteme/gips-tests
Icon=web-browser
" > /home/vagrant/Desktop/gips-tests.desktop
chmod u+x /home/vagrant/Desktop/*.desktop
log "Install GLPK ILP solver."
sudo apt-get install -yq \
glpk-utils \
libglpk-dev \
glpk-doc \
libglpk-java \
libglpk40
sudo cp /usr/lib/x86_64-linux-gnu/jni/libglpk_java.* /usr/lib
sudo mv /home/vagrant/Desktop/*.desktop /usr/share/xubuntu/applications/
sudo ln -s /usr/share/xubuntu/applications/gips.desktop /home/vagrant/Desktop/gips.desktop
sudo ln -s /usr/share/xubuntu/applications/gips-website.desktop /home/vagrant/Desktop/gips-website.desktop
sudo ln -s /usr/share/xubuntu/applications/gips-examples.desktop /home/vagrant/Desktop/gips-examples.desktop
sudo ln -s /usr/share/xubuntu/applications/gips-tests.desktop /home/vagrant/Desktop/gips-tests.desktop
# Install additional CLI tools
log "Install additional CLI tools."
sudo apt-get install -yq \
git \
ncdu \
htop \
tmux \
rsync
# Clean up
log "Clean-up"
sudo apt-get remove -yq \
libreoffice-* \
thunderbird \
pidgin \
gimp \
evolution
sudo apt-get autoremove -yq
sudo apt-get clean cache
log "Finished provisioning."