From 9a8334f468cbe8817d84c0637586f407c8f58d9c Mon Sep 17 00:00:00 2001 From: fxi Date: Mon, 10 Jun 2024 14:00:07 +0200 Subject: [PATCH] Packer ci : try to install virtualbox guest addition manually --- .github/workflows/build.yml | 10 +++++++--- packer/alpine.pkr.hcl | 5 ----- packer/scripts/provision.sh | 12 +++++++++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71879664..731319bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,7 +76,7 @@ jobs: # | __/\_____|\____)_| \_)_____)_| # |_| packer: - runs-on: macos-13 + runs-on: ubuntu needs: docker name: Build VirtualBox ova steps: @@ -84,8 +84,12 @@ jobs: uses: actions/checkout@v3 - name: Install VirtualBox - run: - brew install --cask virtualbox + run: | + wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - + wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - + sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" + sudo apt-get update + sudo apt-get install -y virtualbox-7.0 - name: Setup Packer uses: hashicorp/setup-packer@main diff --git a/packer/alpine.pkr.hcl b/packer/alpine.pkr.hcl index 28229d35..677c5752 100644 --- a/packer/alpine.pkr.hcl +++ b/packer/alpine.pkr.hcl @@ -55,10 +55,6 @@ variable "iso_url" { default = "https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.8-x86_64.iso" } -variable "alpine_repo" { - type = string - default = "https://dl-cdn.alpinelinux.org/alpine/v3.16/community" -} variable "memory" { type = string @@ -206,7 +202,6 @@ build { environment_vars = [ "USERNAME=${var.username}", "PASSWORD=${var.userpassword}", - "ALPINE_REPOSITORY=${var.alpine_repo}", "AM5_PORT_APP=${var.port_app}", "AM5_PORT_APP_PUBLIC=${var.port_app_public}", "AM5_PORT_HTTP=${var.port_http}", diff --git a/packer/scripts/provision.sh b/packer/scripts/provision.sh index d1faa194..68f32f0e 100755 --- a/packer/scripts/provision.sh +++ b/packer/scripts/provision.sh @@ -18,11 +18,21 @@ apk --no-cache add \ docker \ dialog \ jq \ - virtualbox-guest-additions \ util-linux \ sudo \ rsync +# +# Download and install VirtualBox Guest Additions 7.0.18 +# +wget https://download.virtualbox.org/virtualbox/7.0.18/VBoxGuestAdditions_7.0.18.iso -P /tmp/ +mkdir /mnt/vboxadditions +mount -o loop /tmp/VBoxGuestAdditions_7.0.18.iso /mnt/vboxadditions +sh /mnt/vboxadditions/VBoxLinuxAdditions.run || true # Allow script to continue even if there are warnings/errors +umount /mnt/vboxadditions +rm -rf /tmp/VBoxGuestAdditions_7.0.18.iso /mnt/vboxadditions + + # # Set users #