forked from mozilla-b2g/gonk-misc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
b2g.sh
executable file
·39 lines (35 loc) · 984 Bytes
/
b2g.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
#!/system/bin/sh
umask 0027
export TMPDIR=/data/local/tmp
mkdir -p $TMPDIR
chmod 1777 $TMPDIR
ulimit -n 8192
if [ ! -d /system/b2g ]; then
log -p W "No /system/b2g directory. Attempting recovery."
if [ -d /system/b2g.bak ]; then
if ! mount -w -o remount /system; then
log -p E "Failed to remount /system read-write"
fi
if ! mv /system/b2g.bak /system/b2g; then
log -p E "Failed to rename /system/b2g.bak to /system/b2g"
fi
mount -r -o remount /system
if [ -d /system/b2g ]; then
log "Recovery successful."
else
log -p E "Recovery failed."
fi
else
log -p E "Recovery failed: no /system/b2g.bak directory."
fi
fi
LD_PRELOAD="/system/b2g/libmozglue.so"
if [ -f "/system/b2g/libdmd.so" ]; then
echo "Running with DMD."
LD_PRELOAD="/system/b2g/libdmd.so $LD_PRELOAD"
export DMD="1"
fi
export LD_PRELOAD
export LD_LIBRARY_PATH=/vendor/lib:/system/lib:/system/b2g
export GRE_HOME=/system/b2g
exec /system/b2g/b2g