Chinaunix首页 | 论坛 | 博客
  • 博客访问: 344782
  • 博文数量: 80
  • 博客积分: 711
  • 博客等级: 上士
  • 技术积分: 733
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-23 15:43
文章分类

全部博文(80)

文章存档

2015年(9)

2014年(14)

2013年(33)

2012年(24)

我的朋友

分类: LINUX

2012-04-29 20:24:05

#!/bin/bash

### Function declare ###
function _stdOut() {
    echo -e "\033[32m"; #Green output
    echo $1;
    echo -e "\e[0m"; #Normal output
}

function _stdErr() {
    echo -e "\033[31m"; #Red output
    echo $1;
    echo -e "\e[0m"; #Normal ouput
}

### Step 1: Retrieve the module from console ###
if [ $1 != "" -a $2 != "" ]
then
    PRODUCT=$1;
    MODULE=$2;
    echo "Product is ${PRODUCT}, Module is ${MODULE}";
else
    _stdErr "Usage: $0 product_name module_name";
    exit;
fi

### Step 2: Change Diretory to current and set environment ###
CUR_DIR=$(pwd);
cd ${CUR_DIR};
source build/envsetup.sh > /dev/null;

### Step 3: Compile ###
rm -rf out/target/product/${PRODUCT}/system/app/${MODULE}.apk; 
#./makeMtk -t far2 mm packages/apps/${MODULE};
mmm packages/apps/$MODULE | grep "Install";
if [ $? != 0 ]
then
    _stdErr "Make error.";
    exit;
fi

### Step 4: Uninstall ###
ls -al out/target/product/${PRODUCT}/system/app/${MODULE}.apk | \
egrep -o "([0-9]{4})-([0-1][0-9])-([0-9]{2}) ([0-9]{2}):([0-9]{2})";
if [ $? != 0 ]
then
    _stdErr "ERROR";
    exit;
fi

adb root > /dev/null;
adb remount > /dev/null;
adb shell rm /system/app/${MODULE}.apk;
adb uninstall com.android.mms > /dev/null;

### Step 5: Install ###
adb push out/target/product/${PRODUCT}/system/app/${MODULE}.apk /system/app/;

_stdOut "${MODULE} has been pushed to ${PRODUCT}.";
阅读(985) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~