From c92b2f42550bf37721ab523aa3438c84fd0349fb Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 16 Jul 2021 12:03:11 -0400 Subject: [PATCH] Stage for python application to actually execute the install --- .../profiles/default/scripts/installimage | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/installimage b/confluent_osdeploy/el8-diskless/profiles/default/scripts/installimage index ae8d92ed..feae46c2 100644 --- a/confluent_osdeploy/el8-diskless/profiles/default/scripts/installimage +++ b/confluent_osdeploy/el8-diskless/profiles/default/scripts/installimage @@ -1,4 +1,32 @@ #!/bin/bash . /etc/confluent/functions -run_remote_python getinstalldisk -run_remote_parts pre.d +# the image will be used to deploy itself +# provide both access to image (for parsing metadata) +# and existing mounts of image (to take advantage of caching) +mkdir -p /sysroot/run/imginst/sourceimage +mount -o bind /mnt/remoteimg /sysroot/run/imginst/sourceimage +mount -o bind /sys /sysroot/sys +mount -o bind /dev /sysroot/dev +if [ ! -f /tmp/mountparts.sh ]; then + mkdir -p /sysroot/run/imginst/sources/_ + mount -o bind /mnt/remote /sysroot/run/imginst/sources/_ +else + for srcmount in $(cat /tmp/mountparts.sh | awk '{print $2}'); do + srcname=${srcmount#/dev/mapper/mproot} + srcdir=$(echo $srcmount | sed -e 's!/dev/mapper/mproot!/mnt/remote!' -e 's!_!/!g') + mkdir -p /sysroot/run/imginst/sources/$srcname + mount -o bind $srcdir /sysroot/run/imginst/sources/$srcname + done +fi +cd /sysroot/run +chroot /sysroot/ bash -c "source /etc/confluent/functions; run_remote_python getinstalldisk" +chroot /sysroot/ bash -c "source /etc/confluent/functions; run_remote_parts pre.d" +if [ ! -f /sysroot/tmp/installdisk ]; then + echo 'Unable to find a suitable installation target device, ssh to port 2222 to investigate' + while [ ! -f /sysroot/tmp/installdisk ]; do + sleep 1 + done +fi +lvm vgchange -a n +chroot /sysroot bash -c "source /etc/confluent/functions; run_remote_python image2disk.py" +