Remove respawn and promote skip_blockcheck

1. Remove the respawning and replace with a restart, since it never
worked properly. Also add a "DONE" flag to prevent repeated triggering
during cleanup.

2. Promote the skip_blockcheck to a requested configuration item and a
fully-featured key in the tftp preseed file.
This commit is contained in:
Joshua Boniface 2023-09-01 15:41:57 -04:00
parent 23834a2c61
commit f5773eb2d7
1 changed files with 30 additions and 26 deletions

View File

@ -66,12 +66,6 @@ suppkglist="firmware-linux,firmware-linux-nonfree,firmware-bnx2,firmware-bnx2x,n
# roles will overwrite it by default during configuration. # roles will overwrite it by default during configuration.
root_password="hCb1y2PF" root_password="hCb1y2PF"
# Respawn function
respawn() (
echo "Respawning..."
$0 & disown
)
# Checkin function # Checkin function
seed_checkin() ( seed_checkin() (
case ${1} in case ${1} in
@ -189,7 +183,7 @@ interactive_config() {
done done
)" )"
echo "2) Please enter the disk to install the PVC base system to. This disk will be" echo "2a) Please enter the disk to install the PVC base system to. This disk will be"
echo "wiped, an LVM PV created on it, and the system installed to this LVM." echo "wiped, an LVM PV created on it, and the system installed to this LVM."
echo "* NOTE: PVC requires a disk of at least 30GB to be installed to, and 100GB is the" echo "* NOTE: PVC requires a disk of at least 30GB to be installed to, and 100GB is the"
echo "recommended minimum size for optimal production partition sizes." echo "recommended minimum size for optimal production partition sizes."
@ -220,6 +214,16 @@ interactive_config() {
echo echo
done done
echo "2b) Skip disk zeroing? Only recommended for slow, low-endurance, or known-"
echo -n "zeroed block devices. [y/N] "
read skip_blockcheck
if [[ ${skip_blockcheck} == 'y' || ${skip_blockcheck} == 'Y' ]]; then
skip_blockcheck="y"
else
skip_blockcheck=""
fi
echo
for interface in $( ip address | grep '^[0-9]' | grep 'eno\|enp\|ens\|wlp' | awk '{ print $2 }' | tr -d ':' ); do for interface in $( ip address | grep '^[0-9]' | grep 'eno\|enp\|ens\|wlp' | awk '{ print $2 }' | tr -d ':' ); do
ip link set ${interface} up ip link set ${interface} up
done done
@ -489,15 +493,19 @@ cleanup() {
echo "done." echo "done."
echo echo
case ${install_option} in if [[ -n ${DONE} ]]; then
on) case ${install_option} in
respawn on)
;; echo "A fatal error occurred; rebooting in 10 seconds."
*) sleep 10
# noop reboot
true ;;
;; *)
esac # noop
true
;;
esac
fi
} }
trap cleanup EXIT trap cleanup EXIT
@ -525,8 +533,8 @@ vgchange -an >&2 || true
echo "done." echo "done."
blockcheck() { blockcheck() {
# Use for testing only # Skip checking if the key is set
if [[ -n ${SKIP_BLOCKCHECK} ]]; then if [[ -n ${skip_blockcheck} ]]; then
return return
fi fi
@ -833,19 +841,15 @@ chroot ${target} grub-install --force --target=${bios_target} ${target_disk} >&2
chroot ${target} grub-mkconfig -o /boot/grub/grub.cfg >&2 chroot ${target} grub-mkconfig -o /boot/grub/grub.cfg >&2
echo "done." echo "done."
DONE="y"
seed_postinst() { seed_postinst() {
cleanup cleanup
echo "Temporary root password: ${root_password}" echo "Temporary root password: ${root_password}"
seed_checkin end seed_checkin end
echo -n "Rebooting in 10 seconds..." echo "Rebooting in 10 seconds."
i=10 sleep 10
while [[ ${i} -gt 0 ]]; do
sleep 1
i=$(( ${1} - 1 ))
echo -n "."
done
echo
reboot reboot
} }