forked from VolumetricBio/LightField
-
Notifications
You must be signed in to change notification settings - Fork 1
/
shared-stuff.sh
66 lines (54 loc) · 1.42 KB
/
shared-stuff.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
#shellcheck disable=SC2034
function clear () {
echo -ne "\x1B[0m\x1B[H\x1B[J\x1B[3J"
}
function blue-bar () {
echo -e "\r\e[1;37;44m$*\e[K\e[0m" 1>&2
}
function red-bar () {
echo -e "\r\e[1;33;41m$*\e[K\e[0m" 1>&2
}
function error-trap () {
red-bar 'Failed!'
exit 1
}
function apply-atsign-substitution () {
local CODE='\e[0;30;48;2;146;208;80m'
local RST='\e[0m'
# shellcheck disable=SC2145
echo -e "Substituting value ${CODE}${2}${RST} for token ${CODE}@@${1}@@${RST} in files ${CODE}${@:3}${RST}"
sed -i "s/@@${1}@@/${2}/g" "${@:3}"
}
function apply-assignment-substitution () {
local CODE='\e[0;30;48;2;0;146;208m'
local RST='\e[0m'
# shellcheck disable=SC2145
echo -e "Substituting value ${CODE}${2}${RST} into variable assignment ${CODE}${1}${RST} in files ${CODE}${@:3}${RST}"
sed -i 's/^'"${1}"'=.*$/'"${1}"'='"${2}"'/g' "${@:3}"
}
function generate-suffix () {
local RELEASE_TRAIN="${1}"
local BUILDTYPE="${2}"
if [ -z "${RELEASE_TRAIN}" ]
then
RELEASE_TRAIN=base
fi
if [ "${RELEASE_TRAIN}" = "base" ]
then
echo "${BUILDTYPE}"
else
echo "${RELEASE_TRAIN}-${BUILDTYPE}"
fi
}
DEFAULT_RELEASE_TRAIN=base
DEFAULT_ARCHITECTURE=$(uname -m)
if [ "${DEFAULT_ARCHITECTURE}" = "x86_64" ]
then
DEFAULT_ARCHITECTURE=amd64
fi
ARCHITECTURE=amd64
RELEASE_TRAIN=xdlp4710
VERSION=1.0.12.1652
trap error-trap ERR
set -e