From da373d3ba7e739bffb0a649c33a2f2489b4a4f59 Mon Sep 17 00:00:00 2001 From: "Generate.yml" Date: Sun, 15 Sep 2024 16:07:11 +0000 Subject: [PATCH] Generated from base-vm --- .github/workflows/test.yml | 4 ++-- run.sh | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e096a9..4d299f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: port: 8000 - name: Test in FreeBSD id: test - uses: vmactions/freebsd-vm@4efc857872ad9ae6f13b5628b03addde0468853c + uses: vmactions/freebsd-vm@9eb7a39cbd4c5df53f9be256d8fc90f4585d0b06 with: envs: 'DEBUG MYTOKEN MYTOKEN2' prepare: | @@ -99,7 +99,7 @@ jobs: - uses: actions/checkout@v4 - name: Test in FreeBSD id: test - uses: vmactions/freebsd-vm@4efc857872ad9ae6f13b5628b03addde0468853c + uses: vmactions/freebsd-vm@9eb7a39cbd4c5df53f9be256d8fc90f4585d0b06 with: envs: 'MYTOKEN MYTOKEN2' prepare: | diff --git a/run.sh b/run.sh index b3213c0..78ff8f2 100644 --- a/run.sh +++ b/run.sh @@ -69,13 +69,26 @@ if [ ! -e "$vmsh" ]; then wget -O $vmsh "${SEC_VBOX:-$VM_VBOX_LINK}" fi - +_endswith() { + _str="$1" + _sub="$2" + echo "$_str" | grep -- "$_sub\$" >/dev/null 2>&1 +} osname="$VM_OS_NAME" ostype="$VM_OS_TYPE" sshport=$VM_SSH_PORT -ovafile="$osname-$VM_RELEASE.qcow2.xz" + + +qow2="$osname-$VM_RELEASE.qcow2" + +if _endswith "$OVA_LINK" ".xz"; then + ovafile="$qow2.xz" +else + ovafile="$qow2.zst" +fi + _idfile='~/.ssh/host.id_rsa' @@ -97,7 +110,7 @@ importVM() { bash $vmsh setup - if [ ! -e "$ovafile" ]; then + if [ ! -e "$qow2" ]; then echo "Downloading $OVA_LINK" axel -n 8 -o "$ovafile" -q "$OVA_LINK" @@ -114,8 +127,14 @@ importVM() { rm -f "${ovafile}.$i" done ls -lah + echo "Download finished, extracting" - xz -v -d $ovafile + if _endswith "$OVA_LINK" ".xz"; then + #just to keep compatible with the old xz editions + xz -v -d $ovafile + else + zstd -d "$ovafile" -o "$qow2" + fi echo "Extract finished" ls -lah fi