-
Notifications
You must be signed in to change notification settings - Fork 10
/
recovery-uninstall.sh
57 lines (45 loc) · 1.72 KB
/
recovery-uninstall.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
#!/system/bin/sh
# By Hashcode
# Version: 3.00
PATH=/system/bin:/system/xbin
INSTALLPATH=$1
RECOVERY_DIR=/etc/safestrap
LOGFILE=$INSTALLPATH/action-uninstall.log
chmod 755 $INSTALLPATH/busybox
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`
echo '' > $LOGFILE
# determine our active system, and mount/remount accordingly
if [ ! "$CURRENTSYS" = "$PRIMARYSYS" ]; then
# alt-system, needs to mount original /system
DESTMOUNT=$INSTALLPATH/system
if [ ! -d "$DESTMOUNT" ]; then
$INSTALLPATH/busybox mkdir $DESTMOUNT
$INSTALLPATH/busybox chmod 755 $DESTMOUNT
fi
$INSTALLPATH/busybox mount -t ext3 $PRIMARYSYS $DESTMOUNT >> $LOGFILE
else
DESTMOUNT=/system
sync
$INSTALLPATH/busybox mount -o remount,rw $DESTMOUNT >> $LOGFILE
fi
if [ -f "$DESTMOUNT/bin/logwrapper.bin" ]; then
$INSTALLPATH/busybox cp -f $DESTMOUNT/bin/logwrapper.bin $DESTMOUNT/bin/logwrapper >> $LOGFILE
$INSTALLPATH/busybox chown 0.2000 $DESTMOUNT/bin/logwrapper >> $LOGFILE
$INSTALLPATH/busybox chmod 755 $DESTMOUNT/bin/logwrapper >> $LOGFILE
fi
if [ -d "$DESTMOUNT$RECOVERY_DIR" ]; then
$INSTALLPATH/busybox rm -r $DESTMOUNT$RECOVERY_DIR >> $LOGFILE
fi
sync
# determine our active system, and umount/remount accordingly
if [ ! "$CURRENTSYS" = "$PRIMARYSYS" ]; then
$INSTALLPATH/busybox umount $DESTMOUNT >> $LOGFILE
$INSTALLPATH/busybox rmdir $DESTMOUNT
else
$INSTALLPATH/busybox mount -o ro,remount $DESTMOUNT >> $LOGFILE
fi