-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathinstall.sh
executable file
·50 lines (40 loc) · 1.49 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
#!/usr/bin/env bash
# derived from install script in https://github.com/sstephenson/bats
set -e
resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
PREFIX="$1"
if [ -z "$1" ]; then
{ echo "usage: $0 <prefix>"
echo " e.g. $0 /usr/local"
} >&2
exit 1
fi
SEM_ROOT="$(abs_dirname "$0")"
mkdir -p "$PREFIX"/{bin,src,scripts,template}
cp -R "$SEM_ROOT"/bin/* "$PREFIX"/bin
cp -R "$SEM_ROOT"/lib/* "$PREFIX"/src
cp -R "$SEM_ROOT"/scripts/* "$PREFIX"/scripts
cp -R "$SEM_ROOT"/template/* "$PREFIX"/template
cp "$SEM_ROOT"/LICENSE "$PREFIX"
cp "$SEM_ROOT"/VERSION "$PREFIX"
eval "./util/update-library-path.rb $PREFIX/bin/sem-add ${PREFIX}/src/schema-evolution-manager.rb"
eval "./util/update-library-path.rb $PREFIX/bin/sem-apply ${PREFIX}/src/schema-evolution-manager.rb"
eval "./util/update-library-path.rb $PREFIX/bin/sem-baseline ${PREFIX}/src/schema-evolution-manager.rb"
eval "./util/update-library-path.rb $PREFIX/bin/sem-dist ${PREFIX}/src/schema-evolution-manager.rb"
eval "./util/update-library-path.rb $PREFIX/bin/sem-info ${PREFIX}/src/schema-evolution-manager.rb"
eval "./util/update-library-path.rb $PREFIX/bin/sem-init ${PREFIX}/src/schema-evolution-manager.rb"
rm "$PREFIX/bin/sem-config"
echo "Installed schema-evolution-manager scripts to $PREFIX/bin"