diff --git a/build_android.sh b/build_android.sh index 0f2056e..840b877 100755 --- a/build_android.sh +++ b/build_android.sh @@ -4,15 +4,15 @@ set -e set -x # Install dependencies -apt-get update -apt-get upgrade -y -apt-get install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev -apt-get install -y default-jdk -apt-get install -y python2 -update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 # Android git repo hooks are python2-only +sudo apt-get update +sudo apt-get upgrade -y +sudo apt-get install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev +sudo apt-get install -y default-jdk +sudo apt-get install -y python2 +sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 # Android git repo hooks are python2-only # Install repo -mkdir ~/bin +mkdir -p ~/bin cat >> ~/.profile < /dev/null -do - printf "%c" "." -done +if [ "$1" == "" ] || [ $# -gt 1 ]; then + printf "%s" "Waiting for OVH instance ..." + IP_ADDRESS=$(./.venv/bin/python3 -m ovh_orchestrator init) + echo " (IP: ${IP_ADDRESS}) " + while ! timeout 0.2 ping -c 1 -n ${IP_ADDRESS} &> /dev/null + do + printf "%c" "." + sleep 3 + done -# Run the build on the OVH instance -scp ./build_android.sh ubuntu@${IP_ADDRESS}:~ -ssh -f ubuntu@${IP_ADDRESS} 'screen -S build -dm bash ./build_android.sh' + # Wait a bit to ensure SSH is up + sleep 10 + + # Run the build on the OVH instance + scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" ./build_android.sh ubuntu@${IP_ADDRESS}:~ + # Build /e/ (or edit the BUILD_FLAVOR environment variable) + ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -f ubuntu@${IP_ADDRESS} 'screen -S build -dm bash BUILD_FLAVOR=e ./build_android.sh' +else + IP_ADDRESS="$1" +fi # Wait for build to complete set +e printf "%s" "Building ..." -until ssh ubuntu@${IP_ADDRESS} 'ls ~/BUILD_DONE'; do +until ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" ubuntu@${IP_ADDRESS} 'ls ~/BUILD_DONE'; do printf "%c" "." + sleep 30 done set -e # Fetch back the built images -rsync -azr --progress ubuntu@${IP_ADDRESS}:~/android/lineage/out/target/product/h870/\*.{zip,md5sum,img} . +rsync -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" -azr --progress ubuntu@${IP_ADDRESS}:~/android/lineage/out/target/product/h870/\*.{zip,md5sum,img} . # Purge the OVH instance ./.venv/bin/python3 -m ovh_orchestrator purge ${IP_ADDRESS}