2021-03-06 03:41:56 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
shopt -s nullglob
|
|
|
|
|
2021-03-06 05:41:03 +00:00
|
|
|
PODMAN_IMAGE=${PODMAN_IMAGE:-'localhost/spark:autobuilder'}
|
|
|
|
export PODMAN_IMAGE
|
|
|
|
|
2021-03-06 03:41:56 +00:00
|
|
|
did="pkg-build-$$.$SRANDOM"
|
|
|
|
mkdir "/tmp/$did"
|
|
|
|
|
|
|
|
pkg_dest=$1
|
|
|
|
pkg_url=$2
|
|
|
|
|
2021-03-06 06:02:39 +00:00
|
|
|
mkdir -p "$pkg_dest" || exit 1
|
|
|
|
|
2021-03-06 03:41:56 +00:00
|
|
|
git clone "$pkg_url" "/tmp/$did"
|
|
|
|
cd "/tmp/$did"
|
2021-03-06 05:41:03 +00:00
|
|
|
makepkg-podman --noconfirm -sL
|
2021-03-06 03:41:56 +00:00
|
|
|
|
|
|
|
artifacts=( "/tmp/$did/"*.pkg.* )
|
|
|
|
for i in "${artifacts[@]}"; do
|
|
|
|
i_name="${i##*/}"
|
|
|
|
|
|
|
|
printf 'Found artifact: %s\n' "$i_name"
|
|
|
|
|
|
|
|
if [[ -f "$pkg_dest/$i_name" ]]; then
|
|
|
|
printf '%s/%s already exists, not overwriting.\n' "$pkg_dest" "$i_name"
|
|
|
|
else
|
|
|
|
printf 'Copying %s to %s.\n' "$i_name" "$pkg_dest"
|
|
|
|
cp -vn "$i" "$pkg_dest"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# cleanup
|
|
|
|
rm -rf "/tmp/$did"
|