view android/my-android-activate @ 610:92f77b6d0d99

Utilities for enabling access to Android SDK.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Mon, 18 Jan 2016 01:06:17 +0200
parents
children
line wrap: on
line source

#!/bin/bash

root=
for f in /opt/*/platform-tools/adb; do
  if [[ -f $f ]]; then
    root=${f%/platform-tools/adb}
    break
  fi
done

if [[ -z "$root" ]]; then
  echo "Can't find /opt/*/sdk/platform-tools/adb like file..."
  exit 1
fi

echo root: $root

if [[ $PATH == *$root/platform-tools* ]]; then
  echo SKIP: $root/platform-tools already in PATH
else
  PATH=$root/platform-tools:$PATH
  echo add to PATH: $root/platform-tools
fi
if [[ $PATH == *$root/tools* ]]; then
  echo SKIP: $root/tools already in PATH
else
  PATH=$root/tools:$PATH
  echo add to PATH: $root/tools
fi

for f in $root/build-tools/*/aapt; do
  if [[ -x $f ]]; then
    bt=${f%/aapt}
    if [[ $PATH == *$bt/* ]]; then
      echo SKIP: $bt already in PATH
    else
      PATH=$bt:$PATH
      echo add to PATH: $bt
    fi
    break
  fi
done

export PATH