-
In essence, for the omnibus package (which contains all release types of the compiler), I have created a wrapper script around the actual install scripts for each release type. There is some room for improvement in this design, but given that we are getting this `for free' by CMake, I don't think its a large maintenance overhead.
2f6eebd4
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
#!/usr/bin/env bash
# Created by the SaC Development Team (C) 2016 - 2017
# This script is a wrapper around the installer scripts, the installer
# scripts are designed to install the SaC libraries and compile the binaries
# from source and install these as well. This wrapper allows us to call
# all the installer scripts in one go.
#
# For more information, have a look at the comments in the installer scripts.
#
# Globals
#
# this is left intentionally uninitialised
INSTALLDIR=
#
# Helper functions
#
msg() { echo "> ${@}"; }
msg2() { echo "==> ${@}"; }
usage() { echo "Usage: $0 [-h] -i INSTALL" 1>&2; }
# FIXME (hans) update link in description...
help_msg() {
cat <<EOF >&2
This is a simple wrapper to launch the installer scripts
for the different variants of the SaC2C compiler.
Options:
-h Print this help message and exit
-i INSTALL Specify the installation location
For more information: See www.sac-home.org/downloads
EOF
}
#
# Functions
#
## Argument Parsing
argparse()
{
local idir=
while getopts "hi:" o; do
case "${o}" in
i)
idir="$OPTARG"
;;
h)
usage
help_msg
exit 0
;;
\?) # if we pass any flag that is unknown
usage
exit 1
;;
esac
done
# if no options were passed, we just show a message and exit
if [[ $OPTIND == 1 ]]; then
msg "No options passed..." 1>&2
usage
exit 0
fi
shift $((OPTIND-1))
if [[ "z$idir" = "z" ]]; then
msg "Install directory is empty!" 1>&2
exit 10
fi
INSTALLDIR="$idir"
}
#
# Main Procedure
#
argparse ${@}
# We assume that this script will only be used from the extracted archive
# directory!
if [[ ! -d "$PWD/installers" ]]; then
msg "This script is not being run from withing" \
" the SaC extracted archive directory!" >&2
exit 10
fi
# We get the list of installers, and run them
INSTALLERS=$PWD/installers/*.sh
for installer in $INSTALLERS; do
msg "Running installer \`$installer'"
bash $installer -i "$INSTALLDIR" -s "$PWD"
if [[ $? != 0 ]]; then
msg2 "An error occurred, aborting..." 1>&2
exit $?
fi
done
msg "Done"
exit 0
# vim: ts=2 sw=2 et: