cleanup with a trap
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
0181a1099f
commit
8adeef05bc
15
makepkg-ci
15
makepkg-ci
|
@ -1,19 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
shopt -s nullglob
|
||||
|
||||
cleanup() { rm -rf "$tmpdir"; }
|
||||
trap 'cleanup' EXIT
|
||||
|
||||
did="pkg-build-$$.$SRANDOM"
|
||||
mkdir "/tmp/$did"
|
||||
tmpdir="/tmp/$did"
|
||||
mkdir "$tmpdir"
|
||||
|
||||
pkg_dest=$1
|
||||
pkg_url=$2
|
||||
|
||||
mkdir -p "$pkg_dest" || exit 1
|
||||
|
||||
git clone "$pkg_url" "/tmp/$did"
|
||||
cd "/tmp/$did"
|
||||
git clone "$pkg_url" "$tmpdir"
|
||||
cd "$tmpdir"
|
||||
makepkg-podman --noconfirm -sL
|
||||
|
||||
artifacts=( "/tmp/$did/"*.pkg.* )
|
||||
artifacts=( "$tmpdir/"*.pkg.* )
|
||||
for i in "${artifacts[@]}"; do
|
||||
i_name="${i##*/}"
|
||||
|
||||
|
@ -26,6 +30,3 @@ for i in "${artifacts[@]}"; do
|
|||
cp -vn "$i" "$pkg_dest"
|
||||
fi
|
||||
done
|
||||
|
||||
# cleanup
|
||||
rm -rf "/tmp/$did"
|
||||
|
|
Loading…
Reference in New Issue
Block a user