User Tools

Site Tools


work:android-shell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
work:android-shell [2012/05/22 13:36] – external edit 127.0.0.1work:android-shell [2016/05/05 13:07] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== 工作中用到的一些脚本 ====== ====== 工作中用到的一些脚本 ======
 +
 +
  
 由于办公室用的是colinux,生成的东西都要通过samba共享出来,有时候目录太深,拷贝文件很不方便,于是就写了几个小脚本来自动拷贝文件. 由于办公室用的是colinux,生成的东西都要通过samba共享出来,有时候目录太深,拷贝文件很不方便,于是就写了几个小脚本来自动拷贝文件.
 +
 +
  
 还有一些其它乱七八糟的脚本. 还有一些其它乱七八糟的脚本.
 +
 ====== mymake.sh ====== ====== mymake.sh ======
 +
 +
  
 用来快速编译单个AP,并将生成的APK拷贝到指定的目录下面,需要放到android工程根目录下. 用来快速编译单个AP,并将生成的APK拷贝到指定的目录下面,需要放到android工程根目录下.
 +
 +
  
   root@ubuntu:/ice/android# cat mymake.sh   root@ubuntu:/ice/android# cat mymake.sh
-<file BASHR mymake.sh>+ 
 +<file BASH mymake.sh> 
 + 
  
 #!/bin/bash #!/bin/bash
 +
 #echo "make Browser && cp out/target/product/generic/system/app/Browser.apk /ice/targetimg/" #echo "make Browser && cp out/target/product/generic/system/app/Browser.apk /ice/targetimg/"
 +
 #make Browser && cp out/target/product/generic/system/app/Browser.apk /ice/targetimg/ #make Browser && cp out/target/product/generic/system/app/Browser.apk /ice/targetimg/
 +
 +
 +
  
  
 START_AT=`date` START_AT=`date`
 +
 +
  
 ROOT_DIR=/ice/android ROOT_DIR=/ice/android
 +
 +
  
 TARGET=generic TARGET=generic
 +
 #TARGET=msm7627_ffa #TARGET=msm7627_ffa
 +
 +
  
 TARGET_DEST=/ice/targetimg/${TARGET} TARGET_DEST=/ice/targetimg/${TARGET}
 +
 +
  
 IMAGE_DIR=${ROOT_DIR}/out/target/product/${TARGET} IMAGE_DIR=${ROOT_DIR}/out/target/product/${TARGET}
 +
 +
  
 mkdir -p ${TARGET_DEST} mkdir -p ${TARGET_DEST}
 +
 +
  
 FRAMEWORK_DIR=${ROOT_DIR}/out/target/product/${TARGET}/system/framework/ FRAMEWORK_DIR=${ROOT_DIR}/out/target/product/${TARGET}/system/framework/
 +
 OUT_DIR=${ROOT_DIR}/out/target/product/${TARGET}/system/app OUT_DIR=${ROOT_DIR}/out/target/product/${TARGET}/system/app
 +
 +
  
 if [ ${#} != 1 ];then if [ ${#} != 1 ];then
 +
 echo "USAGE:${0} module_name" echo "USAGE:${0} module_name"
 +
 echo "example: ${0} Browser" echo "example: ${0} Browser"
 +
 echo "Then Browser.apk will be copied to ${TARGET_DEST}" echo "Then Browser.apk will be copied to ${TARGET_DEST}"
 +
 exit 0 exit 0
 +
 fi fi
 +
 +
  
 echo "Now start make ${1}" echo "Now start make ${1}"
 +
 . build/envsetup.sh . build/envsetup.sh
 +
 make ${1} make ${1}
 +
 +
 +
  
  
 if [ ${1} = "framework" -o ${1} = "core" ];then if [ ${1} = "framework" -o ${1} = "core" ];then
 +
 echo "cp ${FRAMEWORK_DIR}/${1}.jar ${TARGET_DEST}/" echo "cp ${FRAMEWORK_DIR}/${1}.jar ${TARGET_DEST}/"
 +
 cp ${FRAMEWORK_DIR}/${1}.jar ${TARGET_DEST}/ cp ${FRAMEWORK_DIR}/${1}.jar ${TARGET_DEST}/
 +
 +
  
 elif [ ${1} = "snod"   ];then elif [ ${1} = "snod"   ];then
 +
 echo "cp  ${IMAGE_DIR}/system.img ${TARGET_DEST}/" echo "cp  ${IMAGE_DIR}/system.img ${TARGET_DEST}/"
 +
 cp  ${IMAGE_DIR}/system.img ${TARGET_DEST}/ cp  ${IMAGE_DIR}/system.img ${TARGET_DEST}/
 +
 +
 +
  
  
 else else
 +
 echo "cp ${OUT_DIR}/${1}.apk ${TARGET_DEST}/" echo "cp ${OUT_DIR}/${1}.apk ${TARGET_DEST}/"
 +
 cp ${OUT_DIR}/${1}.apk ${TARGET_DEST}/ cp ${OUT_DIR}/${1}.apk ${TARGET_DEST}/
 +
 +
  
 fi fi
 +
 +
  
 #out/target/product/generic/system/framework/core.jar #out/target/product/generic/system/framework/core.jar
 +
 +
 +
  
  
 END_AT=`date` END_AT=`date`
 +
 +
  
 echo "START AT:${START_AT}" echo "START AT:${START_AT}"
 +
 echo "Finished AT:${END_AT}" echo "Finished AT:${END_AT}"
 +
 +
  
 </file> </file>
 +
 +
 +
  
  
 ====== makedalvik.sh ====== ====== makedalvik.sh ======
 +
 编译dalvik目录,并调用mymake.sh直接打包system.img(make snod) 编译dalvik目录,并调用mymake.sh直接打包system.img(make snod)
 +
 +
  
 <file bash makedalvik.sh> <file bash makedalvik.sh>
 +
 root@ubuntu:~/shell# cat makedalvik.sh root@ubuntu:~/shell# cat makedalvik.sh
 +
 #!/bin/bash #!/bin/bash
 +
 +
  
 echo "Make dalvik for Target,and will run make snod to package the system.img" echo "Make dalvik for Target,and will run make snod to package the system.img"
 +
 +
  
 echo ". build/envsetup.sh" echo ". build/envsetup.sh"
 +
 source build/envsetup.sh source build/envsetup.sh
 +
 echo "choosecombo Device release msm7627_ffa eng" echo "choosecombo Device release msm7627_ffa eng"
 +
 choosecombo Device release msm7627_ffa eng choosecombo Device release msm7627_ffa eng
 +
 echo "cd dalvik" echo "cd dalvik"
 +
 cd dalvik cd dalvik
 +
 echo "mm" echo "mm"
 +
 mm mm
 +
 echo "cd .." echo "cd .."
 +
 cd .. cd ..
 +
 echo "./mymake snod" echo "./mymake snod"
 +
 ./mymake.sh snod ./mymake.sh snod
 +
 +
  
 </file> </file>
 +
 +
  
 ====== mybuild.sh ====== ====== mybuild.sh ======
 +
 用来编译整个工程的,拷贝生成的image到指定目录 用来编译整个工程的,拷贝生成的image到指定目录
 +
   root@ubuntu:/ice/android/build# cat mybuild.sh   root@ubuntu:/ice/android/build# cat mybuild.sh
 +
 <file BASH mybuild.sh> <file BASH mybuild.sh>
 +
 #!/bin/sh #!/bin/sh
 +
 +
  
 START=`date` START=`date`
 +
 EMU_SOURCEDIR=/ice/android/out/target/product/generic EMU_SOURCEDIR=/ice/android/out/target/product/generic
 +
 TARGET_SOURCEDIR=/ice/android/out/target/product/msm7627_ffa TARGET_SOURCEDIR=/ice/android/out/target/product/msm7627_ffa
 +
 +
  
 EMU_DESTDIR=/ice/targetimg/emulator/ EMU_DESTDIR=/ice/targetimg/emulator/
 +
 TARGET_DESTDIR=/ice/targetimg/target/ TARGET_DESTDIR=/ice/targetimg/target/
 +
 +
 +
  
  
 mkdir -p ${EMU_DESTDIR} mkdir -p ${EMU_DESTDIR}
 +
 mkdir -p ${TARGET_DESTDIR} mkdir -p ${TARGET_DESTDIR}
 +
 +
 +
  
  
 [ -e ${TARGET_DESTDIR}download.sh  ] || { echo "cp /root/shell/download.sh/ ${TARGET_DESTDIR};"; cp /root/shell/download.sh ${TARGET_DESTDIR}; } [ -e ${TARGET_DESTDIR}download.sh  ] || { echo "cp /root/shell/download.sh/ ${TARGET_DESTDIR};"; cp /root/shell/download.sh ${TARGET_DESTDIR}; }
 +
 +
  
 #./build.sh ${1} #./build.sh ${1}
 +
 +
  
 if [ ${1} = "target" ]; then if [ ${1} = "target" ]; then
 +
 +
  
         echo "cp ${TARGET_SOURCEDIR}/boot.img ${TARGET_DESTDIR} "         echo "cp ${TARGET_SOURCEDIR}/boot.img ${TARGET_DESTDIR} "
 +
         cp ${TARGET_SOURCEDIR}/boot.img ${TARGET_DESTDIR}         cp ${TARGET_SOURCEDIR}/boot.img ${TARGET_DESTDIR}
 +
 +
  
         echo "cp ${TARGET_SOURCEDIR}/system.img ${TARGET_DESTDIR} "         echo "cp ${TARGET_SOURCEDIR}/system.img ${TARGET_DESTDIR} "
 +
         cp ${TARGET_SOURCEDIR}/system.img ${TARGET_DESTDIR}         cp ${TARGET_SOURCEDIR}/system.img ${TARGET_DESTDIR}
 +
 +
  
         echo "cp ${TARGET_SOURCEDIR}/userdata.img ${TARGET_DESTDIR} "         echo "cp ${TARGET_SOURCEDIR}/userdata.img ${TARGET_DESTDIR} "
 +
         cp ${TARGET_SOURCEDIR}/userdata.img ${TARGET_DESTDIR}         cp ${TARGET_SOURCEDIR}/userdata.img ${TARGET_DESTDIR}
 +
 +
  
         echo "cp ${TARGET_SOURCEDIR}/system/app/Browser.apk ${TARGET_DESTDIR}"         echo "cp ${TARGET_SOURCEDIR}/system/app/Browser.apk ${TARGET_DESTDIR}"
 +
         cp ${TARGET_SOURCEDIR}/system/app/Browser.apk ${TARGET_DESTDIR}         cp ${TARGET_SOURCEDIR}/system/app/Browser.apk ${TARGET_DESTDIR}
 +
 +
  
 elif [ ${1} = "emulator" ];then elif [ ${1} = "emulator" ];then
 +
 +
  
         echo "cp ${EMU_SOURCEDIR}/boot.img ${EMU_DESTDIR} "         echo "cp ${EMU_SOURCEDIR}/boot.img ${EMU_DESTDIR} "
 +
         cp ${EMU_SOURCEDIR}/boot.img ${EMU_DESTDIR}         cp ${EMU_SOURCEDIR}/boot.img ${EMU_DESTDIR}
 +
 +
  
         echo "cp ${EMU_SOURCEDIR}/system.img ${EMU_DESTDIR} "         echo "cp ${EMU_SOURCEDIR}/system.img ${EMU_DESTDIR} "
 +
         cp ${EMU_SOURCEDIR}/system.img ${EMU_DESTDIR}         cp ${EMU_SOURCEDIR}/system.img ${EMU_DESTDIR}
 +
 +
  
         echo "cp ${EMU_SOURCEDIR}/userdata.img ${EMU_DESTDIR} "         echo "cp ${EMU_SOURCEDIR}/userdata.img ${EMU_DESTDIR} "
 +
         cp ${EMU_SOURCEDIR}/userdata.img ${EMU_DESTDIR}         cp ${EMU_SOURCEDIR}/userdata.img ${EMU_DESTDIR}
 +
         echo "cp ${EMU_SOURCEDIR}/system/app/Browser.apk ${EMU_DESTDIR}"         echo "cp ${EMU_SOURCEDIR}/system/app/Browser.apk ${EMU_DESTDIR}"
 +
         cp ${EMU_SOURCEDIR}/system/app/Browser.apk ${EMU_DESTDIR}         cp ${EMU_SOURCEDIR}/system/app/Browser.apk ${EMU_DESTDIR}
 +
 else else
 +
         echo "Nothing to copy"         echo "Nothing to copy"
 +
 +
  
 fi fi
 +
 +
 +
 +
  
  
  
 END=`date` END=`date`
 +
 echo "Start at ${START}" echo "Start at ${START}"
 +
 echo "finished at ${END}" echo "finished at ${END}"
 +
 +
  
 </file> </file>
 +
 ====== getpnglist.sh ====== ====== getpnglist.sh ======
 +
 用来查找drawable png图片在哪些java文件里面用到的脚本 用来查找drawable png图片在哪些java文件里面用到的脚本
 +
   root@ubuntu:~/shell# cat getpnglist.sh   root@ubuntu:~/shell# cat getpnglist.sh
 +
 <file BASH getpnglist.sh> <file BASH getpnglist.sh>
 +
 #!/bin/sh #!/bin/sh
 +
 #Author:pengjianqing@gmail.com #Author:pengjianqing@gmail.com
 +
 #Date:2010/02/03 #Date:2010/02/03
 +
 #Description: #Description:
 +
 #Use the shell to find the resource file and where the resource file is used #Use the shell to find the resource file and where the resource file is used
 +
 #the default file is png #the default file is png
 +
 #Example: #Example:
 +
 #cd /ice #cd /ice
 +
 #./getpnglist.sh Browser #./getpnglist.sh Browser
 +
 # #
 +
 START_AT=`date` START_AT=`date`
 +
 +
  
 APP_NAME=${1} APP_NAME=${1}
 +
 APP_DIR=android/packages/apps APP_DIR=android/packages/apps
 +
 RES_DIR=res RES_DIR=res
 +
 +
  
 FILE_TYPE=png FILE_TYPE=png
 +
 +
  
 echo "Get the ${APP_NAME} png list in the resource directory" echo "Get the ${APP_NAME} png list in the resource directory"
 +
 echo "*************************************************************" echo "*************************************************************"
 +
 +
  
 echo "Create the ${APP_NAME}_${FILE_TYPE}_list.txt" echo "Create the ${APP_NAME}_${FILE_TYPE}_list.txt"
 +
 ls ${APP_DIR}/${APP_NAME}/${RES_DIR}/*/*.${FILE_TYPE}|grep -v hdpi >${APP_NAME}_${FILE_TYPE}_list.txt ls ${APP_DIR}/${APP_NAME}/${RES_DIR}/*/*.${FILE_TYPE}|grep -v hdpi >${APP_NAME}_${FILE_TYPE}_list.txt
 +
 echo "*************************************************************" echo "*************************************************************"
 +
 +
  
 FILE_LIST=`ls ${APP_DIR}/${APP_NAME}/${RES_DIR}/*/*.${FILE_TYPE}|grep -v hdpi` FILE_LIST=`ls ${APP_DIR}/${APP_NAME}/${RES_DIR}/*/*.${FILE_TYPE}|grep -v hdpi`
 +
 +
  
 echo "Create the ${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt" echo "Create the ${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt"
 +
 echo ${RESULT}>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt echo ${RESULT}>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt
 +
 echo "*************************************************************" echo "*************************************************************"
 +
 for i in `echo ${FILE_LIST}`: for i in `echo ${FILE_LIST}`:
 +
 do do
 +
    echo "*************************************************************" >>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt    echo "*************************************************************" >>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt
 +
      FILENAME=`echo ${i}|cut -d "/" -f7|cut -d "." -f1`      FILENAME=`echo ${i}|cut -d "/" -f7|cut -d "." -f1`
 +
      echo "Filename:${FILENAME}" >>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt      echo "Filename:${FILENAME}" >>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt
 +
 +
  
      #grep -i -R -n ${FILENAME} ${APP_DIR}/${APP_NAME} -d ${APP_DIR}/${APP_NAME}/.git/      #grep -i -R -n ${FILENAME} ${APP_DIR}/${APP_NAME} -d ${APP_DIR}/${APP_NAME}/.git/
 +
     RESULT=`grep -i -R -n ${FILENAME} ${APP_DIR}/${APP_NAME}/src ${APP_DIR}/${APP_NAME}/res`     RESULT=`grep -i -R -n ${FILENAME} ${APP_DIR}/${APP_NAME}/src ${APP_DIR}/${APP_NAME}/res`
 +
    echo "${RESULT}"    echo "${RESULT}"
 +
 +
  
    echo ${RESULT}>>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt    echo ${RESULT}>>${APP_NAME}_${FILE_TYPE}_WhereUsed_list.txt
 +
 echo "*************************************************************" echo "*************************************************************"
 +
 done done
 +
 echo "*************************************************************" echo "*************************************************************"
 +
 END_AT=`date` END_AT=`date`
 +
 echo "Start at:${START_AT}" echo "Start at:${START_AT}"
 +
 echo "Finished at:${END_AT}" echo "Finished at:${END_AT}"
 +
 echo "done." echo "done."
 +
 +
 +
  
  
 </file> </file>
 +
 +
 +
 +
 +
  
  
/var/www/dokuwiki/wiki/data/attic/work/android-shell.1337664969.txt.gz · Last modified: 2016/05/05 13:06 (external edit)