Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions eos-tech-support/eos-write-live-image
Original file line number Diff line number Diff line change
Expand Up @@ -367,20 +367,33 @@ fi

check_exists "$OS_IMAGE" "image"

# Below here we start mounting stuff, so register a cleanup function
trap cleanup EXIT

if [[ "$OS_IMAGE" == *.iso ]]; then
ISO=true
OS_IMAGE_UNCOMPRESSED="${OS_IMAGE%.iso}.img"
OS_IMAGE_UNCOMPRESSED_BASENAME="$(basename "${OS_IMAGE_UNCOMPRESSED}")"

# Loop-mount the ISO and copy the endless.squash and directory
mkdir -p "$ISO_MOUNTPOINT"
mount -o ro,loop "$OS_IMAGE" "$ISO_MOUNTPOINT"
find $ISO_MOUNTPOINT

EXTRACTED_SIGNATURE="$ISO_MOUNTPOINT/endless/${OS_IMAGE_UNCOMPRESSED_BASENAME}.asc"
BOOT_ZIP="$ISO_MOUNTPOINT/endless/${OS_IMAGE_UNCOMPRESSED_BASENAME%.img}.boot.zip"
else
# If image does not have a .gz, .xz or .iso suffix, assume it is the
# uncompressed .img
OS_IMAGE_UNCOMPRESSED="${OS_IMAGE%.?z}"
OS_IMAGE_UNCOMPRESSED_BASENAME="$(basename "${OS_IMAGE_UNCOMPRESSED}")"

EXTRACTED_SIGNATURE="${OS_IMAGE_UNCOMPRESSED}.asc"
BOOT_ZIP="${OS_IMAGE_UNCOMPRESSED%.img}.boot.zip"
fi
OS_IMAGE_UNCOMPRESSED_BASENAME="$(basename "${OS_IMAGE_UNCOMPRESSED}")"

EXTRACTED_SIGNATURE="${OS_IMAGE_UNCOMPRESSED}.asc"
check_exists "$EXTRACTED_SIGNATURE" "uncompressed image signature"

BOOT_ZIP="${OS_IMAGE_UNCOMPRESSED%.img}.boot.zip"
check_exists "$BOOT_ZIP" "bootloader bundle"
check_exists "$BOOT_ZIP.asc" "bootloader bundle signature"

Expand Down Expand Up @@ -447,9 +460,6 @@ fi
# Give udev a chance to notice the new partitions
udevadm settle

# Below here we start mounting stuff, so register a cleanup function
trap cleanup EXIT

if [ ! "$MBR" ]; then
mkfs.vfat -n efi "${DEVICE_EFI}"
partprobe "$OUTPUT"
Expand Down Expand Up @@ -507,9 +517,6 @@ fi

echo "Copying image files"
if [ "$ISO" ]; then
# Loop-mount the ISO and copy the endless.squash and directory
mkdir -p "$ISO_MOUNTPOINT"
mount -o ro,loop "$OS_IMAGE" "$ISO_MOUNTPOINT"
cp "$ISO_MOUNTPOINT/endless/endless.squash" \
"$ISO_MOUNTPOINT/endless/${OS_IMAGE_UNCOMPRESSED_BASENAME%.img}.squash.asc" \
"$DIR_IMAGES_ENDLESS"
Expand Down