Only overwrite with a tarball if we haven't already set up an install

This commit is contained in:
Salt 2020-12-03 04:46:42 -06:00
parent a3882a3bc7
commit f2aa7e2f26
1 changed files with 7 additions and 2 deletions

View File

@ -104,6 +104,8 @@ build-gentoo() {
chmod 0600 "$file"
done
# We grab the checksums first to verify the integrity of any tarball leftover from a previous run
local shouldextract=1
[ -f "$_optdest/bin/bash" ] && unset shouldextract
log "Downloading stage3 signature"
curl -s "$stage3.DIGESTS" -o "$stage3sig"
if ! [ -f "$stage3file" ]; then
@ -117,8 +119,11 @@ build-gentoo() {
if ! grep "$stage3sig" -e "$(sha512sum "$stage3file" | awk '{print $1}')" > /dev/null 2>&1; then
error "stage3 checksum verification failed" 50
fi
log "Decompressing tarball; this will prompt for root privileges"
sudo tar xf "$stage3file" -C "$_optdest"
if [ -n "$shouldextract" ]; then
log "Decompressing tarball; this will prompt for root privileges"
sudo tar xf "$stage3file" -C "$_optdest"
fi
unset shouldextract
# Now we do some pre-chroot configuration
pushd "$_optdest" > /dev/null 2>&1