Improve menu and generation

This commit is contained in:
Joshua Boniface 2019-06-14 11:27:45 -04:00
parent 0482c4f0bd
commit 3134c8d793
5 changed files with 68 additions and 35 deletions

View File

@ -9,17 +9,25 @@
liveisofile="$( pwd )/debian-live-buster-DI-rc1-amd64-standard.iso"
fail() {
echo $@
exit 1
}
which debootstrap &>/dev/null || fail "This script requires debootstrap."
which mksquashfs &>/dev/null || fail "This script requires squashfs."
which xorriso &>/dev/null || fail "This script requires xorriso."
tempdir=$( mktemp -d )
cleanup() {
echo -n "Cleaning up... "
sudo rm -rf ${tempdir} &>/dev/null
echo "done."
echo
}
fail() {
echo $@
cleanup
exit 1
}
prepare_iso() {
echo -n "Creating directories... "
mkdir ${tempdir}/rootfs/ ${tempdir}/installer/ || fail "Error creating temporary directories."
@ -31,8 +39,6 @@ prepare_iso() {
sudo rsync -au --exclude live/filesystem.squashfs ${iso_tempdir}/ ${tempdir}/installer/ &>/dev/null || fail "Error extracting LiveISO files."
sudo umount ${iso_tempdir} &>/dev/null || fail "Error unmounting LiveISO file."
rmdir ${iso_tempdir} &>/dev/null
sudo cp -a grub.cfg ${tempdir}/installer/boot/grub/grub.cfg &>/dev/null || fail "Error copying grub.cfg file."
sudo cp -a menu.cfg ${tempdir}/installer/isolinux/menu.cfg &>/dev/null || fail "Error copying menu.cfg file."
echo "done."
}
@ -63,11 +69,20 @@ prepare_rootfs() {
echo "done."
echo -n "Generating squashfs image of live installation... "
sudo nice mksquashfs ${tempdir}/rootfs/ ${tempdir}/installer/live/install.squashfs -e boot &>/dev/null || fail "Error generating squashfs."
if [[ ! -f filesystem.squashfs ]]; then
sudo nice mksquashfs ${tempdir}/rootfs/ ${tempdir}/installer/live/filesystem.squashfs -e boot &>/dev/null || fail "Error generating squashfs."
cp ${tempdir}/installer/live/filesystem.squashfs filesystem.squashfs &>/dev/null
fi
echo "done."
}
build_iso() {
echo -n "Copying live boot configurations... "
sudo cp -a grub.cfg ${tempdir}/installer/boot/grub/grub.cfg &>/dev/null || fail "Error copying grub.cfg file."
sudo cp -a menu.cfg ${tempdir}/installer/isolinux/menu.cfg &>/dev/null || fail "Error copying menu.cfg file."
sudo cp -a splash.png ${tempdir}/installer/isolinux/splash.png &>/dev/null || fail "Error copying splash.png file."
echo "done."
echo -n "Creating LiveCD ISO... "
pushd ${tempdir}/installer &>/dev/null
xorriso -as mkisofs \
@ -87,16 +102,13 @@ build_iso() {
echo "done."
echo -n "Moving generated ISO to '$(pwd)/pvc-installer.iso'... "
mv ${tempdir}/pvc-installer.iso . &>/dev/null || fail "Error moving ISO file."
mv ${tempdir}/pvc-installer.iso pvc-installer-new.iso &>/dev/null || fail "Error moving ISO file."
echo "done."
}
prepare_iso
prepare_rootfs
build_iso
cleanup
echo -n "Cleaning up... "
sudo rm -rf ${tempdir} &>/dev/null
echo "done."
echo
echo "PVC Live Installer ISO generation complete."

View File

@ -28,7 +28,7 @@ set loopback="findiso=${iso_path}"
fi
set timeout=10
menuentry "PVC Live Installer" {
menuentry "PVC Live Installer TEST" {
linux /live/vmlinuz boot=live components splash quiet "${loopback}"
initrd /live/initrd.img
}

View File

@ -155,6 +155,23 @@ set -o errexit
exec 1> >( tee -ia ${logfile} )
exec 2> >( tee -ia ${logfile} >/dev/null )
cleanup() {
echo -n "Cleaning up... "
umount ${target}/sys >&2
umount ${target}/proc >&2
umount ${target}/dev/pts >&2
umount ${target}/dev >&2
umount ${target}/var/lib/ceph >&2
umount ${target}/boot/efi >&2
umount ${target}/boot >&2
umount ${target} >&2
vgchange -an >&2
rmdir ${target} >&2
echo "done."
echo
}
trap cleanup EXIT
echo -n "Bringing up primary network interface in ${target_netformat} mode... "
case ${target_netformat} in
'static')
@ -190,34 +207,34 @@ partprobe >&2
echo "done."
echo -n "Creating LVM PV... "
pvcreate -ffy ${target_disk}3 >&2
yes | pvcreate -ffy ${target_disk}3 >&2
echo "done."
echo -n "Creating LVM VG named 'vgx'... "
vgcreate vgx ${target_disk}3 >&2
yes | vgcreate vgx ${target_disk}3 >&2
echo "done."
echo -n "Creating root logical volume (16GB, ext4)... "
lvcreate -L 16G -n root vgx >&2
mkfs.ext4 /dev/vgx/root >&2
yes | mkfs.ext4 /dev/vgx/root >&2
echo "done."
echo -n "Creating ceph logical volume (16GB, ext4)... "
lvcreate -L 16G -n ceph vgx >&2
yes | lvcreate -L 16G -n ceph vgx >&2
mkfs.ext4 /dev/vgx/ceph >&2
echo "done."
echo -n "Creating swap logical volume (8GB)... "
lvcreate -L 8G -n swap vgx >&2
mkswap -f /dev/vgx/swap >&2
yes | mkswap -f /dev/vgx/swap >&2
echo "done."
echo -n "Creating boot partition filesystem... "
mkfs.ext2 ${target_disk}2 >&2
yes | mkfs.ext2 ${target_disk}2 >&2
echo "done."
echo -n "Creating ESP partition filesystem... "
mkdosfs -F32 ${target_disk}1 >&2
yes | mkdosfs -F32 ${target_disk}1 >&2
echo "done."
echo -n "Mounting disks on temporary target... "
@ -287,17 +304,7 @@ chroot ${target} grub-install --target=x86_64-efi ${target_disk} >&2
chroot ${target} update-grub >&2
echo "done."
echo -n "Cleaning up... "
umount ${target}/sys >&2
umount ${target}/proc >&2
umount ${target}/dev/pts >&2
umount ${target}/dev >&2
umount ${target}/var/lib/ceph >&2
umount ${target}/boot/efi >&2
umount ${target}/boot >&2
umount ${target} >&2
echo "done."
echo
cleanup
titlestring_text="| PVC node installation finished. Press <Enter> to reboot into the installed system. |"
titlestring_len="$( wc -c <<<"${titlestring_text}" )"

View File

@ -1,7 +1,21 @@
INCLUDE stdmenu.cfg
UI vesamenu.c32
MENU background splash.png
MENU color title * #FFFFFFFF *
MENU color border * #00000000 #00000000 none
MENU color sel * #ffffffff #76a1d0ff *
MENU color hotsel 1;7;37;40 #ffffffff #76a1d0ff *
MENU color timeout_msg * #ffffffff #00000000 none
MENU color tabmsg * #ffffffff #00000000 *
MENU color help 37;40 #ffdddd00 #00000000 *
MENU vshift 8
MENU tabmsg Press ENTER to boot or TAB to edit a menu entry
MENU title PVC Live Installer
DEFAULT PVC Live Installer
TIMEOUT 10
MENU default PVC Live Installer
MENU clear
LABEL PVC Live Installer
SAY "Booting PVC Live Installer..."
linux /live/vmlinuz

BIN
splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB