Sorry for my bad English.
I am trying to add my_script.sh to get Total RAM size.
Then if the Total RAM size < 512 MB RAM, it's delete some APKs in /system/app
Here is the sequence I did.
1. Unpacking boot.img to get file init.rk30board.rc
2. In the init.rk30board.rc, added below on post-fs:
exec u:r:init:s0 root root -- /oem/my_script.sh
3. Put file my_script.sh to folder /oem/ of unpacking boot.img
Content of file my_script.sh
is_mounted() { if [ -z "$2" ] ; then cat /proc/mounts | grep $1 >/dev/null else cat /proc/mounts | grep $1 | grep "$2," >/dev/null fi return $? } # cm_vd_dir=/vendor/etc/my_log cm_vd_logfile=$cm_vd_dir/install.txt # rw_my_log() { if [ ! -f "$cm_vd_logfile" ]; then touch $cm_vd_logfile chmod 644 $cm_vd_logfile fi echo "$1" >> $cm_vd_logfile } # ok_run_now() { TOT=`cat /proc/meminfo | grep MemTotal: | awk '{print $2}'` rw_my_log "$TOT" } # SYSTEM=$(resolve_link $(find /dev/block/platform -type l | grep -i -m 1 "/app$")) || SYSTEM=$(resolve_link $(find /dev/block/platform -type l | grep -i -m 1 "/system$")) if (! is_mounted /system) ; then mount -o rw /system ; fi if (! is_mounted /system rw) ; then mount -o rw,remount /system ; fi if (! is_mounted /system rw) ; then mount -t ext4 -o rw $SYSTEM /system ; fi if (! is_mounted /system rw) ; then mount -t f2fs -o rw $SYSTEM /system ; fi if (! is_mounted /system rw) ; then rw_my_log "Failed! Can not mount /system rw, aborting!" exit 1 fi case "$1" in ON_POST_FS) ok_run_now ;; ON_BOOT_OK) #ok_run_now ;; esac return 0
RESULT: It looks like the script is not executing.
I am not see $TOT output for the log in file: /vendor/etc/my_log/intall.txt
Please help me.
Thanks.