diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba61141..299649a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,12 @@ jobs: env: SEC_VBOX : ${{ secrets.SEC_VBOX }} steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false - uses: actions/checkout@v4 - name: Creating Web console uses: vmactions/cf-tunnel@v0 @@ -50,7 +56,7 @@ jobs: - name: Upload Release Asset if: "contains(github.ref, 'refs/tags/')" id: upload-release-asset - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/build.sh b/build.sh index ccc23a6..9646224 100644 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -e +set -ex _conf="$1" @@ -120,22 +120,49 @@ else exit 1 fi -$vmsh startVM $osname -sleep 2 +echo "VM image size immediately after install:" +ls -lh ${osname}.qcow2 -############################################### +start_and_wait() { + $vmsh startVM $osname + sleep 2 + if [ -e "hooks/waitForLoginTag.sh" ]; then + echo "hooks/waitForLoginTag.sh" + cat "hooks/waitForLoginTag.sh" + . "hooks/waitForLoginTag.sh" + else + waitForText "$VM_LOGIN_TAG" + fi -if [ -e "hooks/waitForLoginTag.sh" ]; then - echo "hooks/waitForLoginTag.sh" - cat "hooks/waitForLoginTag.sh" - . "hooks/waitForLoginTag.sh" -else - waitForText "$VM_LOGIN_TAG" -fi + sleep 3 +} + +shutdown_and_wait() { + ssh $osname "$VM_SHUTDOWN_CMD" + + sleep 30 + + if $vmsh isRunning $osname; then + if ! $vmsh shutdownVM $osname; then + echo "shutdown error" + fi + fi -sleep 3 + while $vmsh isRunning $osname; do + sleep 5 + done +} + +restart_and_wait() { + shutdown_and_wait + start_and_wait +} + +############################################### + +start_and_wait inputKeys "string root; enter; sleep 1;" if [ "$VM_ROOT_PASSWORD" ]; then @@ -184,25 +211,19 @@ echo " ServerAliveInterval 1" >>.ssh/config EOF - ############################################################### - if [ -e "hooks/postBuild.sh" ]; then echo "hooks/postBuild.sh" cat "hooks/postBuild.sh" ssh $osname sh<"hooks/postBuild.sh" -fi - -ssh $osname 'cat ~/.ssh/id_rsa.pub' >$osname-$VM_RELEASE-id_rsa.pub - - -if [ "$VM_PRE_INSTALL_PKGS" ]; then - echo "$VM_INSTALL_CMD $VM_PRE_INSTALL_PKGS" - ssh $osname sh <<<"$VM_INSTALL_CMD $VM_PRE_INSTALL_PKGS" + # Reboot here, possible there were system updates done that need + # a reboot to take effect before more operations can be done + restart_and_wait fi +ssh $osname 'cat ~/.ssh/id_rsa.pub' >$osname-$VM_RELEASE-id_rsa.pub #upload reboot.sh if [ -e "hooks/reboot.sh" ]; then @@ -220,7 +241,6 @@ END EOF fi - #set cronjob ssh "$osname" sh <