You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assets/feature-installer-utils.sh
+45-3Lines changed: 45 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,31 @@
1
-
# Execute a command and if it fails, return its output and exit
1
+
# Set some informative variables
2
+
3
+
# The flavour we're running on
4
+
FLAVOUR="$(cat /home/cloudcontrol/flavour)"
5
+
export FLAVOUR
6
+
7
+
# The path to install software binaries to
8
+
BINPATH="/home/cloudcontrol/bin"
9
+
export BINPATH
10
+
11
+
TEMPDIR=""
12
+
export TEMPDIR
13
+
14
+
# Prepare feature installation. Will create a temporary directory and change to it
15
+
functionprepare {
16
+
TEMPDIR=$(mktemp -d)
17
+
cd"${TEMPDIR}"||exit
18
+
}
19
+
20
+
# Cleanup the previously generated temporary directory
21
+
functioncleanup {
22
+
cd - &>/dev/null ||exit
23
+
rm -rf "${TEMPDIR}"
24
+
}
25
+
26
+
# Usage: execHandle MESSAGE COMMAND...
27
+
#
28
+
# Output MESSAGE and then execute COMMAND. If it fails, return its output and exit
2
29
functionexecHandle {
3
30
TITLE=$1
4
31
shift
@@ -38,6 +65,7 @@ function waitForMfaCode {
38
65
echo"[VALID_CODE] Valid code entered. Thank you."
39
66
}
40
67
68
+
# Get the hardware platform we're on and translate it to the usual platform names used in most software
41
69
functiongetPlatform {
42
70
if [ "$(uname -m)"=='aarch64' ]
43
71
then
@@ -50,18 +78,32 @@ function getPlatform {
50
78
fi
51
79
}
52
80
81
+
# Usage: checkAndCleanVersion VERSION
82
+
#
83
+
# Includes checks for version numbers and removes the "v" prefix from it to have a homogeneous version scheme
84
+
# throughout CloudControl.
53
85
functioncheckAndCleanVersion {
54
86
VERSION=$1
55
87
if [ "${VERSION:0:1}"=="v" ]
56
88
then
57
-
echo"[DEPRECATION WARNING] Versions with a \"v\" prefix are deprecated and will be removed in CloudControl 4.0. Please only use versions without the \"v\" prefix. (Got \"${VERSION}\")">&2
89
+
echo"[DEPRECATION WARNING] Versions with a \"v\" prefix are deprecated and will be removed in CloudControl 6.0.0 Please only use versions without the \"v\" prefix. (Got \"${VERSION}\")">&2
58
90
echo"${VERSION/#v/}"
59
91
else
60
92
echo"${VERSION}"
61
93
fi
62
94
}
63
95
96
+
# Usage: download URL FILENAME
97
+
#
98
+
# Downloads the given URL into the provided FILENAME
0 commit comments