-
Notifications
You must be signed in to change notification settings - Fork 22
/
install.sh
executable file
·43 lines (34 loc) · 794 Bytes
/
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
#!/bin/sh
#
# Installs the TLA+ convenience binaries. Requires that tla2tools.jar is
# downloaded already.
#
# Usage: sudo install.sh /usr/local
# or sudo install.sh /usr
# or ./install.sh ~/.local
#
set -e
PREFIX="$1"
if [ -z "$PREFIX" ]; then
PREFIX=/usr/local
fi
# Try cleaning up dirty files from last run
rm -rf staging
# Stage the files in bin/*
mkdir -p staging
cp -r bin staging/bin
# Modify the staged files so they use the $PREFIX
if [ `uname -s` = Linux ]; then
# GNU sed
sed -i -e s_PREFIX_"$PREFIX"_ staging/bin/*
else
# BSD sed
sed -i '' -e s_PREFIX_"$PREFIX"_ staging/bin/*
fi
# Install everything
install -dv $PREFIX/lib
install -v tla2tools.jar $PREFIX/lib
install -dv $PREFIX/bin
install -v staging/bin/* $PREFIX/bin
# Cleanup
rm -rf staging