forked from CyanogenDefy/android_external_bootmenu
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpre_bootmenu.sh
executable file
·82 lines (56 loc) · 1.7 KB
/
pre_bootmenu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/system/bin/sh
######## BootMenu Script
######## Execute Pre BootMenu
export PATH=/sbin:/system/xbin:/system/bin
source /system/bootmenu/script/_config.sh
######## Main Script
BB_STATIC="/system/bootmenu/binary/busybox"
BB="/sbin/busybox"
## reduce lcd backlight to save battery
echo 64 > /sys/class/leds/lcd-backlight/brightness
# these first commands are duplicated for broken systems
mount -o remount,rw rootfs /
$BB_STATIC mount -o remount,rw /
# we will use the static busybox
cp -f $BB_STATIC $BB
$BB_STATIC cp -f $BB_STATIC $BB
chmod 755 /sbin
chmod 755 $BB
$BB chown 0.0 $BB
$BB chmod 4755 $BB
if [ -f /sbin/chmod ]; then
# job already done...
exit 0
fi
# busybox sym link..
for cmd in $($BB --list); do
$BB ln -s /sbin/busybox /sbin/$cmd
done
# add lsof to debug locks
cp -f /system/bootmenu/binary/lsof /sbin/lsof
$BB chmod +rx /sbin/*
# custom adbd (allow always root)
cp -f /system/bootmenu/binary/adbd /sbin/adbd.root
chown 0.0 /sbin/adbd.root
chmod 4755 /sbin/adbd.root
chmod 666 /dev/graphics/fb0
## missing system files
[ ! -c /dev/tty0 ] && ln -s /dev/tty /dev/tty0
## /default.prop replace.. (TODO: check if that works)
cp -f /system/bootmenu/config/default.prop /default.prop
## mount cache
mkdir -p /cache
# stock mount, with fsck
if [ -x /system/bin/mount_ext3.sh ]; then
/system/bin/mount_ext3.sh cache /cache
fi
# mount cache for boot mode and recovery logs
if [ ! -d /cache/recovery ]; then
mount -t $FS_CACHE -o nosuid,nodev,noatime,nodiratime,barrier=1 $PART_CACHE /cache
fi
mkdir -p /cache/bootmenu
# load ondemand safe settings to reduce heat and battery use
if [ -x /system/bootmenu/script/overclock.sh ]; then
/system/bootmenu/script/overclock.sh safe
fi
exit 0