Last active
March 28, 2024 05:05
-
-
Save Megh-Rana/a23a37fe573312387c18dfff05e8bdfd to your computer and use it in GitHub Desktop.
neo5 build script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Set up the build environment | |
| source build/envsetup.sh | |
| rm -rf kernel/oppo/neo5 | |
| rm -rf build | |
| # Sync Device Specific Repos | |
| # Define repositories, branches, and directories in a single array | |
| REPOSITORIES=( | |
| "https://github.com/LineageOS/android_device_oppo_neo5 cm-12.1 device/oppo/neo5" | |
| "https://github.com/LineageOS/android_device_oppo_common cm-12.1 device/oppo/common" | |
| "https://github.com/cyanogenMod/android_device_qcom_common cm-12.1 device/qcom/common" | |
| "https://github.com/TheMuppets/proprietary_vendor_oppo cm-12.1 vendor/oppo" | |
| "https://github.com/Meghthedev/android_kernel_oppo_neo5 cm-12.1 kernel/oppo/neo5" | |
| "https://github.com/Meghthedev/android_build cm-12.1 build" | |
| ) | |
| # Function to update or clone a repository | |
| function update_or_clone_repository() { | |
| local REPO_URL=$1 | |
| local DIRECTORY=$2 | |
| local BRANCH=$3 | |
| # Check if the repository directory exists | |
| if [ -d "$DIRECTORY" ]; then | |
| # Move to the repository directory | |
| cd "$DIRECTORY" || exit | |
| # Fetch the latest changes | |
| git fetch --quiet | |
| # Remove All untracked files | |
| git clean -fd | |
| # Reset the HEAD to the current branch | |
| git reset --hard "origin/$BRANCH" | |
| # Move back to the original directory | |
| cd - || exit | |
| else | |
| # Clone the repository if it doesn't exist | |
| git clone "$REPO_URL" "$DIRECTORY" --branch "$BRANCH" --depth=1 | |
| fi | |
| } | |
| # Clone or update each repository | |
| for REPO in "${REPOSITORIES[@]}"; do | |
| IFS=' ' read -r -a REPO_ARRAY <<< "$REPO" | |
| REPO_URL="${REPO_ARRAY[0]}" | |
| DIRECTORY="${REPO_ARRAY[-1]}" | |
| BRANCH="${REPO_ARRAY[-2]}" | |
| echo "Updating or cloning $DIRECTORY..." | |
| update_or_clone_repository "$REPO_URL" "$DIRECTORY" "$BRANCH" | |
| done | |
| echo "Update or clone complete." | |
| croot | |
| export LC_ALL=C | |
| lunch cm_neo5-userdebug | |
| make bacon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment