Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/system/bin/sh
- PATH=/sbin:/system/bin:/system/xbin
- # Run original binary
- /system/bin/mot_boot_mode.bin "$@"
- # Get USB mode (if fail, boot USB enumeration mode)
- USBMODE=$(getprop ro.usb_mode)
- # Write date to log
- RUNDATE=`date`
- # Write uid/gid to log
- RUNAS=`id`
- # Set old and new init.rc locations
- OLDINIT=/init.rc
- NEWINITRC=/system/etc/rootfs/init.rc
- # Get md5 sums for old and new init.rc
- OLDMD5=`cat $OLDINIT | md5sum`
- NEWMD5=`cat $NEWINIT | md5sum`
- # Set additional root files locations
- NEWMAPPHONE=/system/etc/rootfs/init.olympus.rc
- NEWPHONEUEVENTD=/system/etc/rootfs/ueventd.olympus.rc
- NEWPROP=/system/etc/rootfs/default.prop
- NEWINIT=/system/etc/rootfs/init
- NEWUVENTD=/system/etc/rootfs/ueventd.rc
- # Check log dir
- if [ ! -d /data/2nd-init ]; then
- mkdir /data/2nd-init
- fi
- echo "Run date: $RUNDATE." >> /data/2nd-init/log
- echo "Running as: $RUNAS." >> /data/2nd-init/log
- echo "Usb mode is: $USBMODE." >> /data/2nd-init/log
- # Run 2nd-init if not in debug mode
- if [ "$USBMODE" != "debug" ]; then
- # Compare md5 hash to determine useful copy
- if [ "$OLDMD5" != "$NEWMD5" ]; then
- # Remount rootfs read/write to copy new files
- mount -o remount,rw rootfs / >> /data/2nd-init/log 2>&1
- mount -o remount,rw /system/
- mv /sbin/adbd /sbin/adbd.old
- setprop ctl.stop runtime
- setprop ctl.zygote
- setprop persist.service.adb.enable 1
- # Copy new root files
- cp -p /system/bin/fixboot.sh /sbin
- cp -p /system/bin/hijack.killall /sbin
- cp -p /system/xbin/busybox /sbin
- cp -p /system/etc/rootfs/* /.
- cp -p /system/etc/rootfs/sbin/* /sbin
- #Setup BusyBox
- cd /sbin
- ln -s busybox [
- ln -s busybox [[
- ln -s busybox ash
- ln -s busybox awk
- ln -s busybox basename
- ln -s busybox bbconfig
- ln -s busybox bunzip2
- ln -s busybox bzcat
- ln -s busybox bzip2
- ln -s busybox cal
- ln -s busybox cat
- ln -s busybox catv
- ln -s busybox chattr
- ln -s busybox chgrp
- ln -s busybox chmod
- ln -s busybox chown
- ln -s busybox chroot
- ln -s busybox cksum
- ln -s busybox clear
- ln -s busybox cmp
- ln -s busybox cp
- ln -s busybox cpio
- ln -s busybox cut
- ln -s busybox date
- ln -s busybox dc
- ln -s busybox dd
- ln -s busybox depmod
- ln -s busybox devmem
- ln -s busybox df
- ln -s busybox diff
- ln -s busybox dirname
- ln -s busybox dmesg
- ln -s busybox dos2unix
- ln -s busybox du
- ln -s busybox echo
- ln -s busybox egrep
- ln -s busybox env
- ln -s busybox expand
- ln -s busybox expr
- ln -s busybox false
- ln -s busybox fdisk
- ln -s busybox fgrep
- ln -s busybox find
- ln -s busybox fold
- ln -s busybox free
- ln -s busybox freeramdisk
- ln -s busybox fuser
- ln -s busybox getopt
- ln -s busybox grep
- ln -s busybox groups
- ln -s busybox gunzip
- ln -s busybox gzip
- ln -s busybox head
- ln -s busybox hexdump
- ln -s busybox id
- ln -s busybox insmod
- ln -s busybox install
- ln -s busybox kill
- ln -s busybox killall
- ln -s busybox killall5
- ln -s busybox length
- ln -s busybox less
- ln -s busybox ln
- ln -s busybox losetup
- ln -s busybox ls
- ln -s busybox lsattr
- ln -s busybox lsmod
- ln -s busybox lspci
- ln -s busybox lsusb
- ln -s busybox lzcat
- ln -s busybox lzop
- ln -s busybox lzopcat
- ln -s busybox makedevs
- ln -s busybox md5sum
- ln -s busybox mkdir
- ln -s busybox mkfifo
- ln -s busybox mkfs.ext2
- ln -s busybox mknod
- ln -s busybox mkswap
- ln -s busybox mktemp
- ln -s busybox modinfo
- ln -s busybox modprobe
- ln -s busybox more
- ln -s busybox mount
- ln -s busybox mountpoint
- ln -s busybox mv
- ln -s busybox nanddump
- ln -s busybox nandwrite
- ln -s busybox nice
- ln -s busybox nohup
- ln -s busybox od
- ln -s busybox patch
- ln -s busybox pgrep
- ln -s busybox pidof
- ln -s busybox pkill
- ln -s busybox printenv
- ln -s busybox printf
- ln -s busybox ps
- ln -s busybox pstree
- ln -s busybox pwd
- ln -s busybox rdev
- ln -s busybox readlink
- ln -s busybox realpath
- ln -s busybox renice
- ln -s busybox reset
- ln -s busybox resize
- ln -s busybox rev
- ln -s busybox rm
- ln -s busybox rmdir
- ln -s busybox rmmod
- ln -s busybox run-parts
- ln -s busybox sed
- ln -s busybox seq
- ln -s busybox setconsole
- ln -s busybox setserial
- ln -s busybox setsid
- ln -s busybox sh
- ln -s busybox sha1sum
- ln -s busybox sha256sum
- ln -s busybox sha512sum
- ln -s busybox sleep
- ln -s busybox sort
- ln -s busybox split
- ln -s busybox stat
- ln -s busybox strings
- ln -s busybox stty
- ln -s busybox swapoff
- ln -s busybox swapon
- ln -s busybox sync
- ln -s busybox sysctl
- ln -s busybox tac
- ln -s busybox tail
- ln -s busybox tar
- ln -s busybox tee
- ln -s busybox test
- ln -s busybox time
- ln -s busybox top
- ln -s busybox touch
- ln -s busybox tr
- ln -s busybox true
- ln -s busybox tty
- ln -s busybox umount
- ln -s busybox uname
- ln -s busybox unexpand
- ln -s busybox uniq
- ln -s busybox unix2dos
- ln -s busybox unlzma
- ln -s busybox unlzop
- ln -s busybox unxz
- ln -s busybox unzip
- ln -s busybox uptime
- ln -s busybox usleep
- ln -s busybox uudecode
- ln -s busybox uuencode
- ln -s busybox watch
- ln -s busybox wc
- ln -s busybox which
- ln -s busybox whoami
- ln -s busybox xargs
- ln -s busybox xzcat
- ln -s busybox yes
- ln -s busybox zcat
- cd /
- #log file structs
- ls -l / >> /data/2nd-init/rootstruct.txt
- ls -l /sbin >> /data/2nd-init/sbinstruct.txt
- ls -l /system/etc/rootfs >> /data/2nd-init/rootfsstruct.txt
- #Run kill all
- /sbin/hijack.killall >> /data/2nd-init/ka.log
- # Set dual-core processor affinity
- taskset -p -c 0 1
- # Sync buffer and write
- sync
- # Set task to CPU 0 and run 2nd-init
- taskset -c 0 /system/bin/2nd-init >> /data/2nd-init/log 2>&1
- echo "2nd-init completed successfully." >> /data/2nd-init/log
- fi
- fi
- # Bump log for next time
- echo "" >> /data/2nd-init/log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement