From 2a910b0e45a9f8bc125d09c2b0040cd0698882da Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 19 Apr 2021 10:53:22 +0200 Subject: [PATCH] Use zip file format for virtual disk images (#1327) Virtual Disk images are often used on Windows and/or Mac platforms where xz is not a widely known file ending and also not supported by dafault. Use zip which is much better known. Keep using xz for boards since those are not meant to be extracted by users but directly used in Etcher. Also keep using xz for qcow2, since qcow2 is mostly used on Linux platforms where xz is available by default and zip usually needs an extra package. --- .github/workflows/release.yml | 18 +++++++++--------- Dockerfile | 1 + buildroot-external/board/pc/ova/hassos-hook.sh | 6 +++--- buildroot-external/scripts/hdd-image.sh | 8 ++++++++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fbaf311fd..3b9114de1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -121,9 +121,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vdi.xz - asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vdi.xz - asset_content_type: application/x-xz + asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vdi.zip + asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vdi.zip + asset_content_type: application/zip - name: Upload vhdx image if: ${{ matrix.board.name == 'ova' }} @@ -132,9 +132,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vhdx.xz - asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vhdx.xz - asset_content_type: application/x-xz + asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vhdx.zip + asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vhdx.zip + asset_content_type: application/zip - name: Upload vmdk image if: ${{ matrix.board.name == 'ova' }} @@ -143,9 +143,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vmdk.xz - asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vmdk.xz - asset_content_type: application/x-xz + asset_path: ${{ github.workspace }}/release/hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vmdk.zip + asset_name: hassos_${{ matrix.board.output }}-${{ needs.validate_release.outputs.version }}.vmdk.zip + asset_content_type: application/zip bump_version: name: Bump dev version to ${{ needs.validate_release.outputs.version }} diff --git a/Dockerfile b/Dockerfile index 1d6f5c903..e917a692d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ rsync \ sudo \ unzip \ + zip \ wget \ qemu-utils \ openssh-client \ diff --git a/buildroot-external/board/pc/ova/hassos-hook.sh b/buildroot-external/board/pc/ova/hassos-hook.sh index 8eb3020a3..62d844477 100755 --- a/buildroot-external/board/pc/ova/hassos-hook.sh +++ b/buildroot-external/board/pc/ova/hassos-hook.sh @@ -22,9 +22,9 @@ function hassos_post_image() { # Virtual Disk images convert_disk_image_virtual - convert_disk_image_xz vmdk - convert_disk_image_xz vhdx - convert_disk_image_xz vdi + convert_disk_image_zip vmdk + convert_disk_image_zip vhdx + convert_disk_image_zip vdi convert_disk_image_xz qcow2 # OVA diff --git a/buildroot-external/scripts/hdd-image.sh b/buildroot-external/scripts/hdd-image.sh index e4ce2c49e..58e3b8c54 100755 --- a/buildroot-external/scripts/hdd-image.sh +++ b/buildroot-external/scripts/hdd-image.sh @@ -325,3 +325,11 @@ function convert_disk_image_xz() { rm -f "${hdd_img}.xz" xz -3 -T0 "${hdd_img}" } + +function convert_disk_image_zip() { + local hdd_ext=${1:-img} + local hdd_img="$(hassos_image_name "${hdd_ext}")" + + rm -f "${hdd_img}.zip" + zip -r "${hdd_img}.zip" "${hdd_img}" +}