forked from OkBuddyGSI/gsi_builder
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.sh
77 lines (71 loc) · 2.62 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
set -e
# Set up symlinks
if [ "${DCDEVSPACE}" != "1" ]; then
echo "Symlinking devspace folder"
mkdir -p devspace
sudo mkdir -p /crave-devspaces
sudo ln -sf ${pwd}/devspace /crave-devspaces
sudo chmod 777 /crave-devspaces
else
echo "We are already running in devspace... Skipping Symlinks"
fi
# Check if repo is already installed
if ! command -v repo >/dev/null 2>&1; then
echo "Repo not found. Installing now..."
# Create bin directory if it doesn't exist
mkdir -p ~/bin
# Download repo script
curl https://storage.googleapis.com/git-repo-downloads/repo >> ~/bin/repo
# Make repo script executable
chmod a+x ~/bin/repo
# Create symbolic link to /usr/bin/repo
sudo ln -sf "/home/$(whoami)/bin/repo" "/usr/bin/repo"
echo "Repo installation complete."
else
echo "Repo already installed."
fi
export PROJECTFOLDER="/crave-devspaces/Lineage21"
export PROJECTID="72"
# Set Crave to build using LineageOS 21 as base
if grep -q "$PROJECTFOLDER" <(crave clone list --json | jq -r '.clones[]."Cloned At"') && [ "${DCDEVSPACE}" == "1" ]; then
crave clone destroy -y $PROJECTFOLDER || echo "Error removing $PROJECTFOLDER"
crave clone create --projectID $PROJECTID $PROJECTFOLDER || echo "Crave clone create failed!"
else
rm -rf $PROJECTFOLDER || true
mkdir $PROJECTFOLDER
cd $PROJECTFOLDER
repo init -u https://github.com/LineageOS/android.git -b lineage-21.0 --git-lfs
fi
# Install crave if running outside devspace
if [ "${DCDEVSPACE}" == "1" ]; then
echo 'No need to set up crave, we are already running in devspace!'
else
mkdir ${HOME}/bin/
curl -s https://raw.githubusercontent.com/accupara/crave/master/get_crave.sh | bash -s --
mv ${PWD}/crave ${HOME}/bin/
sudo ln -sf /home/${USER}/bin/crave /usr/bin/crave
envsubst < ${PWD}/crave.conf.sample >> ${PWD}/crave.conf
rm -rf ${PWD}/crave.conf.sample
fi
# Run inside foss.crave.io devspace, in the project folder
# Remove existing local_manifests
echo "Triggering build!"
echo "Build Queued!"
crave run --no-patch -- "rm -rf .repo/local_manifests/
# Initialize our Manifest
repo init -u https://github.com/LineageOS/android.git -b lineage-21.0 --git-lfs --depth=1
# Clone local_manifests repository
git clone https://github.com/a57y17lte-dev/local_manifest.git .repo/local_manifests -b lineage-21
# Sync the repositories
/opt/crave/resync.sh
# Set up build environment
source build/envsetup.sh
# Lunch configuration
lunch lineage_a5y17lte-ap1a-eng
make installclean
m bacon"
# Pull generated zip files
#crave pull out/target/product/*/*.zip
# Upload zips to Telegram
# telegram-upload --to sdreleases tissot/*.zip