Skip to content

Commit a32f9cd

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 6bae989 commit a32f9cd

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

images/common/install-sambacc-common.sh

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,36 @@ 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
39-
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-
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
34+
if [ "${#wheels[@]}" -gt 0 ]; then
35+
echo "INFO: wheel found"
36+
if [ "${#wheels[@]}" -gt 1 ]; then
37+
echo "more than one wheel file found"
38+
exit 1
39+
elif [ "${#wheels[@]}" -eq 1 ]; then
40+
echo "sambacc wheel found. Installing wheel."
41+
action=install-wheel
42+
fi
43+
elif [ "${#rpmfiles[@]}" -gt 0 ]; then
44+
echo "INFO: rpm file found"
45+
if [ "${#rpmfiles[@]}" -gt 1 ]; then
46+
echo "more than one sambacc rpm file found"
47+
exit 1
48+
elif [ "${#rpmfiles[@]}" -eq 1 ]; then
49+
echo "sambacc rpm found. installing rpm."
50+
action=install-rpm
51+
fi
52+
elif [ "${#repofiles[@]}" -gt 1 ]; then
53+
echo "INFO: repo file found"
54+
if [ "${#repofiles[@]}" -gt 1 ]; then
55+
echo "more than one repo file found"
56+
exit 1
57+
elif [ "${#repofiles[@]}" -eq 1 ]; then
58+
echo "sambacc repo file found. installing from local yum repo."
59+
action=install-from-repo
60+
fi
61+
else
62+
echo "no local sambacc installation source found. falling back to copr install."
63+
action=install-from-copr-repo
5364
fi
5465

5566
if [ -z "${DEFAULT_JSON_FILE}" ]; then

0 commit comments

Comments
 (0)