Skip to content

Commit 213c31e

Browse files
ad-server: enable install-sambacc.sh to make use of rpm
This fixes a couple of bugs while were at it. Signed-off-by: John Mulligan <[email protected]>
1 parent 542e407 commit 213c31e

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

images/ad-server/install-sambacc.sh

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,46 @@
33
set -ex
44

55
wheeldir="$1"
6-
container_json_file="$2"
6+
if ! [ -d "${wheeldir}" ]; then
7+
echo "no directory: ${wheeldir}"
8+
exit 2
9+
fi
10+
11+
mapfile -d '' wheels < \
12+
<(find "${wheeldir}" -type f -name 'sambacc-*.whl' -print0)
13+
mapfile -d '' rpmfiles < \
14+
<(find "${wheeldir}" -type f -name '*sambacc-*.noarch.rpm' -print0)
715

8-
wheeldir=/tmp
9-
wheel="$(find "${wheeldir}" -type f -name 'sambacc-*.whl')" \
1016

11-
if ! [ "$(echo "$wheel" | wc -l)" = 1 ]; then
17+
if [ "${#wheels[@]}" -gt 1 ]; then
1218
echo "more than one wheel file found"
1319
exit 1
20+
elif [ "${#wheels[@]}" -eq 1 ]; then
21+
action=install-wheel
22+
fi
23+
24+
if [ "${#rpmfiles[@]}" -gt 1 ]; then
25+
echo "more than one rpm file found"
26+
exit 1
27+
elif [ "${#rpmfiles[@]}" -eq 1 ]; then
28+
action=install-rpm
1429
fi
1530

16-
pip install "$wheel"
17-
rm -f "$wheel"
31+
case $action in
32+
install-wheel)
33+
pip install "${wheels[0]}"
34+
container_json_file="/usr/local/share/sambacc/examples/addc.json"
35+
;;
36+
install-rpm)
37+
dnf install -y "${rpmfiles[0]}"
38+
dnf clean all
39+
container_json_file="/usr/share/sambacc/examples/addc.json"
40+
;;
41+
*)
42+
echo "no install package(s) found"
43+
exit 1
44+
;;
45+
esac
1846

1947
if [ "$container_json_file" ]; then
2048
ln -sf "$container_json_file" /etc/samba/container.json

0 commit comments

Comments
 (0)