diff --git a/build/envsetup.sh b/build/envsetup.sh index a2b668a2..b80b07be 100644 --- a/build/envsetup.sh +++ b/build/envsetup.sh @@ -10,6 +10,7 @@ Additional LineageOS functions: - lineageremote: Add git remote for LineageOS Gerrit Review. - aospremote: Add git remote for matching AOSP repository. - cafremote: Add git remote for matching CodeAurora repository. +- githubremote: Add git remote for LineageOS Github. - mka: Builds using SCHED_BATCH on all processors. - mkap: Builds the module(s) using mka and pushes them to the device. - cmka: Cleans and builds using mka. @@ -343,6 +344,27 @@ function cafremote() echo "Remote 'caf' created" } +function githubremote() +{ + if ! git rev-parse --git-dir &> /dev/null + then + echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up." + return 1 + fi + git remote rm github 2> /dev/null + local REMOTE=$(git config --get remote.aosp.projectname) + + if [ -z "$REMOTE" ] + then + REMOTE=$(git config --get remote.caf.projectname) + fi + + local PROJECT=$(echo $REMOTE | sed -e "s#platform/#android/#g; s#/#_#g") + + git remote add github https://github.com/LineageOS/$PROJECT + echo "Remote 'github' created" +} + function installboot() { if [ ! -e "$OUT/recovery/root/etc/recovery.fstab" ];