Skip to content

Commit 0c030f9

Browse files
committed
common: implement an explicit preference order in sambacc installation
this explicitly implements a preference order for sambacc custom installation sources like so: wheeel -> rpm -> local repo -> copr. It makes the output a bit more verbose while at it. Signed-off-by: Michael Adam <[email protected]>
1 parent 21c22af commit 0c030f9

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

images/common/install-sambacc-common.sh

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,48 @@ install_sambacc() {
3131

3232

3333
local action=install-from-copr-repo
34-
if [ "${#wheels[@]}" -gt 1 ]; then
35-
echo "more than one wheel file found"
36-
exit 1
37-
elif [ "${#wheels[@]}" -eq 1 ]; then
38-
action=install-wheel
34+
local source_found=0
35+
if [ "${#wheels[@]}" -gt 0 ]; then
36+
echo "INFO: wheel found"
37+
if [ "${#wheels[@]}" -gt 1 ]; then
38+
echo "ERROR: more than one wheel file found"
39+
exit 1
40+
elif [ "${#wheels[@]}" -eq 1 ]; then
41+
echo "sambacc wheel found. Installing wheel."
42+
action=install-wheel
43+
source_found=1
44+
fi
3945
fi
40-
41-
if [ "${#rpmfiles[@]}" -gt 1 ]; then
42-
echo "more than one sambacc rpm file found"
43-
exit 1
44-
elif [ "${#rpmfiles[@]}" -eq 1 ]; then
45-
action=install-rpm
46+
if [ "${#rpmfiles[@]}" -gt 0 ]; then
47+
echo "INFO: rpm file found"
48+
if [ "${#rpmfiles[@]}" -gt 1 ]; then
49+
echo "ERROR: more than one sambacc rpm file found"
50+
exit 1
51+
elif [ "${#rpmfiles[@]}" -eq 1 ]; then
52+
echo "sambacc rpm found. preferring rpm install."
53+
action=install-rpm
54+
source_found=1
55+
fi
4656
fi
47-
48-
if [ "${#repofiles[@]}" -gt 1 ]; then
49-
echo "more than one repo file found"
50-
exit 1
51-
elif [ "${#repofiles[@]}" -eq 1 ]; then
52-
action=install-from-repo
57+
if [ "${#repofiles[@]}" -gt 0 ]; then
58+
echo "INFO: repo file found"
59+
if [ "${#repofiles[@]}" -gt 1 ]; then
60+
echo "ERROR: more than one repo file found"
61+
exit 1
62+
elif [ "${#repofiles[@]}" -eq 1 ]; then
63+
echo "sambacc repo file found. preferring install from local yum repo."
64+
action=install-from-repo
65+
source_found=1
66+
fi
5367
fi
68+
if [ "${source_found}" = "0"]; then
69+
echo "INFO: no local sambacc installation source found. falling back to copr install."
70+
action=install-from-copr-repo
71+
fi
72+
73+
echo "INFO: selected installation method: '${action}'"
74+
75+
5476

5577
if [ -z "${DEFAULT_JSON_FILE}" ]; then
5678
echo "DEFAULT_JSON_FILE value unset"

0 commit comments

Comments
 (0)