Add better messages to indicate skipping

This commit is contained in:
Joshua Boniface 2023-09-01 15:41:56 -04:00
parent ee98ed1fe7
commit bf8bf11ef7
1 changed files with 15 additions and 7 deletions

View File

@ -68,7 +68,7 @@ while getopts "h?o:s:au:" opt; do
done done
srcliveisopath="https://cdimage.debian.org/mirror/cdimage/release/current-live/amd64/iso-hybrid" srcliveisopath="https://cdimage.debian.org/mirror/cdimage/release/current-live/amd64/iso-hybrid"
srcliveisofilename="$( wget -O- ${srcliveisopath}/ | grep 'debian-live-.*-amd64-standard.iso' | awk -F '"' '{ print $6 }' )" srcliveisofilename="$( wget -O- ${srcliveisopath}/ 2>/dev/null | grep 'debian-live-.*-amd64-standard.iso' | awk -F '"' '{ print $6 }' )"
srcliveisourl="${srcliveisopath}/${srcliveisofilename}" srcliveisourl="${srcliveisopath}/${srcliveisofilename}"
srcliveisofile="$( basename ${srcliveisourl} )" srcliveisofile="$( basename ${srcliveisourl} )"
@ -95,10 +95,12 @@ prepare_iso() {
mkdir ${tempdir}/rootfs/ ${tempdir}/installer/ &>/dev/null || fail "Error creating temporary directories." mkdir ${tempdir}/rootfs/ ${tempdir}/installer/ &>/dev/null || fail "Error creating temporary directories."
echo "done." echo "done."
if [[ ! -f artifacts/${srcliveisofile} ]]; then
echo -n "Downloading Debian Live ISO... " echo -n "Downloading Debian Live ISO... "
if [[ ! -f artifacts/${srcliveisofile} ]]; then
wget -O artifacts/${srcliveisofile} ${srcliveisourl} &>/dev/null || { rm -f artifacts/${srcliveisofile}; fail "Error downloading source ISO."; } wget -O artifacts/${srcliveisofile} ${srcliveisourl} &>/dev/null || { rm -f artifacts/${srcliveisofile}; fail "Error downloading source ISO."; }
echo "done." echo "done."
else
echo "using cached file 'artifacts/${srcliveisofile}'."
fi fi
echo -n "Extracting Debian Live ISO files... " echo -n "Extracting Debian Live ISO files... "
@ -132,9 +134,12 @@ prepare_rootfs() {
else else
sudo umount artifacts/debootstrap/var/cache/apt/archives &>/dev/null 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."
else
sudo rsync -au artifacts/debootstrap/ ${tempdir}/rootfs/ &>/dev/null || fail "Error copying debootstrap to tempdir."
echo "using cached debootstrap 'artifacts/debootstrap'."
fi
echo -n "Configuring Debian live installation... " echo -n "Configuring Debian live installation... "
sudo cp -a artifacts/debootstrap/boot/vmlinuz* ${tempdir}/installer/live/vmlinuz &>/dev/null || fail "Error copying kernel." sudo cp -a artifacts/debootstrap/boot/vmlinuz* ${tempdir}/installer/live/vmlinuz &>/dev/null || fail "Error copying kernel."
@ -157,9 +162,12 @@ prepare_rootfs() {
rm -f artifacts/filesystem.squashfs &>/dev/null rm -f artifacts/filesystem.squashfs &>/dev/null
fi fi
sudo nice mksquashfs ${tempdir}/rootfs/ artifacts/filesystem.squashfs -e boot &>/dev/null || fail "Error generating squashfs." sudo nice mksquashfs ${tempdir}/rootfs/ artifacts/filesystem.squashfs -e boot &>/dev/null || fail "Error generating squashfs."
fi
sudo rsync -a artifacts/filesystem.squashfs ${tempdir}/installer/live/filesystem.squashfs &>/dev/null || fail "Error copying squashfs to tempdir." sudo rsync -a artifacts/filesystem.squashfs ${tempdir}/installer/live/filesystem.squashfs &>/dev/null || fail "Error copying squashfs to tempdir."
echo "done." echo "done."
else
sudo rsync -a artifacts/filesystem.squashfs ${tempdir}/installer/live/filesystem.squashfs &>/dev/null || fail "Error copying squashfs to tempdir."
echo "using cached squashfs 'artifacts/filesystem.squashfs'."
fi
} }
build_iso() { build_iso() {
@ -195,7 +203,7 @@ build_iso() {
echo "done." echo "done."
echo -n "Moving generated ISO to './${isofilename}'... " echo -n "Moving generated ISO to './${isofilename}'... "
mv ${tempdir}/${isofilename} ${isofilename} &>/dev/null || fail "Error moving ISO file." mv -f ${tempdir}/${isofilename} ${isofilename} &>/dev/null || fail "Error moving ISO file."
echo "done." echo "done."
} }