From 55037bc239001a0d1c0139749dfe85e1bfe50286 Mon Sep 17 00:00:00 2001 From: Zespre Chang Date: Sat, 9 Mar 2024 23:46:26 +0800 Subject: [PATCH] feat: support local iso mount for unattended install When in the auto-install mode and the "local" keyword is provided in the "ISO_URL" variable, the installer will try to mount the ISO from the local device /dev/sr0. Signed-off-by: Zespre Chang --- .../harvester-os/files/usr/sbin/harv-install | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/package/harvester-os/files/usr/sbin/harv-install b/package/harvester-os/files/usr/sbin/harv-install index 99ae4cbaf..4455d8605 100755 --- a/package/harvester-os/files/usr/sbin/harv-install +++ b/package/harvester-os/files/usr/sbin/harv-install @@ -119,7 +119,10 @@ get_url() check_iso(){ if [ -n "$HARVESTER_ISO_URL" ]; then - echo "Checking ISO URL.." + if [ "$HARVESTER_ISO_URL" = "local" ]; then + return + fi + echo "Checking ISO URL..." check_url "$HARVESTER_ISO_URL" fi } @@ -127,11 +130,16 @@ check_iso(){ get_iso() { if [ -n "$HARVESTER_ISO_URL" ]; then - echo "Downloading ISO.." ISOMNT=$(mktemp -d -p /tmp cos.XXXXXXXX.isomnt) - ISOTEMP=$(mktemp -p ${TARGET}/usr/local cos.XXXXXXXX.iso) - get_url ${HARVESTER_ISO_URL} ${ISOTEMP} - ISO_DEVICE=$(losetup --show -f $ISOTEMP) + if [ "$HARVESTER_ISO_URL" = "local" ]; then + echo "Using local ISO..." + ISO_DEVICE="/dev/sr0" + else + echo "Downloading ISO..." + ISOTEMP=$(mktemp -p ${TARGET}/usr/local cos.XXXXXXXX.iso) + get_url ${HARVESTER_ISO_URL} ${ISOTEMP} + ISO_DEVICE=$(losetup --show -f $ISOTEMP) + fi mount -o ro ${ISO_DEVICE} ${ISOMNT} fi }