Set of scripts to build Android for LG G6 (h870) leveraging OVH Public Cloud

run.sh 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. set -e
  3. set -v
  4. # Install OVH orchestrator dependencies
  5. python3 -m venv .venv
  6. ./.venv/bin/pip install -r requirements.txt
  7. # Set up an OVH instance to run the build
  8. if [ "$1" == "" ] || [ $# -gt 1 ]; then
  9. printf "%s" "Waiting for OVH instance ..."
  10. IP_ADDRESS=$(./.venv/bin/python3 -m ovh_orchestrator init)
  11. echo " (IP: ${IP_ADDRESS}) "
  12. while ! timeout 0.2 ping -c 1 -n ${IP_ADDRESS} &> /dev/null
  13. do
  14. printf "%c" "."
  15. sleep 3
  16. done
  17. # Wait a bit to ensure SSH is up
  18. sleep 10
  19. # Run the build on the OVH instance
  20. scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" ./build_android.sh ubuntu@${IP_ADDRESS}:~
  21. # Build /e/ (or edit the BUILD_FLAVOR environment variable)
  22. ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -f ubuntu@${IP_ADDRESS} 'BUILD_FLAVOR=e screen -S build -dm bash ./build_android.sh'
  23. else
  24. IP_ADDRESS="$1"
  25. fi
  26. # Wait for build to complete
  27. set +e
  28. printf "%s" "Building ..."
  29. until ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" ubuntu@${IP_ADDRESS} 'ls ~/BUILD_DONE'; do
  30. printf "%c" "."
  31. sleep 30
  32. done
  33. set -e
  34. # Fetch back the built images
  35. #rsync -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" -azr --progress ubuntu@${IP_ADDRESS}:~/android/lineage/out/target/product/h870/\*.{zip,md5sum,img} out/
  36. # Purge the OVH instance
  37. ./.venv/bin/python3 -m ovh_orchestrator purge ${IP_ADDRESS}