自己写的一些小脚本

哈哈.我的bash shell编程很烂的.
请大家指正

这个是loopsh的.

#!/system/bin/sh

# auto run shell
for i in $(ls /system/etc/init.d);do
	/system/etc/init.d/$i;
done;
unset i;
if [ -d /sdcard/andboot/userinit.d ];
then
	for j in $(ls /sdcard/andboot/userinit.d);do
		echo "---now applying userinit sh";
		/sdcard/andboot/userinit.d/$j;
	done;
	unset j;
fi;

# set oc
if [ -e /sdcard/andboot/oc/ahb_div ];
then
	cat /sdcard/andboot/oc/ahb_div > /sys/module/clock_7x00/parameters/ahb_div;
fi;
if [ -e /sdcard/andboot/oc/a11 ];
then
	cat /sdcard/andboot/oc/a11 > /sys/module/clock_7x00/parameters/a11;
fi;

这个是自动swap的

#!/system/bin/sh
if [ -e /dev/block/mmcblk0p4 ];
then
	echo "--- Applying swap on mmcblk0p4";
	mkswap /dev/block/mmcblk0p4;
	swapon /dev/block/mmcblk0p4;
elif [ -e /dev/block/mmcblk0p3 ];
then
	echo  "---Applying swap on mmcblk0p3";
	mkswap /dev/block/mmcblk0p3;
	swapon /dev/block/mmcblk0p3;
else 
	if [ -e /sdcard/andboot/swapfile ];
	then
	    echo "--- Applying swap on swapfile";
	    swapon /sdcard/andboot/swapfile;
	else
	    dd if=/dev/zero of=/sdcard/andboot/swapfile bs=1M count=64;
	    mkswap /sdcard/andboot/swapfile;
	    swapon /sdcard/andboot/swapfile;
	fi;
fi;

标签: none

评论已关闭