/
install
executable file
·63 lines (52 loc) · 1.16 KB
/
install
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
#!/bin/bash
extension_args=()
while (( $# ))
do
token="$1"
shift
case "$token" in
(--trace|trace)
extension_args+=("--trace=all")
;;
(--prefix|prefix)
prefix_path="$1"
if ! shift
then
echo "ERROR: A prefix path must be followed by keyword 'prefix'."
exit 1
fi
;;
(DESTROOT)
DESTROOT="$1"
if ! shift
then
echo "ERROR: A DESTROOT path must be followed by keyword 'DESTROOT'."
exit 1
fi
;;
(*)
extension_args+=("$token")
;;
esac
done
if [[ -n "${prefix}" ]]
then
sm_path="${DESTROOT:-}${prefix}/sm"
elif [[ -z "${sm_path:-}" ]]
then
if (( UID ))
then
sm_path="${DESTROOT:-}$HOME/.sm"
else
sm_path="${DESTROOT:-}/opt/sm"
fi
fi
# set BDSM basic paths
install_path="${sm_path}" # Path to install everything to.
archives_path="${sm_path}/archives"
scm_path="${sm_path}/scm"
src_path="${sm_path}/src"
extension_sets_home="${sm_path}/sets"
extension_exts_home="${sm_path}/exts"
export install_path archives_path scm_path src_path extension_sets_home DESTROOT
exec "${PWD}/local" --call=install/install_sm "${extension_args[@]}"