Skip to content

Commit

Permalink
Generated from base-vm
Browse files Browse the repository at this point in the history
  • Loading branch information
Generate.yml committed Sep 15, 2024
1 parent 739a84e commit da373d3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
27 changes: 23 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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"

Expand All @@ -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
Expand Down

0 comments on commit da373d3

Please sign in to comment.