ovh_build_android_h870/run.sh

45 lines
1.4 KiB
Bash
Raw Normal View History

2020-12-10 22:59:25 +01:00
#!/bin/bash
set -e
2020-12-26 11:52:06 +01:00
set -v
2020-12-10 22:59:25 +01:00
# Install OVH orchestrator dependencies
python3 -m venv .venv
./.venv/bin/pip install -r requirements.txt
# Set up an OVH instance to run the build
2020-12-26 11:52:06 +01:00
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
# Wait a bit to ensure SSH is up
sleep 10
2020-12-10 22:59:25 +01:00
2020-12-26 11:52:06 +01:00
# 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)
2020-12-26 12:15:30 +01:00
ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -f ubuntu@${IP_ADDRESS} 'BUILD_FLAVOR=e screen -S build -dm bash ./build_android.sh'
2020-12-26 11:52:06 +01:00
else
IP_ADDRESS="$1"
fi
2020-12-10 22:59:25 +01:00
# Wait for build to complete
set +e
printf "%s" "Building ..."
2020-12-26 11:52:06 +01:00
until ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" ubuntu@${IP_ADDRESS} 'ls ~/BUILD_DONE'; do
2020-12-10 22:59:25 +01:00
printf "%c" "."
2020-12-26 11:52:06 +01:00
sleep 30
2020-12-10 22:59:25 +01:00
done
set -e
# Fetch back the built images
#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/
2020-12-10 22:59:25 +01:00
# Purge the OVH instance
./.venv/bin/python3 -m ovh_orchestrator purge ${IP_ADDRESS}