From patchwork Tue Oct 8 10:22:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "alexander.heinisch" X-Patchwork-Id: 3857 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Tue, 08 Oct 2024 12:23:27 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-io1-f60.google.com (mail-io1-f60.google.com [209.85.166.60]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 498ANP9o023278 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 8 Oct 2024 12:23:25 +0200 Received: by mail-io1-f60.google.com with SMTP id ca18e2360f4ac-82cf5d58f5dsf51663539f.3 for ; Tue, 08 Oct 2024 03:23:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728382999; cv=pass; d=google.com; s=arc-20240605; b=aPTpEEwJEySSyqvC/HoLLyo2AD/U3jccMBGsjYb9/MfwPQ+YBeK2795qIp1p6f25iH iYCejcn1zjJjCkE+m0gIZwDM4I97JC1ab9V6a0bFopGih7l3UK1hyn/gNQWHVMkSJS9L lZn25pT0mXEuHB872nVwE1fbTyyhQ21LKEU5t7AOiKHll2E3LxzghiQNsrkvJ6LQr+qq BqE/nDd12/fa8V0cJtBIylppoVUOFoKkaryHoAGKL0w7uNtNy9BLaUh85JXmeP4PQP9L mqjpjyVouqS2QDrfzr0haM2ksUIUH0LE2QOFpLMnDqf5k/50WkeamDqJZXvFY6LkS0Ep clMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KVeESprMNesuyzJ9SFN4F0mr+15gahmY5ao2Hh0r+54=; fh=7U6q0tjD7EmYe4Ww96DuzcjdfzXTC0oMErxheIRiZXI=; b=GXXWIx2huh4jPwXVtq0zKyZN9LhhTCp/awFUlbPcMjZZDP7wzKtmpZDcDT06gGPXmI oF1Li6p0vVmapqjK2jP1zJW4yJnqrAXJDtERUYh09LsfEPP+dFpPEx9JTN7N4dsvMVMy KY/5ZyY7esuOokoats9GqepzoqM6klGsAj8JPK2UDtI/Ii0HOWSfFgxAkBvG3zqfBsoE L2zlkQ6iyyZdVp4mWtWeCtVXeOXPioi1VDVz3h8XBRQVRAF9jFI6CurRcAFPrAtdsxY/ 7RVpmj4J7in6x+xX3G37MDZQYtsTamhQhhjATEvGyhsaty/5zm98nFs460L9tvRK6SZK KHlw==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=nv1or8T2; spf=pass (google.com: domain of fm-1326448-20241008102315ecb55d46381941bb0b-pl2cdj@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-1326448-20241008102315ecb55d46381941bb0b-pl2cDJ@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1728382999; x=1728987799; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=KVeESprMNesuyzJ9SFN4F0mr+15gahmY5ao2Hh0r+54=; b=l8mGjEKE8vxcJ/TYhzknTgFi9AMmGX31CusbHc9oMJuZcg7pcFGyuwEj3R7r1YHDvY /O7VYqM3mBAgx9WbFNARh/QCwYfByex9W8VnAiyLSCgxIbHxkoMm2bdWE7r0JR1dqtxK 60JH9hw1XIP48AYMC9jJvTT2JNDElHb9ZeYnqe2n7fyWOWDMRy4oYqBPSmuW1hcZgRy7 fXgEh6XMwsKv029dd//j2oKZOAgbQ3AWJCZr9lWKY8b5s4HmkxUWrqIZrqTpqSmW9cTj NXcJKmprSQyzTd/vS8mHtnbgSagIiPkWpsTpLX+YTUmLtGlBOZXlYeNdLN0k2qUahic5 c72Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728382999; x=1728987799; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KVeESprMNesuyzJ9SFN4F0mr+15gahmY5ao2Hh0r+54=; b=apSL/qYhIRQ3AXZJMiPZEbAah0ex8C1qX1gCEBdSQ4p7TOA9gWn5vrmqW9LaN+BBKS rn5/wr70OSiuqizFGyreRpaBHPZPsPLa1wp7unaDYfqyrYtJUVYhDS3H8ZT6HQy1xLsP rpEx+Twzs64ZXLIfyJlTwx+jukLDGrpFgFHN8ipIMjrKyLZX7X26fzD6aQ8V9jDViiWw svK4cXBEOd/jbye7OtsEazWh/qYLVbQGDETVe96PYBuntk87OLg02J9+7FovgkPRhZJ+ IoULjV+n4ZzoF5BRE+FIMk3eLsIjTgAZYWjW8mWk4kvJwXxCc6aaTdUHS7AQUlUuhzVc BY6Q== X-Forwarded-Encrypted: i=2; AJvYcCVyh6JCPukVMHMvU/FDltkyceWdwEsmQXteRMyUW6xGk9ADqg8A8WdNAvVkXjwuxHJ57B6kYW8=@isar-build.org X-Gm-Message-State: AOJu0Yz4u+uZtbymvwPqiYJ28CP2UKpczTJvQlJTa3xrxBSHKw0uNSGG XnjNcg0ddMLW8kODDeUKh3vcrXZiNOqVByTIFaQDMNuVYvMf4WKt X-Google-Smtp-Source: AGHT+IEds+Ux7lN5gm1kJidlby6Zq8kndvUqGz+vXFEOuRNfBkFLYDtS63x/XH84p7ExRQXXn0Mlzg== X-Received: by 2002:a05:6e02:13a2:b0:39f:5472:c37 with SMTP id e9e14a558f8ab-3a375986faemr40737615ab.2.1728382998960; Tue, 08 Oct 2024 03:23:18 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6e02:1d8b:b0:3a2:7592:2bf with SMTP id e9e14a558f8ab-3a36e4982dcls3098355ab.2.-pod-prod-03-us; Tue, 08 Oct 2024 03:23:17 -0700 (PDT) X-Received: by 2002:a05:6e02:148e:b0:3a0:8c83:91fb with SMTP id e9e14a558f8ab-3a375bc840dmr145264525ab.20.1728382997619; Tue, 08 Oct 2024 03:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728382997; cv=none; d=google.com; s=arc-20240605; b=eMrVxCk7v8gQbGov9cmyX8sJ6OTDQmNIdrJgydmR594oZsFLFsbYkP2NRKfB4VmiZQ BbYs1e7rdVY4OVoO7kBUJGPDwtAm6EG+IZAAXsipQXGOjfk2aYSV1YXn70XniD47YkrB fm1vLLvJQYDWFQgi5xyw4elJtF9jEW+x0MY3S9WTF1b+PpjkrdwI99gMtEfhz78BtMAq rqB0qPrKytX91xQn2hDMvJUZbVgVk7tYobQOz/FZdgtQuVBCMr0cQ3EH7BdBuujtL9NP EaQ5l1MqFbxp+igXlWUf8WZzgUew+fh1NU9/2DKRzLCHwCAkNW79ywfHgbuDApsxuldH bUkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=5LYz6Uwk0PQEWTQ57GgtWFzxJu8KSdyvqzMVDaHunbo=; fh=lKRNNdAU0IICONvfa+KjpneoIxBGWimmAGb9Xm7u9s8=; b=TrSN0FF/IDJwOjOBOijjRSJIpK2HTKvqAfGY77Sio0SxbDyxA9PfkZ2jY74xR0w+9I A3ALwU1Jcp54KkJS4Tqu5oPKZp7ijATDHBU9NIjGIZWf0jyRxEBcZR21h6eNySOcOV9h 5glhqkkfzUgbjKuVpun2X8RKeq4Vqu3DOqxZyfQndeTtUIoUK7MkGnFr5kLSQHpqqs/5 7WiwxT+FRYTHfNEitGM9zpfqudnVbvrMvfUWybFnlKp1zoR2w8afiANIutBKBspLjbRn JrDPxS9OSwh8TBTyM6iDv37C17Ts8+uGEaY2qbvfmbYcSU0wQeP+ZtcjrPrIhWZdie3a RP0g==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=nv1or8T2; spf=pass (google.com: domain of fm-1326448-20241008102315ecb55d46381941bb0b-pl2cdj@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-1326448-20241008102315ecb55d46381941bb0b-pl2cDJ@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net. [185.136.64.225]) by gmr-mx.google.com with ESMTPS id 8926c6da1cb9f-4db81a1d497si202656173.3.2024.10.08.03.23.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 03:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-1326448-20241008102315ecb55d46381941bb0b-pl2cdj@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) client-ip=185.136.64.225; Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 20241008102315ecb55d46381941bb0b for ; Tue, 08 Oct 2024 12:23:15 +0200 X-Patchwork-Original-From: "alexander.heinisch via isar-users" From: "alexander.heinisch" To: isar-users@googlegroups.com Cc: jan.kiszka@siemens.com, quirin.gylstorff@siemens.com, Alexander Heinisch Subject: [PATCH 1/2] meta-isar: Added unattended mode for deploy-image-wic installer script. Date: Tue, 8 Oct 2024 12:22:34 +0200 Message-ID: <20241008102235.34078-2-alexander.heinisch@siemens.com> In-Reply-To: <20241008102235.34078-1-alexander.heinisch@siemens.com> References: <20241008102235.34078-1-alexander.heinisch@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1326448:519-21489:flowmailer X-Original-Sender: alexander.heinisch@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=nv1or8T2; spf=pass (google.com: domain of fm-1326448-20241008102315ecb55d46381941bb0b-pl2cdj@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-1326448-20241008102315ecb55d46381941bb0b-pl2cDJ@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: alexander.heinisch@siemens.com Reply-To: alexander.heinisch@siemens.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Alexander Heinisch In some cases (e.g. automated mass rollouts for precomissioning devices) it is valueable to not rely on a screen and a keyboard to deploy the target images on the device. Therefore, extended on the auto.install patch to allow for completely unattended installations. In addition to the auto.install file to provide configuration for the installer we added support for the kernel cmdline. - installer.unattended - installer.image.uri ...file name of the image to be installed (parameter name uri chosen since we plan to support download of images in upcoming patches) - installer.target.dev ...target device name (e.g. /dev/sda) for the image to be installed to - installer.target.overwrite ...strategy how to handle target devices not empty (possible values: OVERWRITE - overwrite data on target | ABORT - abort installation if target not empty) This introduces a **Breaking change!** This patch changes behaviour since when auto.install is found the script is assumed to run unattended. That means no dialogs are shown and no user interaction is enforced! It also requires all the configurations to be in place and valid when such file is provided! Signed-off-by: Alexander Heinisch --- .../deploy-image/deploy-image_0.1.bb | 7 +- .../files/{ => usr/bin}/deploy-image-wic.sh | 76 ++++++++++------- .../usr/lib/deploy-image-wic/handle-config.sh | 83 +++++++++++++++++++ 3 files changed, 134 insertions(+), 32 deletions(-) rename meta-isar/recipes-installer/deploy-image/files/{ => usr/bin}/deploy-image-wic.sh (71%) mode change 100644 => 100755 create mode 100644 meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh diff --git a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb index fe524e52..242ca88e 100644 --- a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb +++ b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb @@ -7,11 +7,14 @@ DESCRIPTION = "Install image to device" inherit dpkg-raw -SRC_URI = "file://deploy-image-wic.sh \ +SRC_URI = "file://usr/bin/deploy-image-wic.sh \ + file://usr/lib/deploy-image-wic/handle-config.sh \ " DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd" do_install[cleandirs] = "${D}/usr/bin/ \ + ${D}/usr/lib/deploy-image-wic \ " do_install() { - install -m 0755 ${WORKDIR}/deploy-image-wic.sh ${D}/usr/bin/deploy-image-wic.sh + install -m 0755 ${WORKDIR}/usr/bin/deploy-image-wic.sh ${D}/usr/bin/deploy-image-wic.sh + install -m 0755 ${WORKDIR}/usr/lib/deploy-image-wic/handle-config.sh ${D}/usr/lib/deploy-image-wic/handle-config.sh } diff --git a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh old mode 100644 new mode 100755 similarity index 71% rename from meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh rename to meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh index 95188fe3..108a5975 --- a/meta-isar/recipes-installer/deploy-image/files/deploy-image-wic.sh +++ b/meta-isar/recipes-installer/deploy-image/files/usr/bin/deploy-image-wic.sh @@ -6,21 +6,18 @@ installdata=${INSTALL_DATA:-/install} -AUTO_INSTALL=false -OVERWRITE= - -if [ -f "$installdata/auto.install" ]; then - exec 3<"$installdata/auto.install" - read -r DISK_IMAGE <&3 - read -r TARGET_DEVICE <&3 - read -r OVERWRITE <&3 - exec 3>&- - if [ ! -b ${TARGET_DEVICE} ]; then - dialog --msgbox "Target device is not a valid block device. Installation aborted." 6 60 - exit 1 - fi - AUTO_INSTALL=true -else +SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; ) + +. ${SCRIPT_DIR}/../lib/deploy-image-wic/handle-config.sh + + +# Map config params +AUTO_INSTALL=${installer_unattended} +DISK_IMAGE=${installer_image_uri} +TARGET_DEVICE=${installer_target_dev} +OVERWRITE=${installer_target_overwrite} + +if ! $AUTO_INSTALL; then DISK_IMAGE=$(find "$installdata" -type f -iname "*.wic*" -a -not -iname "*.wic.bmap" -exec basename {} \;) if [ -z "$DISK_IMAGE" ] || [ ! -f "$installdata/$DISK_IMAGE" ]; then pushd "$installdata" @@ -36,16 +33,14 @@ else fi fi fi -fi -if [ ! -f "$installdata/$DISK_IMAGE" ]; then - dialog --msgbox "Could not find an image to install. Installation aborted." 6 60 - exit 1 -fi -DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap") -# inspired by poky/meta/recipes-core/initrdscripts/files/install-efi.sh + if [ ! -f "$installdata/$DISK_IMAGE" ]; then + dialog --msgbox "Could not find an image to install. Installation aborted." 6 60 + exit 1 + fi + DISK_BMAP=$(find "$installdata" -type f -iname "${DISK_IMAGE%.wic*}.wic.bmap") -if ! $AUTO_INSTALL; then + # inspired by poky/meta/recipes-core/initrdscripts/files/install-efi.sh target_device_list="" current_root_dev_type=$(findmnt / -o fstype -n) if [ ${current_root_dev_type} = "nfs" ]; then @@ -126,25 +121,46 @@ if ! $AUTO_INSTALL; then --yesno "Start installing\n'$DISK_IMAGE'\nto $TARGET_DEVICE (capacity: $TARGET_DEVICE_SIZE)" 7 60; then exit 0 fi + + # set absolute paths to be compatible with unattended mode + DISK_IMAGE="$installdata/$DISK_IMAGE" + + if [ -z "$DISK_BMAP" ]; then + DISK_BMAP="$installdata/$DISK_BMAP" + fi fi -if [ "$OVERWRITE" != "OVERWRITE" ] && ! cmp /dev/zero "$TARGET_DEVICE" -n 1M && \ - ! dialog --defaultno \ - --yesno "WARNING: Target device is not empty! Continue anyway?" 5 60; then - exit 0 +if ! cmp /dev/zero "$TARGET_DEVICE" -n 1M; then + if ! $AUTO_INSTALL && \ + ! dialog --defaultno \ + --yesno "WARNING: Target device is not empty! Continue anyway?" 5 60; then + exit 0 + else + if [ "$OVERWRITE" != "OVERWRITE" ]; then + echo "Target device is not empty! -> Abort" + echo "If you want to override existing data set \"installer_target_overwrite=OVERWRITE\"" + fi + fi fi bmap_options="" if [ -z "$DISK_BMAP" ]; then bmap_options="--nobmap" fi -clear -if ! bmaptool copy ${bmap_options} "$installdata/$DISK_IMAGE" "${TARGET_DEVICE}"; then + +if ! $AUTO_INSTALL; then + clear +fi + +if ! bmaptool copy ${bmap_options} "$DISK_IMAGE" "${TARGET_DEVICE}"; then exit 1 fi if ! $AUTO_INSTALL; then dialog --title "Reboot" \ - --msgbox "Installation is successful. System will be rebooted. Please remove the USB stick." 6 60 + --msgbox "Installation was successful. System will be rebooted. Please remove the USB stick." 6 60 +else + echo "Installation was successful." fi + exit 0 diff --git a/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh b/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh new file mode 100644 index 00000000..af37150e --- /dev/null +++ b/meta-isar/recipes-installer/deploy-image/files/usr/lib/deploy-image-wic/handle-config.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# This software is a part of ISAR. +# Copyright (C) Siemens AG, 2024 +# +# SPDX-License-Identifier: MIT + +installer_unattended=false +installer_image_uri= +installer_target_dev= +installer_target_overwrite= + +if [ -f "$installdata/auto.install" ]; then + exec 3<"$installdata/auto.install" + read -r installer_image_uri <&3 + read -r installer_target_dev <&3 + read -r installer_target_overwrite <&3 + exec 3>&- + + installer_unattended=true +fi + +# But let kernel cmdline overrule +for x in $(cat /proc/cmdline); do + case $x in + installer.unattended*) + installer_unattended=true + ;; + installer.image.uri=*) + installer_image_uri=${x#installer.image.uri=} + installer_unattended=true + ;; + installer.target.dev=*) + installer_target_dev=${x#installer.target.dev=} + installer_unattended=true + ;; + installer.target.overwrite*) + installer_target_overwrite="OVERWRITE" + installer_unattended=true + ;; + esac +done + +## Check config +all_values_set=false +if [ -n "${installer_image_uri}" ] && [ -n "${installer_target_dev}" ] && [ -n "${installer_target_overwrite}" ]; then + all_values_set=true +fi + +if ${installer_unattended} && ! ${all_values_set}; then + echo "When running in unattended mode all values needed for installation have to be set! -> Abort" + exit 1 +fi + +if ${installer_unattended}; then + echo "Got config:" + echo " installer_unattended=${installer_unattended}" + echo " installer_image_uri=${installer_image_uri}" + echo " installer_target_dev=${installer_target_dev}" + echo " installer_target_overwrite=${installer_target_overwrite}" + + case ${installer_target_overwrite} in + OVERWRITE|ABORT) + ;; + *) + echo "When running in unattended mode only \"installer_target_overwrite=OVERWRITE | ABORT\" is valid! You specified \"${installer_target_overwrite}\" -> Abort" + exit 1 + ;; + esac + + if [ ! -b ${installer_target_dev} ]; then + echo "Target device \"${installer_target_dev}\" is not a valid block device. -> Abort" + exit 1 + fi + + if [ ! -f "${installer_image_uri}" ]; then + if [ ! -f "$installdata/${installer_image_uri}" ]; then + echo "Could not find image file ${installer_image_uri} nor $installdata/${installer_image_uri} to install. -> Abort" + exit 1 + else + installer_image_uri=$installdata/${installer_image_uri} + fi + fi +fi