1
0
Fork 0

mock-build.sh: minor improvements

This commit is contained in:
Pratham Patel 2024-05-07 11:47:19 +05:30
parent a16c51f057
commit 644cd53fab
Signed by: thefossguy
SSH Key Fingerprint: SHA256:HwRBy9H1FYXWcv/Qi1WY3kmcVtGz2ydZuPJgD4pkusY
1 changed files with 10 additions and 9 deletions

View File

@ -8,20 +8,20 @@ if (! command -v mock > /dev/null) || (! groups | grep 'mock' > /dev/null); then
exit 1
fi
if [[ -z $1 ]]; then
if [[ -z "${1:-}" ]]; then
echo 'Need a SOURCES directory.'
exit 1
fi
if [[ ! -d $1 ]]; then
if [[ ! -d "$1" ]]; then
echo "'$1' is not a directory"
exit 1
fi
if [[ -z $2 ]]; then
if [[ -z "${2:-}" ]]; then
echo 'Need an RPM SPEC file.'
exit 1
fi
if [[ ! -f $2 ]]; then
if [[ ! -f "$2" ]]; then
echo "'$2' is not a file"
exit 1
fi
@ -37,14 +37,15 @@ if [[ ! -d "/var/lib/mock/$MOCK_ROOT" ]]; then
mock --root "$MOCK_ROOT" --init
fi
additional_args=( "$@" )
# shellcheck disable=SC2086
time mock \
$3 \
"${additional_args[@]:2}" \
--isolation nspawn \
--root $MOCK_ROOT \
--resultdir $MOCK_OUT \
--sources $1 \
--root "$MOCK_ROOT" \
--resultdir "$MOCK_OUT" \
--sources "$1" \
--no-cleanup-after \
--buildsrpm \
--spec $2 \
--spec "$2" \
--rebuild