Skip to content

Commit 9ae5ef3

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: local repo -> rpm -> wheeel -> copr. It makes the output a bit more verbose while at it. Signed-off-by: Michael Adam <[email protected]>
1 parent 21c22af commit 9ae5ef3

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

images/common/install-sambacc-common.sh

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,44 @@ install_sambacc() {
3030
done
3131

3232

33-
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
33+
local action=""
34+
echo "INFO: determining sambacc installation source."
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+
action=install-wheel
42+
fi
3943
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
44+
if [ "${#rpmfiles[@]}" -gt 0 ]; then
45+
echo "INFO: rpm file found"
46+
if [ "${#rpmfiles[@]}" -gt 1 ]; then
47+
echo "ERROR: more than one sambacc rpm file found"
48+
exit 1
49+
elif [ "${#rpmfiles[@]}" -eq 1 ]; then
50+
action=install-rpm
51+
fi
4652
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
53+
if [ "${#repofiles[@]}" -gt 0 ]; then
54+
echo "INFO: repo file found"
55+
if [ "${#repofiles[@]}" -gt 1 ]; then
56+
echo "ERROR: more than one repo file found"
57+
exit 1
58+
elif [ "${#repofiles[@]}" -eq 1 ]; then
59+
action=install-from-repo
60+
fi
5361
fi
62+
if [ -z "${action}" ]; then
63+
64+
echo "INFO: no local sambacc installation source found. falling back to copr install."
65+
action=install-from-copr-repo
66+
fi
67+
68+
echo "INFO: selected installation method: '${action}'"
69+
70+
5471

5572
if [ -z "${DEFAULT_JSON_FILE}" ]; then
5673
echo "DEFAULT_JSON_FILE value unset"

0 commit comments

Comments
 (0)