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 10, 2024
1 parent 55ab22f commit 598c488
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ ovafile="$osname-$VM_RELEASE.qcow2.xz"
_idfile='~/.ssh/host.id_rsa'


check_url_exists() {
url=$1
http_status=$(curl -o /dev/null --silent --head --write-out '%{http_code}' "$url")
if [[ "$http_status" -ge 200 && "$http_status" -lt 400 ]]; then
return 0
else
return 1
fi
}


importVM() {
_mem=$1
Expand All @@ -90,9 +100,24 @@ importVM() {
if [ ! -e "$ovafile" ]; then
echo "Downloading $OVA_LINK"
axel -n 8 -o "$ovafile" -q "$OVA_LINK"
echo "Download finished, extract"
xz -d $ovafile

for i in $(seq 1 9) ; do
_url="${OVA_LINK}.$i"
echo "Checking $_url"
if ! check_url_exists "$_url"; then
echo "break"
break
fi
axel -n 8 -o "${ovafile}.$i" -q "$_url"
ls -lah
cat "${ovafile}.$i" >>"$ovafile"
rm -f "${ovafile}.$i"
done
ls -lah
echo "Download finished, extracting"
xz -v -d $ovafile
echo "Extract finished"
ls -lah
fi

if [ ! -e "id_rsa.pub" ]; then
Expand Down

0 comments on commit 598c488

Please sign in to comment.