[Android] Android4.0第一次进入系统后自动配置;

#!/system/bin/sh
# Version: 0.3
# Author:linkscue
# E-mail:linkscue@gmail.com
# Funtion: init the first boot
# Filename: /system/etc/init.d/99firstboot
if [[ -e /data/system/first_boot ]]; then
    echo "this is not first boot."
    exit 1
fi

mount -o remount,rw /dev/block/mmcblk0p17 /system
#1. VIM(init)
if [[ -f /data/local/bin/vim ]];then
    if [[ ! -e /system/xbin/vim ]];then
       ln -s /data/local/bin/vim /system/xbin/vim
    else
    echo "/system/xbin/vim is existed!"
    fi
else
    echo "can't find vim-android"
fi
echo ">> vim is ok!"
#2. BTEP(bash)
dir_data=/data/data/com.magicandroidapps.bettertermpro/downloader
dir_syst=/system/etc/enhance/BTEP_DL
if [[ -d $dir_syst ]];then
    if [[ ! -d $dir_data ]];then
    mkdir -p $dir_data
    cp -av $dir_syst/* $dir_data/ #注:博客园的注释有问题..
    chmod 777 $dir_data
    else
    echo "[$dir_data] is existed!"
    fi
else
    echo "[$dir_syst] is not exist!"
fi
echo ">> BTEP is ok!"
#3. Apex(75% transparent background)
Apex_pre=/data/data/com.anddoes.launcher/shared_prefs/com.anddoes.launcher_preferences.xml
detect=`grep drawer_background_alpha /data/data/com.anddoes.launcher/shared_prefs/com.anddoes.launcher_preferences.xml`
while [[ ! -e $Apex_pre ]]; do
    sleep 1;
done
if [[ -z $detect ]]; then 
    sed -i '5 i\<int name="drawer_background_alpha" value="60" />' $Apex_pre
    killall com.anddoes.launcher
    am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHE -n com.anddoes.launcher/com.anddoes.launcher.Launcher
fi
echo ">> Apex is ok!"
#4. Root Explorer
RE_Pre=/data/data/com.speedsoftware.rootexplorer/shared_prefs/com.speedsoftware.rootexplorer_preferences.xml
detect0=`grep folders_first /data/data/com.speedsoftware.rootexplorer/shared_prefs/com.speedsoftware.rootexplorer_preferences.xml`
detect1=`grep home /data/data/com.speedsoftware.rootexplorer/shared_prefs/com.speedsoftware.rootexplorer_preferences.xml`
while [[ ! -e $RE_Pre ]]; do
    sleep 1;
done
if [[ -z $detect0 ]]; then
    sed -i '3 i\<boolean name="folders_first" value="true" />' $RE_Pre
    sed -i '4 i\<string name="home">/sdcard</string>' $RE_Pre
    killall com.speedsoftware.rootexplorer
    am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHE -n com.speedsoftware.rootexplorer/com.speedsoftware.rootexplorer.RootExplorer
fi
echo ">> Root Explorer is ok!"

echo "first_boot_OK!" > /data/system/first_booted
mount -o remount,ro /dev/block/mmcblk0p17 /system

 

posted @ 2013-02-19 08:29  scue  阅读(392)  评论(0编辑  收藏  举报