Skip to content

Commit bd28817

Browse files
obnoxxxmergify[bot]
authored andcommitted
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 bd28817

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

images/common/install-sambacc-common.sh

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,42 @@ 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
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
61+
fi
62+
if [ -z "${action}" ]; then
4763

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
64+
echo "INFO: no local sambacc installation source found. falling back to copr install."
65+
action=install-from-copr-repo
5366
fi
5467

68+
echo "INFO: selected installation method: '${action}'"
5569
if [ -z "${DEFAULT_JSON_FILE}" ]; then
5670
echo "DEFAULT_JSON_FILE value unset"
5771
exit 1

0 commit comments

Comments
 (0)