-
Notifications
You must be signed in to change notification settings - Fork 10
/
recovery-check.sh
39 lines (32 loc) · 1.06 KB
/
recovery-check.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
#!/system/bin/sh
# By Hashcode
# Version: 3.00
PATH=/system/bin:/system/xbin
vers=0
alt_boot_mode=0
INSTALLPATH=$1
RECOVERY_DIR=/etc/safestrap
if [ -f /dev/block/systemorig ]; then
PRIMARYSYS=`$INSTALLPATH/busybox ls -l /dev/block/ | $INSTALLPATH/busybox grep systemorig | $INSTALLPATH/busybox tail -c 22`
else
PRIMARYSYS=`$INSTALLPATH/busybox ls -l /dev/block/ | $INSTALLPATH/busybox grep system | $INSTALLPATH/busybox tail -c 22`
fi
CURRENTSYS=`$INSTALLPATH/busybox ls -l /dev/block/system | $INSTALLPATH/busybox tail -c 22`
if [ ! "$CURRENTSYS" = "$PRIMARYSYS" ]; then
# alt-system, needs to mount original /system
alt_boot_mode=1
DESTMOUNT=$INSTALLPATH/system
if [ ! -d "$DESTMOUNT" ]; then
$INSTALLPATH/busybox mkdir $DESTMOUNT
fi
$INSTALLPATH/busybox mount -t ext3 $PRIMARYSYS $DESTMOUNT
else
DESTMOUNT=/system
fi
if [ -f "$DESTMOUNT$RECOVERY_DIR/flags/version" ]; then
vers=`$INSTALLPATH/busybox cat $DESTMOUNT$RECOVERY_DIR/flags/version`
fi
if [ ! "$CURRENTSYS" = "$PRIMARYSYS" ]; then
$INSTALLPATH/busybox umount $DESTMOUNT
fi
echo "$vers:$alt_boot_mode"