Minor fixes
This commit is contained in:
parent
841c2d17d7
commit
de61a6d3ad
@ -4,15 +4,15 @@ set -e
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
apt-get upgrade -y
|
sudo 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
|
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
|
||||||
apt-get install -y default-jdk
|
sudo apt-get install -y default-jdk
|
||||||
apt-get install -y python2
|
sudo 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 update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 # Android git repo hooks are python2-only
|
||||||
|
|
||||||
# Install repo
|
# Install repo
|
||||||
mkdir ~/bin
|
mkdir -p ~/bin
|
||||||
cat >> ~/.profile <<EOF
|
cat >> ~/.profile <<EOF
|
||||||
# set PATH so it includes user's private bin if it exists
|
# set PATH so it includes user's private bin if it exists
|
||||||
if [ -d "$HOME/bin" ] ; then
|
if [ -d "$HOME/bin" ] ; then
|
||||||
@ -36,13 +36,16 @@ source ~/.bashrc
|
|||||||
ccache -M 50G
|
ccache -M 50G
|
||||||
ccache -o compression=true
|
ccache -o compression=true
|
||||||
|
|
||||||
|
# Prevent repo prompt about using colors
|
||||||
|
git config --global color.ui false
|
||||||
|
|
||||||
# Clone Lineage 17.1 or /e/ codebase (takes roughly 1h!)
|
# Clone Lineage 17.1 or /e/ codebase (takes roughly 1h!)
|
||||||
mkdir -p ~/android/lineage
|
mkdir -p ~/android/lineage
|
||||||
cd ~/android/lineage
|
cd ~/android/lineage
|
||||||
if [[ "${BUILD_FLAVOR}" == "lineage" ]]; then
|
if [[ "${BUILD_FLAVOR}" == "lineage" ]]; then
|
||||||
repo init -u https://github.com/LineageOS/android.git -b lineage-17.1
|
repo init -q -u https://github.com/LineageOS/android.git -b lineage-17.1
|
||||||
elif [[ "$BUILD_FLAVOR" == "e" ]]; then
|
elif [[ "$BUILD_FLAVOR" == "e" ]]; then
|
||||||
repo init -u https://gitlab.e.foundation/e/os/android.git -b v1-q
|
repo init -q -u https://gitlab.e.foundation/e/os/android.git -b v1-q
|
||||||
else
|
else
|
||||||
echo "Unknown build flavor! Exiting."
|
echo "Unknown build flavor! Exiting."
|
||||||
exit 1
|
exit 1
|
||||||
@ -104,8 +107,27 @@ if [[ "${BUILD_FLAVOR}" == "e" ]]; then
|
|||||||
rm -r prebuilts/prebuiltapks/eDrive
|
rm -r prebuilts/prebuiltapks/eDrive
|
||||||
# Remove ESmsSync
|
# Remove ESmsSync
|
||||||
rm -r prebuilts/prebuiltapks/ESmsSync
|
rm -r prebuilts/prebuiltapks/ESmsSync
|
||||||
# Remove ESmsSync
|
# Remove Notes
|
||||||
rm -r prebuilts/prebuiltapks/ESmsSync
|
rm -r prebuilts/prebuiltapks/Notes
|
||||||
|
# Remove Camera
|
||||||
|
rm -r prebuilts/prebuiltapks/Camera
|
||||||
|
# Remove Browser
|
||||||
|
rm -r prebuilts/prebuiltapks/Browser
|
||||||
|
# Remove Weather
|
||||||
|
rm -r prebuilts/prebuiltapks/Weather
|
||||||
|
# Remove Tasks
|
||||||
|
rm -r prebuilts/prebuiltapks/Tasks
|
||||||
|
# Remove PdfViewer
|
||||||
|
rm -r prebuilts/prebuiltapks/PdfViewer
|
||||||
|
# Remove BrowserWebView
|
||||||
|
rm -r prebuilts/prebuiltapks/BrowserWebView
|
||||||
|
# Remove eSpeakTTS
|
||||||
|
rm -r prebuilts/prebuiltapks/eSpeakTTS
|
||||||
|
# Remove LibreOfficeViewer
|
||||||
|
rm -r prebuilts/prebuiltapks/LibreOfficeViewer
|
||||||
|
# Remove OpenWeatherMapWeatherProvider
|
||||||
|
rm -r prebuilts/prebuiltapks/OpenWeatherMapWeatherProvider
|
||||||
|
# TODO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build Lineage or /e/ (takes 2 to 3 hours!)
|
# Build Lineage or /e/ (takes 2 to 3 hours!)
|
||||||
|
@ -1,110 +0,0 @@
|
|||||||
import uuid
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
import ovh
|
|
||||||
|
|
||||||
from . import config
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
client = ovh.Client(
|
|
||||||
endpoint=config.ovh_endpoint,
|
|
||||||
application_key=config.ovh_application_key,
|
|
||||||
application_secret=config.ovh_application_secret,
|
|
||||||
consumer_key=config.ovh_consumer_key,
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Create VM
|
|
||||||
if sys.argv[1] == 'init':
|
|
||||||
# Get image id
|
|
||||||
result = client.get(
|
|
||||||
'/cloud/project/' + config.ovh_public_cloud_project + '/image',
|
|
||||||
flavorType='s1-2',
|
|
||||||
osType='linux',
|
|
||||||
region=config.ovh_public_cloud_region,
|
|
||||||
)
|
|
||||||
image_id = next(
|
|
||||||
x['id']
|
|
||||||
for x in result
|
|
||||||
if x['name'] == config.ovh_public_cloud_image
|
|
||||||
)
|
|
||||||
|
|
||||||
# Get SSH key id
|
|
||||||
result = client.get(
|
|
||||||
'/cloud/project/' + config.ovh_public_cloud_project + '/sshkey',
|
|
||||||
region=config.ovh_public_cloud_region,
|
|
||||||
)
|
|
||||||
ssh_key_id = next(
|
|
||||||
x['id']
|
|
||||||
for x in result
|
|
||||||
if x['name'] == config.ovh_public_cloud_sshkey_name
|
|
||||||
)
|
|
||||||
|
|
||||||
# Get flavor id
|
|
||||||
result = client.get(
|
|
||||||
'/cloud/project/' + config.ovh_public_cloud_project + '/flavor',
|
|
||||||
region=config.ovh_public_cloud_region,
|
|
||||||
)
|
|
||||||
flavor_id = next(
|
|
||||||
x['id']
|
|
||||||
for x in result
|
|
||||||
if x['name'] == 's1-2'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create instance
|
|
||||||
name = str(uuid.uuid4())
|
|
||||||
result = client.post(
|
|
||||||
'/cloud/project/' + config.ovh_public_cloud_project + '/instance',
|
|
||||||
flavorId=flavor_id,
|
|
||||||
imageId=image_id,
|
|
||||||
monthlyBilling=False,
|
|
||||||
name=name,
|
|
||||||
region=config.ovh_public_cloud_region,
|
|
||||||
sshKeyId=ssh_key_id
|
|
||||||
)
|
|
||||||
|
|
||||||
if 'id' not in result:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Wait for IP address
|
|
||||||
while True:
|
|
||||||
result = client.get(
|
|
||||||
'/cloud/project/' + config.ovh_public_cloud_project + '/instance',
|
|
||||||
region=config.ovh_public_cloud_region,
|
|
||||||
)
|
|
||||||
ipAddresses = next(
|
|
||||||
x['ipAddresses']
|
|
||||||
for x in result
|
|
||||||
if x['name'] == name
|
|
||||||
)
|
|
||||||
if ipAddresses:
|
|
||||||
print(ipAddresses[0])
|
|
||||||
sys.exit(0)
|
|
||||||
time.sleep(30)
|
|
||||||
# Clear VM
|
|
||||||
elif sys.argv[1] == 'purge':
|
|
||||||
if len(sys.argv) < 3:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Get instance id from its IP address
|
|
||||||
result = client.get(
|
|
||||||
'/cloud/project/' + config.ovh_public_cloud_project + '/instance',
|
|
||||||
region=config.ovh_public_cloud_region,
|
|
||||||
)
|
|
||||||
instance_id = next(
|
|
||||||
x['id']
|
|
||||||
for x in result
|
|
||||||
if sys.argv[2] in x['ipAddresses']
|
|
||||||
)
|
|
||||||
|
|
||||||
# Delete instance
|
|
||||||
client.delete(
|
|
||||||
'/cloud/project/' + config.ovh_public_cloud_project +
|
|
||||||
'/instance/' + instance_id
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
sys.exit(1)
|
|
110
ovh_orchestrator/__main__.py
Normal file
110
ovh_orchestrator/__main__.py
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
import uuid
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
import ovh
|
||||||
|
|
||||||
|
from . import config
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
client = ovh.Client(
|
||||||
|
endpoint=config.ovh_endpoint,
|
||||||
|
application_key=config.ovh_application_key,
|
||||||
|
application_secret=config.ovh_application_secret,
|
||||||
|
consumer_key=config.ovh_consumer_key,
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Create VM
|
||||||
|
if sys.argv[1] == 'init':
|
||||||
|
# Get image id
|
||||||
|
result = client.get(
|
||||||
|
'/cloud/project/' + config.ovh_public_cloud_project + '/image',
|
||||||
|
flavorType='s1-2',
|
||||||
|
osType='linux',
|
||||||
|
region=config.ovh_public_cloud_region,
|
||||||
|
)
|
||||||
|
image_id = next(
|
||||||
|
x['id']
|
||||||
|
for x in result
|
||||||
|
if x['name'] == config.ovh_public_cloud_image
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get SSH key id
|
||||||
|
result = client.get(
|
||||||
|
'/cloud/project/' + config.ovh_public_cloud_project + '/sshkey',
|
||||||
|
region=config.ovh_public_cloud_region,
|
||||||
|
)
|
||||||
|
ssh_key_id = next(
|
||||||
|
x['id']
|
||||||
|
for x in result
|
||||||
|
if x['name'] == config.ovh_public_cloud_sshkey_name
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get flavor id
|
||||||
|
result = client.get(
|
||||||
|
'/cloud/project/' + config.ovh_public_cloud_project + '/flavor',
|
||||||
|
region=config.ovh_public_cloud_region,
|
||||||
|
)
|
||||||
|
flavor_id = next(
|
||||||
|
x['id']
|
||||||
|
for x in result
|
||||||
|
if x['name'] == 's1-2'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create instance
|
||||||
|
name = str(uuid.uuid4())
|
||||||
|
result = client.post(
|
||||||
|
'/cloud/project/' + config.ovh_public_cloud_project + '/instance',
|
||||||
|
flavorId=flavor_id,
|
||||||
|
imageId=image_id,
|
||||||
|
monthlyBilling=False,
|
||||||
|
name=name,
|
||||||
|
region=config.ovh_public_cloud_region,
|
||||||
|
sshKeyId=ssh_key_id
|
||||||
|
)
|
||||||
|
|
||||||
|
if 'id' not in result:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Wait for IP address
|
||||||
|
while True:
|
||||||
|
result = client.get(
|
||||||
|
'/cloud/project/' + config.ovh_public_cloud_project + '/instance',
|
||||||
|
region=config.ovh_public_cloud_region,
|
||||||
|
)
|
||||||
|
ipAddresses = next(
|
||||||
|
x['ipAddresses']
|
||||||
|
for x in result
|
||||||
|
if x['name'] == name
|
||||||
|
)
|
||||||
|
if ipAddresses:
|
||||||
|
print(ipAddresses[0]['ip'])
|
||||||
|
sys.exit(0)
|
||||||
|
time.sleep(30)
|
||||||
|
# Clear VM
|
||||||
|
elif sys.argv[1] == 'purge':
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Get instance id from its IP address
|
||||||
|
result = client.get(
|
||||||
|
'/cloud/project/' + config.ovh_public_cloud_project + '/instance',
|
||||||
|
region=config.ovh_public_cloud_region,
|
||||||
|
)
|
||||||
|
instance_id = next(
|
||||||
|
x['id']
|
||||||
|
for x in result
|
||||||
|
if sys.argv[2] in x['ipAddresses']
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete instance
|
||||||
|
client.delete(
|
||||||
|
'/cloud/project/' + config.ovh_public_cloud_project +
|
||||||
|
'/instance/' + instance_id
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
34
run.sh
34
run.sh
@ -1,32 +1,44 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
set -v
|
||||||
|
|
||||||
# Install OVH orchestrator dependencies
|
# Install OVH orchestrator dependencies
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
./.venv/bin/pip install -r requirements.txt
|
./.venv/bin/pip install -r requirements.txt
|
||||||
|
|
||||||
# Set up an OVH instance to run the build
|
# Set up an OVH instance to run the build
|
||||||
printf "%s" "Waiting for OVH instance ..."
|
if [ "$1" == "" ] || [ $# -gt 1 ]; then
|
||||||
IP_ADDRESS=$(./.venv/bin/python3 -m ovh_orchestrator init)
|
printf "%s" "Waiting for OVH instance ..."
|
||||||
while ! timeout 0.2 ping -c 1 -n ${IP_ADDRESS} &> /dev/null
|
IP_ADDRESS=$(./.venv/bin/python3 -m ovh_orchestrator init)
|
||||||
do
|
echo " (IP: ${IP_ADDRESS}) "
|
||||||
printf "%c" "."
|
while ! timeout 0.2 ping -c 1 -n ${IP_ADDRESS} &> /dev/null
|
||||||
done
|
do
|
||||||
|
printf "%c" "."
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
|
||||||
# Run the build on the OVH instance
|
# Wait a bit to ensure SSH is up
|
||||||
scp ./build_android.sh ubuntu@${IP_ADDRESS}:~
|
sleep 10
|
||||||
ssh -f ubuntu@${IP_ADDRESS} 'screen -S build -dm bash ./build_android.sh'
|
|
||||||
|
# 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
|
# Wait for build to complete
|
||||||
set +e
|
set +e
|
||||||
printf "%s" "Building ..."
|
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" "."
|
printf "%c" "."
|
||||||
|
sleep 30
|
||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Fetch back the built images
|
# 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
|
# Purge the OVH instance
|
||||||
./.venv/bin/python3 -m ovh_orchestrator purge ${IP_ADDRESS}
|
./.venv/bin/python3 -m ovh_orchestrator purge ${IP_ADDRESS}
|
||||||
|
Loading…
Reference in New Issue
Block a user