Handle failing to bind mount
This commit is contained in:
parent
cc7b0047c4
commit
b9768d98fd
|
@ -110,13 +110,18 @@ prepare_rootfs() {
|
||||||
SQUASHFS_PKGLIST="mdadm,lvm2,parted,gdisk,debootstrap,grub-pc,grub-efi-amd64,linux-image-amd64,sipcalc,live-boot,dosfstools,vim,ca-certificates"
|
SQUASHFS_PKGLIST="mdadm,lvm2,parted,gdisk,debootstrap,grub-pc,grub-efi-amd64,linux-image-amd64,sipcalc,live-boot,dosfstools,vim,ca-certificates"
|
||||||
if [[ ! -d artifacts/debootstrap ]]; then
|
if [[ ! -d artifacts/debootstrap ]]; then
|
||||||
sudo mkdir -p artifacts/debootstrap/var/cache/apt/archives &>/dev/null
|
sudo mkdir -p artifacts/debootstrap/var/cache/apt/archives &>/dev/null
|
||||||
sudo mount --bind /var/cache/apt/archives artifacts/debootstrap/var/cache/apt/archives &>/dev/null
|
clean_me="y"
|
||||||
|
sudo mount --bind /var/cache/apt/archives artifacts/debootstrap/var/cache/apt/archives &>/dev/null && clean_me=""
|
||||||
sudo /usr/sbin/debootstrap \
|
sudo /usr/sbin/debootstrap \
|
||||||
--include=${SQUASHFS_PKGLIST} \
|
--include=${SQUASHFS_PKGLIST} \
|
||||||
buster \
|
buster \
|
||||||
artifacts/debootstrap/ \
|
artifacts/debootstrap/ \
|
||||||
http://ftp.ca.debian.org/debian &>debootstrap.log || fail "Error performing debootstrap."
|
http://ftp.ca.debian.org/debian &>debootstrap.log || fail "Error performing debootstrap."
|
||||||
sudo umount artifacts/debootstrap/var/cache/apt/archives &>/dev/null
|
if [[ -n ${clean_me} ]]; then
|
||||||
|
sudo chroot artifacts/debootstrap/ apt clean &>/dev/null || fail "Error cleaning apt cache in debootstrap."
|
||||||
|
else
|
||||||
|
sudo umount artifacts/debootstrap/var/cache/apt/archives &>/dev/null
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
sudo rsync -au artifacts/debootstrap/ ${tempdir}/rootfs/ &>/dev/null || fail "Error copying debootstrap to tempdir."
|
sudo rsync -au artifacts/debootstrap/ ${tempdir}/rootfs/ &>/dev/null || fail "Error copying debootstrap to tempdir."
|
||||||
echo "done."
|
echo "done."
|
||||||
|
|
Loading…
Reference in New Issue