-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutility
executable file
·206 lines (186 loc) · 4.4 KB
/
utility
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/sbin/sh
um
if [ $? != "0" ]; then
echo "Unable to unmount!"
exit 1
fi
clear
echo "More Utilities by BKMO"
echo ""
echo "[1] Convert ext3 > ext4 no data loss"
echo "[2] Fix Permissions 2.03"
echo "[3] Backup APPS on ext to FAT32"
echo "[4] Restore APPS from FAT32 to ext"
echo "[5] Partition SD 3 partitions (can set sizes)"
echo "[6] Fix auto-rotate problems"
echo "[7] Run BART 1.3.1 Backup"
echo "[8] Run BART 1.3.1 Restore"
echo "[9] Reset/delete Battery Stats"
echo "[q] Quit to Console Prompt"
echo "[b] Boot me out of here! (reboot)"
echo "[r] Return to Recovery Menu"
echo " "
echo -n "Enter Number> "
read text
if [ $text = "q" ]; then
echo "quitting..."
clear
fi
if [ $text = "r" ]; then
echo "Returning to Recovery Menu..."
recovery
fi
if [ $text = "b" ]; then
echo "Rebooting..."
reboot
fi
if [ $text = "1" ]; then
echo "Converting to EXT4"
if [ -e /dev/block/mmcblk0p2 ]; then
umount /sd-ext > /dev/null 2>&1;
set -e;
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2;
e2fsck -fpDC0 /dev/block/mmcblk0p2;
fi;
echo "Partition converted to EXT4"
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "2" ]; then
clear
fix_permissions
echo ""
echo "Fix Permissions completed"
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "3" ]; then
echo "Backing up EXT Apps to SDcard"
if [ -e /dev/block/mmcblk0p2 ]; then
mount /sd-ext > /dev/null 2>&1
fi
if [ -e /dev/block/mmcblk0p1 ]; then
mount /sdcard > /dev/null 2>&1
fi
if [ -e /sdcard/appbackup ]; then
rm /sdcard/appbackup/* -f
cp /sd-ext/app/* /sdcard/appbackup
else
mkdir /sdcard/appbackup
cp /sd-ext/app/* /sdcard/appbackup
fi
echo "Apps backed up to SDcard"
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "4" ]; then
echo "Restoring Apps from SDcard to EXT "
if [ -e /dev/block/mmcblk0p2 ]; then
mount /sd-ext > /dev/null 2>&1
fi
if [ -e /dev/block/mmcblk0p1 ]; then
mount /sdcard > /dev/null 2>&1
fi
if [ $text = "Q" ]; then
echo "quitting..."
clear
fi
if [ -e /sdcard/appbackup ]; then
if [ -e /sd-ext/app ]; then
rm /sd-ext/app/* -f
cp /sdcard/appbackup/* /sd-ext/app/
else
mkdir /sd-ext/app
cp /sdcard/appbackup/* /sd-ext/app/
echo "Apps restored from SDcard"
fi
else
echo "NO BACKUP FOUND"
fi
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "5" ]; then
clear
echo "THIS WILL ERASE ALL DATA ON SDCARD!!!!"
echo -n "Continue? (y/n) "
read cont
if [ $cont = "n" ]; then
exit 0;
fi
echo " "
echo "Enter a number ex. 32"
echo -n "Swap size in MB? "
read swap
echo "Enter a number ex. 500"
echo -n "ext2 size in MB? "
read ext
umount /dev/block/mmcblk0p1 > /dev/null 2>&1;
umount /dev/block/mmcblk0p2 > /dev/null 2>&1;
umount /dev/block/mmcblk0p3 > /dev/null 2>&1;
SDSIZEMB=`parted /dev/block/mmcblk0 unit MB print | grep mmcblk0 | cut -d" " -f3`
SDSIZE=${SDSIZEMB%MB}
EXTEND=$(($SDSIZE - $swap))
FATEND=$(($EXTEND - $ext))
echo " "
echo "CLEARING SDCARD..."
parted -s /dev/block/mmcblk0 mklabel msdos;
echo "CREATING $FATEND MB FAT32 PARTITION..."
parted -s /dev/block/mmcblk0 mkpartfs primary fat32 0 "$FATEND";
echo "CREATING $ext MB ext2 PARTITION..."
parted -s /dev/block/mmcblk0 mkpartfs primary ext2 "$FATEND" "$EXTEND";
echo "CREATING $swap MB LINUX-SWAP PARTITION..."
parted -s /dev/block/mmcblk0 mkpartfs primary linux-swap "$EXTEND" "$SDSIZE";
echo "DONE!"
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "6" ]; then
clear
echo "Fixing auto-rotate issue"
wipe rotate
echo ""
echo "Finished Fixing"
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "7" ]; then
clear
echo "Run BART Backup with default settings"
echo ""
echo -n "Enter a name for the backup: "
read name
bart --verbose --norecovery -s $name
echo ""
echo "BART Backup $name saved to SDCARD"
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "8" ]; then
clear
echo "Run BART Restore"
bart --verbose --norecovery -r
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi
if [ $text = "9" ]; then
clear
echo "Reset-delete Battery Stats"
echo ""
mount /data
rm /data/system/batterystats.bin
umount /data
echo ""
echo "Battery stats deleted/reset"
echo ""
read -s -n 1 -p "Press any key to continue . . ."
utility
fi