#!/system/bin/sh
MODE=$1
log_print() {
echo "($MODE) $1"
log -p i -t launch_daemonsu "($MODE) $1"
}
log_print "start"
if [ `mount | grep " /data " >/dev/null 2>&1; echo $?` -ne 0 ]; then
# /data not mounted yet, we will be called again later
log_print "abort: /data not mounted #1"
exit
fi
if [ `mount | grep " /data " | grep "tmpfs" >/dev/null 2>&1; echo $?` -eq 0 ]; then
# /data not mounted yet, we will be called again later
log_print "abort: /data not mounted #2"
exit
fi
SBIN=
DAEMONSU=
LOGFILE=
if [ ! -d "/su" ]; then
log_print "/sbin mode"
# sbin mode
SBIN=true
SUFILES=/data/adb/su
DAEMONSU=/sbin/daemonsu
LOGFILE=/sbin/.launch_daemonsu.log
# in case of factory reset
if [ ! -d "/data/adb" ]; then
mkdir /data/adb
chmod 0700 /data/adb
restorecon /data/adb
fi
# cleanup /su mode
rm -rf /data/su.img
else
log_print "/su mode"
# normal systemless mode
SBIN=false
SUFILES=/su
DAEMONSU=/su/bin/daemonsu
LOGFILE=/dev/.launch_daemonsu.log
# cleanup /sbin mode
rm -rf /data/adb/su
fi
if ($SBIN) || [ `cat /proc/mounts | grep $SUFILES >/dev/null 2>&1; echo $?` -eq 0 ]; then
if [ -d "$SUFILES/bin" ]; then
if [ `ps | grep -v "launch_daemonsu.sh" | grep "daemonsu" >/dev/null 2>&1; echo $?` -eq 0 ] || [ `ps -A | grep -v "launch_daemonsu.sh" | grep "daemonsu" >/dev/null 2>&1; echo $?` -eq 0 ]; then
# nothing to do here
log_print "abort: daemonsu already running"
exit
fi
fi
fi
setprop sukernel.daemonsu.launch $MODE
if ($SBIN); then
# make sure our SUFILES directory exists
# not needed in /su mode, created by boot image patcher
mkdir $SUFILES
chown 0.0 $SUFILES
chmod 0755 $SUFILES
chcon u:object_r:system_file:s0 $SUFILES
fi
loopsetup() {
LOOPDEVICE=
for DEV in $(ls /dev/block/loop*); do
if [ `losetup $DEV $1 >/dev/null 2>&1; echo $?` -eq 0 ]; then
LOOPDEVICE=$DEV
break
fi
done
log_print "loopsetup($1): $LOOPDEVICE"
}
resize() {
local LAST=
local SIZE=
for i in `ls -l /data/su.img`; do
if [ "$LAST" = "root" ]; then
if [ "$i" != "root" ]; then
SIZE=$i
break;
fi
fi
LAST=$i
done
log_print "/data/su.img: $SIZE bytes"
if [ "$SIZE" -lt "96000000" ]; then
log_print "resizing /data/su.img to 96M"
e2fsck -p -f /data/su.img
resize2fs /data/su.img 96M
fi
}
REBOOT=false
# copy boot image backups
log_print "copying boot image backups from /cache to /data"
cp -f /cache/stock_boot_* /data/. 2>/dev/null
if ($SBIN); then
if [ -d "/data/supersu_install" ] || [ -d "/cache/supersu_install" ]; then
log_print "merging from [/data|/cache]/supersu_install"
cp -af /data/supersu_install/. $SUFILES
cp -af /cache/supersu_install/. $SUFILES
rm -rf /data/supersu_install
rm -rf /cache/supersu_install
log_print "merge complete"
fi
elif [ ! -d "$SUFILES/bin" ]; then
# not mounted yet, and doesn't exist already, merge
log_print "$SUFILES not mounted yet"
if [ -f "/data/su.img" ]; then
log_print "/data/su.img found"
e2fsck -p -f /data/su.img
# make sure the image is the right size
resize
fi
# newer image in /cache ?
# only used if recovery couldn't mount /data
if [ -f "/cache/su.img" ]; then
log_print "/cache/su.img found"
e2fsck -p -f /cache/su.img
OVERWRITE=true
if [ -f "/data/su.img" ]; then
# attempt merge, this will fail pre-M
# will probably also fail with /system installed busybox,
# but then again, is there anything busybox doesn't break?
# falls back to overwrite
log_print "/data/su.img found"
log_print "attempting merge"
mkdir /cache/data_img
mkdir /cache/cache_img
# setup loop devices
loopsetup /data/su.img
LOOPDATA=$LOOPDEVICE
log_print "$LOOPDATA /data/su.img"
loopsetup /cache/su.img
LOOPCACHE=$LOOPDEVICE
log_print "$LOOPCACHE /cache/su.img"
if [ ! -z "$LOOPDATA" ]; then
if [ ! -z "$LOOPCACHE" ]; then
# if loop devices have been setup, mount images
OK=true
if [ `mount -t ext4 -o rw,noatime $LOOPDATA /cache/data_img >/dev/null 2>&1; echo $?` -ne 0 ]; then
OK=false
fi
if [ `mount -t ext4 -o rw,noatime $LOOPCACHE /cache/cache_img >/dev/null 2>&1; echo $?` -ne 0 ]; then
OK=false
fi
if ($OK); then
# if mounts have succeeded, merge the images
if [ `cp -af /cache/cache_img/. /cache/data_img >/dev/null 2>&1; echo $?` -eq 0 ]; then
log_print "merge complete"
OVERWRITE=false
fi
fi
umount /cache/data_img
umount /cache/cache_img
fi
fi
losetup -d $LOOPDATA
losetup -d $LOOPCACHE
rmdir /cache/data_img
rmdir /cache/cache_img
fi
if ($OVERWRITE); then
# no /data/su.img or merge failed, replace
log_print "replacing /data/su.img with /cache/su.img"
mv /cache/su.img /data/su.img
# make sure the new image is the right size
resize
fi
rm /cache/su.img
fi
if [ ! -f "/data/su.img" ]; then
if [ -d "/.sufrp" ]; then
# create empty image
make_ext4fs -l 96M -a $SUFILES -S /.sufrp/file_contexts_image /data/su.img
chown 0.0 /data/su.img
chmod 0600 /data/su.img
chcon u:object_r:system_data_file:s0 /data/su.img
# make sure the new image is the right size
resize
fi
fi
fi
# do we have an APK to install ?
if [ -f "/cache/SuperSU.apk" ]; then
cp /cache/SuperSU.apk /data/SuperSU.apk
rm /cache/SuperSU.apk
fi
if [ -f "/data/SuperSU.apk" ]; then
log_print "installing SuperSU APK in /data"
APKPATH=eu.chainfire.supersu-1
for i in `ls /data/app | grep eu.chainfire.supersu- | grep -v eu.chainfire.supersu.pro`; do
if [ `cat /data/system/packages.xml | grep $i >/dev/null 2>&1; echo $?` -eq 0 ]; then
APKPATH=$i
break;
fi
done
rm -rf /data/app/eu.chainfire.supersu-*
log_print "SUFILES path: /data/app/$APKPATH"
mkdir /data/app/$APKPATH
chown 1000.1000 /data/app/$APKPATH
chmod 0755 /data/app/$APKPATH
chcon u:object_r:apk_data_file:s0 /data/app/$APKPATH
cp /data/SuperSU.apk /data/app/$APKPATH/base.apk
chown 1000.1000 /data/app/$APKPATH/base.apk
chmod 0644 /data/app/$APKPATH/base.apk
chcon u:object_r:apk_data_file:s0 /data/app/$APKPATH/base.apk
rm /data/SuperSU.apk
sync
# just in case
REBOOT=true
fi
# sometimes we need to reboot, make it so
if ($REBOOT); then
log_print "rebooting"
if [ "$MODE" = "post-fs-data" ]; then
# avoid device freeze (reason unknown)
sh -c "sleep 5; reboot" &
else
reboot
fi
exit
fi
if (! $SBIN) && [ ! -d "$SUFILES/bin" ]; then
# not mounted yet, and doesn't exist already, mount
log_print "preparing mount"
# fix permissions
chown 0.0 /data/su.img
chmod 0600 /data/su.img
chcon u:object_r:system_data_file:s0 /data/su.img
# losetup is unreliable pre-M
if [ `cat /proc/mounts | grep $SUFILES >/dev/null 2>&1; echo $?` -ne 0 ]; then
loopsetup /data/su.img
if [ ! -z "$LOOPDEVICE" ]; then
MOUNT=$(mount -t ext4 -o rw,noatime $LOOPDEVICE $SUFILES 2>&1)
log_print "mount error (if any): $MOUNT"
fi
fi
# trigger mount, should also work pre-M, but on post-fs-data trigger may
# be processed only after this script runs, causing a fallback to service launch
if [ `cat /proc/mounts | grep $SUFILES >/dev/null 2>&1; echo $?` -ne 0 ]; then
setprop sukernel.mount 1
sleep 1
fi
# exit if all mount attempts have failed, script is likely to be called again
if [ `cat /proc/mounts | grep $SUFILES >/dev/null 2>&1; echo $?` -ne 0 ]; then
log_print "abort: mount failed"
exit
fi
log_print "mount succeeded"
fi
if [ ! -d "$SUFILES/bin" ]; then
log_print "FRP: empty $SUFILES"
if [ -d "/.sufrp" ]; then
log_print "FRP: install"
/.sufrp/frp_install
没有合适的资源?快使用搜索试试~ 我知道了~
Superuser.zip
共291个文件
ogg:183个
so:10个
pie:8个
需积分: 9 2 下载量 42 浏览量
2021-01-01
13:45:50
上传
评论
收藏 132.06MB ZIP 举报
温馨提示
安卓root包,在三星i9308测试通过
资源推荐
资源详情
资源评论
收起资源包目录
Superuser.zip (291个子文件)
000000deepsleep 228B
gzip.1 2B
lz4.1 2B
lz4.2 2B
gzip.2 2B
init.supersu.rc.24 523B
liblzma.so.5 216KB
liblzma.so.5 158KB
liblzma.so.5 146KB
99SuperSUDaemon 55B
三星健康 6.7.1.003.apk 71.06MB
三星浏览器 9.4.00.45.apk 65.51MB
galaxystore.apk 20.55MB
三星活动跟踪器 1.46.apk 10.82MB
三星TTS安装包 1.0.apk 4.35MB
主題專爲三星galaxy J7設計 體驗三星系列 1.1.13.apk 3.02MB
stat3-rom.apk 250KB
init.supersu.rc.24.bindsbin 420B
init.supersu.rc.bindsbin 381B
kernel.bootloader 1B
bzip2 73KB
bzip2 68KB
bzip2 64KB
bzip2 2B
chattr 13KB
chattr 13KB
chattr 10KB
chattr 10KB
kernel.config 1B
supersu.x509.der 763B
file_contexts 2KB
file_contexts_image 81B
frp_install 1KB
futility 535KB
hexpatch 656B
BootSignature_Android.jar 27KB
kernel.keyblock 1KB
legz4 2B
lz4 70KB
lz4 49KB
lz4 49KB
lzma 2B
lzo 2B
lzop 70KB
lzop 57KB
lzop 45KB
MANIFEST.MF 7KB
CyanTone.ogg 1.14MB
Silmarillia.ogg 766KB
Gigolo.ogg 760KB
House_of_house.ogg 760KB
Boxbeat.ogg 696KB
Bongo.ogg 384KB
Sceptrum.ogg 309KB
Perseus.ogg 231KB
ArgoNavis.ogg 221KB
CrazyDream.ogg 202KB
UrsaMinor.ogg 181KB
Nobelium.ogg 173KB
Themos.ogg 171KB
DreamTheme.ogg 171KB
Hassium.ogg 144KB
Fermium.ogg 114KB
Scarabaeus.ogg 106KB
Plutonium.ogg 101KB
Nasqueron.ogg 100KB
Neptunium.ogg 95KB
Rang.ogg 93KB
Solarium.ogg 87KB
Acheron.ogg 86KB
Pegasus.ogg 85KB
Curium.ogg 79KB
CyanMessage.ogg 78KB
Vespa.ogg 76KB
Zeta.ogg 76KB
CyanMail.ogg 72KB
Testudo.ogg 70KB
HalfwayHome.ogg 67KB
CyanAlarm.ogg 64KB
Enter_the_Nexus.ogg 60KB
DancinFool.ogg 60KB
Iridium.ogg 57KB
Iridium.ogg 57KB
CyanPing.ogg 56KB
Rigel.ogg 56KB
Playa.ogg 55KB
Stone.ogg 55KB
Glacial_Groove.ogg 54KB
Orion.ogg 53KB
Revelation.ogg 51KB
Barium.ogg 50KB
Eastern_Sky.ogg 49KB
DonMessWivIt.ogg 49KB
GameOverGuitar.ogg 49KB
Copernicium.ogg 48KB
Road_Trip.ogg 48KB
BussaMove.ogg 48KB
Scandium.ogg 47KB
Big_Easy.ogg 46KB
FriendlyGhost.ogg 45KB
共 291 条
- 1
- 2
- 3
资源评论
qq_36146173
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功