forked from ts-factory/test-environment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_ta_signature
executable file
·71 lines (61 loc) · 1.63 KB
/
get_ta_signature
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
#! /bin/bash
# SPDX-License-Identifier: Apache-2.0
#
# Test Environment Builder
#
# Script for calculation ta_signature for local or remote host
#
# Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.
usage()
{
cat <<EOF
Usage: get_te_signature [<generic options>]
Generic options:
--cc=<CC> Compiler with flags (default: "cc").
--host=<HOST> Remote host for signature calculation.
Calculation is performed locally if it is missing.
--te-base=<TE_BASE> Path to TE source directory.
Current directory will be used as default directory
if environment variable TE_BASE is not defined
--help, -h Display this help message and exit.
EOF
}
#
# Process script options
#
process_opts()
{
for opt ; do
case "$opt" in
--cc=* ) CC="${opt#--cc=}" ;;
--host=* ) HOST="${opt#--host=}" ;;
--te-base=* ) TE_BASE="${opt#--te-base=}" ;;
-h | --help )
usage
exit 0
;;
*) echo "Unknown option: $opt" >&2;
usage
exit 1
;;
esac
done
}
# Set default values
CC=cc
HOST=
if test -z "${TE_BASE}" ; then
TE_BASE=$(dirname "$(readlink -f "$(which $0)")")
fi
process_opts "$@"
if ! test -f "$TE_BASE/engine/builder/te_functions" ; then
echo "Cannot find TE scripts - exiting." >&2
exit 1
fi
. "$TE_BASE/engine/builder/te_functions"
# Calculate signature
if test -z "$HOST" ; then
te_ta_signature_local "$CC"
else
te_ta_signature "$HOST" "$CC"
fi