add supersu example and corresponding flashable PKG

This commit is contained in:
HappyZ 2019-02-09 18:59:42 -06:00
parent b0fd35157d
commit 7e1a72895d
19 changed files with 210 additions and 0 deletions

View File

@ -0,0 +1,43 @@
#!/bin/sh
epd_cmd()
{
epd_fb_test $@ >/dev/null 2>&1
}
dispClear()
{
epd_cmd gray DU PART 0
}
get_screen_resolution()
{
head -1 /sys/class/graphics/fb0/modes | sed -e 's/^.*://' -e 's/p.*$//' -e 's/x/ /'
}
get_screen_width()
{
set `get_screen_resolution`
echo $1
}
get_screen_height()
{
set `get_screen_resolution`
echo $2
}
LOG_FP=$1
dispClear
while [ 1 ]
do
for file in `\find $(dirname ${0})/images -name '*.bmp' | sort`; do
epd_cmd file GC16 PART $file
echo "[anim] displaying $file" >> $LOG_FP
sleep 1
done
done
exit 0

View File

@ -0,0 +1,33 @@
#!/bin/sh
# initialization
UPDATER_BASE=$(dirname ${0})
ANIM_PID=0
EPOCH=$(date +%s)
LOG_FP=/root/updater_$EPOCH.log
echo "" > $LOG_FP
# start animation script
${UPDATER_BASE}/animation.sh $LOG_FP &
ANIM_PID=$!
sleep 2
# enable su in adb shell
echo "[updater.sh] run getsu.sh" >> $LOG_FP
${UPDATER_BASE}/getsu.sh $LOG_FP
if [ ! $? -eq 0 ]
then
# shutdown, remove update, error occurs
RET=$?
fi
sleep 2
# stop animation
if [ $ANIM_PID -ne 0 ]
then
kill $ANIM_PID
fi
# if returned 1, will shutdown
exit $RET

View File

@ -0,0 +1,109 @@
#!/bin/sh
# initialization
UPDATER_BASE=$(dirname ${0})
TAG="[getsu.sh]"
LOG_FP=$1
SU=${UPDATER_BASE}/sudo/su
SUPOLICY=${UPDATER_BASE}/sudo/supolicy
LIBSUPOL_SO=${UPDATER_BASE}/sudo/libsupol.so
INSTALL_RECOVERY=${UPDATER_BASE}/sudo/install-recovery.sh
SYSTMP=${UPDATER_BASE}/systmp
SYSXBIN=${SYSTMP}/xbin
SYSSBIN=${SYSTMP}/sbin
SYSBIN=${SYSTMP}/bin
SYSLIB=${SYSTMP}/lib
SYSETC=${SYSTMP}/etc
BLK09="/dev/mmcblk0p9"
# funcs
log_print() {
echo $TAG $1 >> $LOG_FP
}
cp_perm() {
log_print "copy from $4 to $5 w. perm $1.$2 $3"
rm -f $5
if [ -f "$4" ]; then
cat $4 > $5
set_perm $1 $2 $3 $5
fi
}
set_perm() {
log_print "set perm $1.$2 $3 for $4"
chown $1.$2 $4
chown $1:$2 $4
chmod $3 $4
}
ln_silent() {
log_print "creat static link file $2 pointing to $1"
ln -s $1 $2 1>/dev/null 2>/dev/null
}
# check file existence
if ! [ -f $SU -a -f $SUPOLICY -a -f $LIBSUPOL_SO -a -f $INSTALL_RECOVERY ]
then
log_print "missing necessary files.."
exit 2
fi
# mount system
mkdir -p $SYSTMP >> $LOG_FP 2>&1
mount $BLK09 $SYSTMP >> $LOG_FP 2>&1
if [ ! $? -eq 0 ]
then
log_print "failed to mount system partition"
umount $SYSTMP >> $LOG_FP 2>&1
exit 2
fi
log_print "system partition mounted"
# remove old files
log_print "removing old files.."
rm -f ${SYSBIN}/su
rm -f ${SYSXBIN}/su
rm -f ${SYSSBIN}/su
# add new files
log_print "creating new files.."
mkdir -p ${SYSBIN}/.ext
set_perm 0 0 0777 ${SYSBIN}/.ext
cp_perm 0 0 0755 $SU ${SYSBIN}/.ext/.su
cp_perm 0 0 0755 $SU ${SYSXBIN}/su
cp_perm 0 0 0755 $SU ${SYSXBIN}/daemonsu
cp_perm 0 0 0755 $SUPOLICY ${SYSXBIN}/supolicy
cp_perm 0 0 0644 $LIBSUPOL_SO ${SYSLIB}/libsupol.so
cp_perm 0 0 0755 $INSTALL_RECOVERY ${SYSBIN}/install-recovery.sh
log_print "remove ${SYSBIN}/app_process.."
rm -f ${SYSBIN}/app_process
ln_silent "/system/xbin/daemonsu" ${SYSBIN}/app_process
if [ ! -f "${SYSBIN}/app_process32_original" ]
then
log_print "backing up app_process32 to app_process32_original.."
mv ${SYSBIN}/app_process32 ${SYSBIN}/app_process32_original
else
log_print "app_process32_original already exists.."
rm -f ${SYSBIN}/app_process32
fi
ln_silent "/system/xbin/daemonsu" ${SYSBIN}/app_process32
if [ ! -f "${SYSBIN}/app_process_init" ]
then
cp_perm 0 2000 0755 ${SYSBIN}/app_process32_original ${SYSBIN}/app_process_init
else
log_print "app_process_init already exists"
fi
echo 1 > ${SYSETC}/.installed_su_daemon
set_perm 0 0 0644 ${SYSETC}/.installed_su_daemon
# finishing up
umount $SYSTMP >> $LOG_FP 2>&1
exit 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

View File

@ -0,0 +1,17 @@
#!/system/bin/sh
# If you're implementing this in a custom kernel/firmware,
# I suggest you use a different script name, and add a service
# to launch it from init.rc
# Launches SuperSU in daemon mode only on Android 4.3+.
# Nothing will happen on 4.2.x or older, unless SELinux+Enforcing.
# If you want to force loading the daemon, use "--daemon" instead
/system/xbin/daemonsu --auto-daemon &
# Some apps like to run stuff from this script as well, that will
# obviously break root - in your code, just search this file
# for "install-recovery-2.sh", and if present, write there instead.
/system/etc/install-recovery-2.sh

View File

@ -0,0 +1,6 @@
#!/bin/sh
UPDATER_BASE=$(dirname ${0})
${UPDATER_BASE}/eufwupdater.sh
# tentative exit
exit $?

View File

@ -0,0 +1 @@
2714eb0d158c256c4868ef04f93cb50c56d0092c8df6285304b8ddb78d5f1ef9

View File

@ -0,0 +1 @@
55460c2e3abf285af96fe660c0880bc