forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchange_wipe
More file actions
executable file
·101 lines (79 loc) · 2.36 KB
/
change_wipe
File metadata and controls
executable file
·101 lines (79 loc) · 2.36 KB
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
############################################################################
#
# Copyright (c) 2012 - dsixda ([email protected])
#
# Android Kitchen is 100% free. This script file is intended for personal
# and/or educational use only. It may not be duplicated for monetary
# benefit or any other purpose without the permission of the developer.
#
############################################################################
clear
if [ -d WORKING_* ]
then
echo Found working folder
else
echo No working folder found!
exit 0
fi
clear
cd WORKING_*
cd META-INF/com/google/android
echo
if [ -e update-script ]
then
grep_wipe=`grep -c "format .*DATA:" update-script`
if [ "$grep_wipe" == "0" ]
then
echo "Currently the ROM will NOT WIPE your data during a flash"
echo -n "Would you like to change this to wipe (y/n)? (default: n): "
read do_wipe
echo
if [ "$do_wipe" == "y" ]
then
if [ `grep -c "delete DATA" update-script` != 0 ]
then
#
# Check if non-standard line required, e.g. format yaffs2 DATA:
#
fmt_line=`grep -om 1 "format .*SYSTEM:" update-script | sed -e 's/SYSTEM/DATA/g'`
#
# Change only the first occurrence
#
sed -i -e '0,/delete DATA/s/delete DATA/'"$fmt_line"'\ndelete DATA/' update-script
else
sed -i -e 's/format\(.*\)SYSTEM:[ ]*[\n]*/format\1SYSTEM:\nformat\1DATA:\n/' update-script
fi
grep_wipe=`grep -c "format .*DATA:" update-script`
if [ "$grep_wipe" == "1" ]
then
echo "OK, ROM will now wipe your data"
else
echo "Error: Unable to modify update-script"
fi
else
echo "OK, nothing will be changed"
fi
else
echo "Currently the ROM will WIPE your data during a flash"
echo -n "Would you like to change this to not wipe (y/n)? (default: n): "
read dont_wipe
echo
if [ "$dont_wipe" == "y" ]
then
sed -i -e 's/format .*DATA:[ ]*[\n]*//g' update-script
grep_wipe=`grep -c "format .*DATA:" update-script`
if [ "$grep_wipe" == "0" ]
then
echo "OK, ROM will no longer wipe your data"
else
echo "Error: Unable to modify update-script"
fi
else
echo "OK, nothing will be changed"
fi
fi
else
echo "Error: No update-script found!"
fi
cd ../../../../..
scripts/fix_update_script_blanks