手動刷入xposed腳本android
########################################################################################## # # Xposed framework installer zip. # # This script installs the Xposed framework files to the system partition. # The Xposed Installer app is needed as well to manage the installed modules. # ########################################################################################## grep_prop() { REGEX="s/^$1=//p" shift FILES=$@ if [ -z "$FILES" ]; then FILES='/system/build.prop' fi cat $FILES 2>/dev/null | sed -n $REGEX | head -n 1 } android_version() { case $1 in 15) echo '4.0 / SDK'$1;; 16) echo '4.1 / SDK'$1;; 17) echo '4.2 / SDK'$1;; 18) echo '4.3 / SDK'$1;; 19) echo '4.4 / SDK'$1;; 21) echo '5.0 / SDK'$1;; 22) echo '5.1 / SDK'$1;; 23) echo '6.0 / SDK'$1;; 24) echo '7.0 / SDK'$1;; 25) echo '7.1 / SDK'$1;; 26) echo '8.0 / SDK'$1;; 27) echo '8.1 / SDK'$1;; *) echo 'SDK'$1;; esac } SYSTEMLIB=/system/lib ui_print() { echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD } ch_con() { # LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon -h u:object_r:system_file:s0 $1 # LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon -h u:object_r:system_file:s0 $1 chcon -h u:object_r:system_file:s0 $1 # LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon u:object_r:system_file:s0 $1 # LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon u:object_r:system_file:s0 $1 chcon u:object_r:system_file:s0 $1 } ch_con_ext() { # LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon $2 $1 # LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon $2 $1 chcon $2 $1 } ln_ext() { # LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ln -s $1 $2 # LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox ln -s $1 $2 ln -s $1 $2 } set_perm() { chown $1.$2 $4 chown $1:$2 $4 chmod $3 $4 #ch_con $4 #ch_con_ext $4 $5 } cp_perm() { rm $5 cat $4 > $5 set_perm $1 $2 $3 $5 $6 } install_nobackup() { cp_perm ./$1 $1 $2 $3 $4 $5 } install_and_link() { TARGET=$1 XPOSED="${1}_xposed" BACKUP="${1}_original" if [ ! -f "/tmp/xposed/$XPOSED" ]; then return fi cp_perm $2 $3 $4 /tmp/xposed/$XPOSED $XPOSED $5 if [ ! -f $BACKUP ]; then mv $TARGET $BACKUP ln_ext $XPOSED $TARGET fi } install_overwrite() { TARGET=$1 if [ ! -f "/tmp/xposed/$TARGET" ]; then return fi BACKUP="${1}.orig" NO_ORIG="${1}.no_orig" if [ ! -f $TARGET ]; then echo -n > $NO_ORIG elif [ ! -f $BACKUP -a ! -f $NO_ORIG ]; then mv $TARGET $BACKUP fi cp_perm $2 $3 $4 /tmp/xposed/$TARGET $TARGET $5 } ########################################################################################## echo "******************************" echo "Xposed framework installer zip" echo "******************************" if [ ! -f "/tmp/xposed/system/xposed.prop" ]; then echo "! Failed: Extracted file /tmp/xposed/system/xposed.prop not found!" exit 1 fi echo "- Mounting /system and /vendor read-write" mount /system >/dev/null 2>&1 mount /vendor >/dev/null 2>&1 mount -o remount,rw /system mount -o remount,rw /vendor >/dev/null 2>&1 if [ ! -f '/system/build.prop' ]; then echo "! Failed: /system could not be mounted!" exit 1 fi echo "- Checking environment" API=$(grep_prop ro.build.version.sdk) APINAME=$(android_version $API) ABI=$(grep_prop ro.product.cpu.abi | cut -c-3) ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3) ABILONG=$(grep_prop ro.product.cpu.abi) XVERSION=$(grep_prop version /tmp/xposed/system/xposed.prop) XARCH=$(grep_prop arch /tmp/xposed/system/xposed.prop) XMINSDK=$(grep_prop minsdk /tmp/xposed/system/xposed.prop) XMAXSDK=$(grep_prop maxsdk /tmp/xposed/system/xposed.prop) XEXPECTEDSDK=$(android_version $XMINSDK) if [ "$XMINSDK" != "$XMAXSDK" ]; then XEXPECTEDSDK=$XEXPECTEDSDK' - '$(android_version $XMAXSDK) fi ARCH=arm IS64BIT= if [ "$ABI" = "x86" ]; then ARCH=x86; fi; if [ "$ABI2" = "x86" ]; then ARCH=x86; fi; if [ "$API" -ge "21" ]; then if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; IS64BIT=1; fi; if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; IS64BIT=1; fi; fi # echo "DBG [$API] [$ABI] [$ABI2] [$ABILONG] [$ARCH] [$XARCH] [$XMINSDK] [$XMAXSDK] [$XVERSION]" echo " Xposed version: $XVERSION" XVALID= if [ "$ARCH" = "$XARCH" ]; then if [ "$API" -ge "$XMINSDK" ]; then if [ "$API" -le "$XMAXSDK" ]; then XVALID=1 else echo "! Wrong Android version: $APINAME" echo "! This file is for: $XEXPECTEDSDK" fi else echo "! Wrong Android version: $APINAME" echo "! This file is for: $XEXPECTEDSDK" fi else echo "! Wrong platform: $ARCH" echo "! This file is for: $XARCH" fi if [ -z $XVALID ]; then echo "! Please download the correct package" echo "! for your platform/ROM!" exit 1 fi # cat /system/bin/toolbox > /system/toolbox # chmod 0755 /system/toolbox # ch_con /system/toolbox echo "- Placing files" cp_perm 0 0 0644 /tmp/xposed/system/xposed.prop /system/xposed.prop cp_perm 0 0 0644 /tmp/xposed/system/framework/XposedBridge.jar /system/framework/XposedBridge.jar install_and_link /system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0 install_overwrite /system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0 install_overwrite /system/bin/oatdump 0 2000 0755 install_overwrite /system/bin/patchoat 0 2000 0755 u:object_r:dex2oat_exec:s0 install_overwrite /system/lib/libart.so 0 0 0644 install_overwrite /system/lib/libart-compiler.so 0 0 0644 install_overwrite /system/lib/libart-disassembler.so 0 0 0644 install_overwrite /system/lib/libsigchain.so 0 0 0644 install_overwrite /system/lib/libxposed_art.so 0 0 0644 if [ $IS64BIT ]; then echo "64" install_and_link /system/bin/app_process64 0 2000 0755 u:object_r:zygote_exec:s0 install_overwrite /system/lib64/libart.so 0 0 0644 install_overwrite /system/lib64/libart-compiler.so 0 0 0644 install_overwrite /system/lib64/libart-disassembler.so 0 0 0644 install_overwrite /system/lib64/libsigchain.so 0 0 0644 install_overwrite /system/lib64/libxposed_art.so 0 0 0644 fi #ui_print "- Unmounting /system" #umount /system echo "- Done" exit 0 複製代碼
文件目錄結構sass
agui@agui-desktop:~/公共的/flash_xposedToModbil$ tree -a . ├── ub.sh └── xposed └── system ├── bin │?? ├── app_process32_xposed │?? ├── app_process32_xposed - ?±±?.zip │?? ├── app_process64_xposed │?? ├── dex2oat │?? ├── oatdump │?? └── patchoat ├── flash-script.sh ├── flash-script.sh.bak ├── framework │?? └── XposedBridge.jar ├── lib │?? ├── libart-compiler.so │?? ├── libart.so │?? ├── libsigchain.so │?? └── libxposed_art.so ├── lib64 │?? ├── libart-disassembler.so │?? ├── libart.so │?? ├── libsigchain.so │?? └── libxposed_art.so └── xposed.prop 6 directories, 19 files agui@agui-desktop:~/公共的/flash_xposedToModbil$ 複製代碼