#!/system/bin/sh # pass to original sdcard pipe=/data/local/tmp/stopdeb sdlog=/data/local/home/sdcard.log trap stop SIGTERM SIGINT trap "rm -f $pipe" EXIT function checkexit() { if [ ! -p $pipe ]; then if [ ! -d /usr ]; then echo "wait for sdcard" >> $sdlog wait $pid exit 0 fi /usr/bin/mkfifo -m 666 $pipe echo "created pipe" >> $sdlog /etc/init.d/rc 2 >> $sdlog 2>&1 echo "init rc: 2" >> $sdlog fi # only stop when shutdown/reboot while true do if read line <$pipe; then if [ "$line" = 'exit' ]; then shut=$(/system/bin/getprop sys.shutdown.requested) echo "shutdown? $shut" >> $sdlog [ "$shut" ] && stop fi fi done } function stop() { /usr/bin/pkill -9 x.org.server /bin/run-parts --regex '^S.*' --reverse --report -a stop /etc/rc2.d >> $sdlog 2>&1 /data/local/deb/bootdeb S /data/local/deb/bootdeb u >> $sdlog 2>&1 num=10 while [ -d /data/local/mnt/usr ]; do if [ $num -eq 0 ]; then echo "give up stop deb." >> $sdlog exit 0 fi /data/local/deb/bootdeb u >> $sdlog 2>&1 $((num--)) done echo "stop deb." >> $sdlog exit 0 } /data/local/home/opt_mount /system/bin/sdcard_o "$@" > /dev/null 2>&1 & pid=$(/usr/bin/pgrep sdcard_o) checkexit