Skip to content

Commit

Permalink
envsetup: Fix aosp & caf remote
Browse files Browse the repository at this point in the history
Fixes: sed: -e expression omnirom#1, char 9: unknown option to `s'

* Return if .git directory is missing and move it on the top
* Update cmremote strings ( match caf/aosp remote )

Change-Id: Ifb606a20f308e7317e9ce519d682a3fdb8bfe9bf
  • Loading branch information
luca020400 authored and westcripp committed May 9, 2016
1 parent c19b2f5 commit 1047ca5
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1685,31 +1685,32 @@ function godir () {

function cmremote()
{
git remote rm cmremote 2> /dev/null
GERRIT_REMOTE=$(git config --get remote.github.projectname)
if [ -z "$GERRIT_REMOTE" ]
if ! git rev-parse --git-dir &> /dev/null
then
echo Unable to set up the git remote, are you under a git repo?
return 0
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 cmremote 2> /dev/null
GERRIT_REMOTE=$(git config --get remote.github.projectname)
CMUSER=$(git config --get review.review.cyanogenmod.org.username)
if [ -z "$CMUSER" ]
then
git remote add cmremote ssh://review.cyanogenmod.org:29418/$GERRIT_REMOTE
else
git remote add cmremote ssh://$CMUSER@review.cyanogenmod.org:29418/$GERRIT_REMOTE
fi
echo You can now push to "cmremote".
echo "Remote 'cmremote' created"
}

function aospremote()
{
git remote rm aosp 2> /dev/null
if [ ! -d .git ]
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.
echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
return 1
fi
PROJECT=`pwd -P | sed s#$ANDROID_BUILD_TOP/##g`
git remote rm aosp 2> /dev/null
PROJECT=${$(pwd -P)#$ANDROID_BUILD_TOP/}
if (echo $PROJECT | grep -qv "^device")
then
PFX="platform/"
Expand All @@ -1720,12 +1721,13 @@ function aospremote()

function cafremote()
{
git remote rm caf 2> /dev/null
if [ ! -d .git ]
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.
echo ".git directory not found. Please run this from the root directory of the Android repository you wish to set up."
return 1
fi
PROJECT=`pwd -P | sed s#$ANDROID_BUILD_TOP/##g`
git remote rm caf 2> /dev/null
PROJECT=${$(pwd -P)#$ANDROID_BUILD_TOP/}
if (echo $PROJECT | grep -qv "^device")
then
PFX="platform/"
Expand Down

0 comments on commit 1047ca5

Please sign in to comment.