forked from svenvc/pharo-server-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-pharo.sh
executable file
·56 lines (44 loc) · 1.48 KB
/
install-pharo.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
#!/bin/bash
script_home=$(dirname $0)
script_home=$(cd $script_home && pwd)
# If needed, modify VM version here
vm_version_short=8
# Some magick to switch VM options by version
# See https://stackoverflow.com/a/18124325
vm_version="$vm_version_short.0"
vm_options_8="--vm-display-null"
vm_options_9="--headless"
vm_options_10="--headless"
vm_options_11="--headless"
vm_options_var=vm_options_$vm_version_short
vm_options=${!vm_options_var}
vm_home=$(/usr/bin/realpath $script_home/../pharo/lib/$vm_version)
vm=$vm_home/pharo-vm/pharo
if [ -d $vm_home ]
then
read -r -p $'You are about to re-install the Pharo $vm_version runtime to $vm_home.\nThis will delete any existing files in that directory.\nContinue? [y/N] ' response
if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
echo Cancelled.
exit 1
fi
# Remove directory recursively
rm -rfv $vm_home
fi
echo "Downloading and installing Pharo $vm_version runtime"
# Ensure directory exists
mkdir -p $vm_home
cd $vm_home
zeroconf_url=https://get.pharo.org/64/${vm_version/\./}+vm
curl $zeroconf_url | bash
# Remove script to run interactive / headful mode (unused)
rm $vm_home/pharo-ui
mkdir -p ~/pharo/build
echo "Successfully installed the following Pharo runtime:"
$vm $vm_options $vm_home/Pharo.image printVersion
if [ ! -e /etc/systemd/system/[email protected] ]
then
echo "Copying systemd unit status alert service"
sudo cp [email protected] /etc/systemd/system/
sudo systemctl daemon-reload
fi