@@ -13,54 +13,63 @@ test -e Makefile && make distclean
1313
1414./configure
1515
16- make -j $( nproc)
16+ make -j " $( nproc) "
1717
18- VERSION=$( $( dirname $0 ) /git-version-gen --prefix " " .)
19- if test x $SKIP_CHECKS = x ; then
20- grep $VERSION NEWS
18+ VERSION=" $( " $( dirname " $0 " ) /git-version-gen" --prefix " " .) "
19+ if test " $SKIP_CHECKS " = " " ; then
20+ grep " $VERSION " NEWS
2121fi
2222
2323OUTDIR=${OUTDIR:- release-$VERSION }
24- if test -e $OUTDIR ; then
24+ if test -e " $OUTDIR " ; then
2525 echo " the directory $OUTDIR already exists" >&2
2626 exit 1
2727fi
2828
29- mkdir -p $OUTDIR
29+ mkdir -p " $OUTDIR "
3030
3131rm -f crun-* .tar*
3232
3333make dist-gzip
3434make ZSTD_OPT=" --ultra -c22" dist-zstd
3535
36- mv crun-* .tar.gz $OUTDIR
37- mv crun-* .tar.zst $OUTDIR
36+ mv crun-* .tar.gz " $OUTDIR "
37+ mv crun-* .tar.zst " $OUTDIR "
3838
3939make distclean
4040
41- RUNTIME=${RUNTIME:- podman}
42- RUNTIME_EXTRA_ARGS=${RUNTIME_EXTRA_ARGS:- }
41+ read -r -a RUNTIME_EXTRA_ARGS <<< " ${RUNTIME_EXTRA_ARGS:-}"
42+
43+ BUILD_CMD=(
44+ " ${RUNTIME:- podman} " run --init --rm
45+ " ${RUNTIME_EXTRA_ARGS[@]} "
46+ --privileged
47+ -v /nix:/nix -v " ${PWD} :${PWD} "
48+ -w " ${PWD} "
49+ " ${NIX_IMAGE} "
50+ nix
51+ --extra-experimental-features nix-command
52+ --print-build-logs
53+ --option cores " $( nproc) "
54+ --option max-jobs " $( nproc) "
55+ build
56+ --max-jobs auto
57+ )
4358
4459mkdir -p /nix
4560
46- NIX_ARGS=" --extra-experimental-features nix-command --print-build-logs --option cores $( nproc) --option max-jobs $( nproc) "
47-
4861for ARCH in amd64 arm64 ppc64le riscv64 s390x; do
49- $RUNTIME run --init --rm $RUNTIME_EXTRA_ARGS --privileged -v /nix:/nix -v ${PWD} :${PWD} -w ${PWD} ${NIX_IMAGE} \
50- nix $NIX_ARGS build --max-jobs auto --file nix/default-${ARCH} .nix
51- cp ./result/bin/crun $OUTDIR /crun-$VERSION -linux-${ARCH}
52-
62+ " ${BUILD_CMD[@]} " --file nix/default-${ARCH} .nix
63+ cp ./result/bin/crun " $OUTDIR /crun-$VERSION -linux-${ARCH} "
5364 rm -rf result
5465
55- $RUNTIME run --init --rm $RUNTIME_EXTRA_ARGS --privileged -v /nix:/nix -v ${PWD} :${PWD} -w ${PWD} ${NIX_IMAGE} \
56- nix $NIX_ARGS build --max-jobs auto --file nix/default-${ARCH} .nix --arg enableSystemd false
57- cp ./result/bin/crun $OUTDIR /crun-$VERSION -linux-${ARCH} -disable-systemd
58-
66+ " ${BUILD_CMD[@]} " --file nix/default-${ARCH} .nix --arg enableSystemd false
67+ cp ./result/bin/crun " $OUTDIR /crun-$VERSION -linux-${ARCH} -disable-systemd"
5968 rm -rf result
6069done
6170
62- if test x $SKIP_GPG = x ; then
63- for i in $OUTDIR /* ; do
64- gpg2 -b --armour $i
71+ if test " $SKIP_GPG " = " " ; then
72+ for i in " $OUTDIR " /* ; do
73+ gpg2 -b --armour " $i "
6574 done
6675fi
0 commit comments