Skip to content

Commit b687945

Browse files
authored
Merge pull request #61 from kpcyrd/tmp
Improve build directory bootstrapping
2 parents 2f09b43 + bcf170b commit b687945

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

repro.in

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ CONFIGDIR='REPRO_CONFIG_DIR'
1111
## Hardcoded until further notice
1212
HOSTMIRROR="http://mirror.neuf.no/archlinux/\$repo/os/\$arch"
1313

14-
# IMGDIRECTORY=$(mktemp -dt .arch_img)
15-
IMGDIRECTORY="/tmp/arch_img"
16-
mkdir -p $IMGDIRECTORY
14+
IMGDIRECTORY=$(mktemp -dt XXXXXXXXXX.arch_img)
15+
trap "{ rm -r $IMGDIRECTORY; }" EXIT
1716

1817
DIFFOSCOPE="diffoscope"
1918

@@ -283,16 +282,14 @@ __END__
283282

284283
# Desc: Fetches a bootstrap image and verifies the signature
285284
function get_bootstrap_img() {
286-
trap '{ rm "$IMGDIRECTORY/$bootstrap_img"{,.sig} ; exit 1; }' ERR
287285
if [ ! -e "$IMGDIRECTORY/$bootstrap_img" ]; then
288286
msg "Downloading bootstrap image..."
289-
( cd "$IMGDIRECTORY" && curl --remote-name-all "$BOOTSTRAPMIRROR/$bootstrap_img"{,.sig} )
287+
( cd "$IMGDIRECTORY" && curl -f --remote-name-all "$BOOTSTRAPMIRROR/$bootstrap_img"{,.sig} )
290288
if ! gpg --verify "$IMGDIRECTORY/$bootstrap_img.sig" "$IMGDIRECTORY/$bootstrap_img"; then
291289
error "Can't verify image"
292290
exit 1
293291
fi
294292
fi
295-
trap - ERR
296293
}
297294

298295
# Desc: Prints the help section
@@ -339,7 +336,7 @@ done
339336
# Save command args (such as path to .pkg.tar.xz file)
340337
shift $((OPTIND-1))
341338

342-
get_bootstrap_img
343339
check_root
340+
test -d "$BUILDDIRECTORY"/root || get_bootstrap_img
344341
init_chroot
345342
cmd_check "$@"

0 commit comments

Comments
 (0)