From 33c9702d469848e19c1bfb82160eb77a7de5d775 Mon Sep 17 00:00:00 2001 From: dappnodedev Date: Tue, 18 Jun 2024 11:50:20 +0200 Subject: [PATCH] Fix path for common ISO generation script --- iso/scripts/common_iso_generation.sh | 25 ++++++++------------- iso/scripts/generate_dappnode_iso_debian.sh | 7 +++--- iso/scripts/generate_dappnode_iso_ubuntu.sh | 9 +++----- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/iso/scripts/common_iso_generation.sh b/iso/scripts/common_iso_generation.sh index d520753..1cd65a0 100644 --- a/iso/scripts/common_iso_generation.sh +++ b/iso/scripts/common_iso_generation.sh @@ -4,16 +4,6 @@ WORKDIR="/usr/src/app" ISO_BUILD_PATH="${WORKDIR}/dappnode-iso" DAPPNODE_ISO_PREFIX="Dappnode-" -add_dappnode_files() { - local iso_build_path=$1 - local workdir=$2 - - echo "[INFO] Creating necessary directories and copying files..." - mkdir -p ${iso_build_path}/dappnode - cp -r ${workdir}/scripts ${iso_build_path}/dappnode - cp -r ${workdir}/dappnode/* ${iso_build_path}/dappnode -} - download_iso() { local iso_path=$1 local iso_name=$2 @@ -67,14 +57,17 @@ prepare_boot_process() { dd if="${iso_path}" bs=${block_size} count=1 of="${mbr_output_path}" } -download_third_party_packages() { - echo "[INFO] Downloading third-party packages..." - sed '1,/^\#\!ISOBUILD/!d' ${WORKDIR}/scripts/dappnode_install_pre.sh >/tmp/vars.sh - # shellcheck disable=SC1091 - source /tmp/vars.sh +add_dappnode_files_to_iso_build() { + local iso_build_path=$1 + local workdir=$2 + + echo "[INFO] Creating necessary directories and copying files..." + mkdir -p ${iso_build_path}/dappnode + cp -r ${workdir}/scripts ${iso_build_path}/dappnode + cp -r ${workdir}/dappnode/* ${iso_build_path}/dappnode } -# TODO: Is this ok for Ubuntu? +# TODO: Is this ok for Ubuntu? Check what this is for handle_checksums() { echo "Fix md5 sum..." # shellcheck disable=SC2046 diff --git a/iso/scripts/generate_dappnode_iso_debian.sh b/iso/scripts/generate_dappnode_iso_debian.sh index 645755c..c50072a 100755 --- a/iso/scripts/generate_dappnode_iso_debian.sh +++ b/iso/scripts/generate_dappnode_iso_debian.sh @@ -1,7 +1,9 @@ #!/bin/bash set -e -source /usr/src/app/iso/scripts/common_iso_generation.sh +SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}") + +source ${SCRIPTS_DIR}/common_iso_generation.sh # Source = https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso BASE_ISO_NAME="debian-12.5.0-amd64-netinst.iso" @@ -89,8 +91,7 @@ verify_download "${BASE_ISO_PATH}" "${BASE_ISO_SHASUM}" clean_old_files "${ISO_BUILD_PATH}" "${DAPPNODE_ISO_PREFIX}" extract_iso "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}" prepare_boot_process "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}/isolinux/isohdpfx.bin" -download_third_party_packages -add_dappnode_files "${ISO_BUILD_PATH}" "${WORKDIR}" +add_dappnode_files_to_iso_build "${ISO_BUILD_PATH}" "${WORKDIR}" customize_debian_preseed "${ISO_BUILD_PATH}" "${WORKDIR}" configure_boot_menu "${ISO_BUILD_PATH}" "${WORKDIR}" handle_checksums # TODO: Check if it fits both ubuntu and debian diff --git a/iso/scripts/generate_dappnode_iso_ubuntu.sh b/iso/scripts/generate_dappnode_iso_ubuntu.sh index 3246ec8..574432b 100755 --- a/iso/scripts/generate_dappnode_iso_ubuntu.sh +++ b/iso/scripts/generate_dappnode_iso_ubuntu.sh @@ -1,11 +1,9 @@ #!/bin/bash set -e -source /usr/src/app/iso/scripts/common_iso_generation.sh +SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}") -DAPPNODE_SCRIPTS_PATH="/usr/src/app/scripts" -VARS_FILE="/tmp/vars.sh" -TMP_INITRD="/tmp/makeinitrd" +source ${SCRIPTS_DIR}/common_iso_generation.sh BASE_ISO_NAME=ubuntu-24.04-live-server-amd64.iso BASE_ISO_PATH="/images/${BASE_ISO_NAME}" @@ -69,8 +67,7 @@ clean_old_files "${ISO_BUILD_PATH}" "${DAPPNODE_ISO_PREFIX}" extract_iso "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}" prepare_boot_process "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}/mbr" get_efi_partition "${BASE_ISO_PATH}" "${ISO_BUILD_PATH}/efi" -download_third_party_packages -add_dappnode_files "${ISO_BUILD_PATH}" "${WORKDIR}" +add_dappnode_files_to_iso_build "${ISO_BUILD_PATH}" "${WORKDIR}" add_ubuntu_autoinstall "/usr/src/app/iso/preseeds/ubuntu" "${ISO_BUILD_PATH}" configure_boot_menu handle_checksums