forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_nano
More file actions
executable file
·169 lines (132 loc) · 3.27 KB
/
add_nano
File metadata and controls
executable file
·169 lines (132 loc) · 3.27 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
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
############################################################################
#
# Copyright (c) 2011 - 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
echo
echo "----------------------------------------------------------------"
echo
echo "Nano is a text editor that can be run from the ADB shell on your "
echo "computer or from a terminal emulator (e.g. ConnectBot) on your"
echo "Android device. To run it from a shell, type: nano"
echo
echo "The scripts 'sysrw' and 'sysro' will also be included to make it"
echo "easier to mount the /system folder (as read-write or read-only)"
echo "for file editing purposes as root."
echo
echo "----------------------------------------------------------------"
echo
echo -n "Proceed with install (y/n)? (default: y): "
read do_install
if [ "$do_install" == "n" ]
then
exit 0
fi
echo
scripts/add_busybox no_clear
res=$?
if [ "$res" == "1" ]
then
exit 0
fi
#
# sysro/sysrw require busybox to mount
# The regular 'mount' doesn't work for all devices
#
scripts/convert_to_unix tools/nano_files/sysrw
scripts/convert_to_unix tools/nano_files/sysro
cd WORKING_*
echo
sys_path=`find . -name sysrw`
if [ "$sys_path" == "" ]
then
cp -fv ../tools/nano_files/sysrw system/xbin/
else
echo "Found $sys_path"
fi
sys_path=`find . -name sysro`
if [ "$sys_path" == "" ]
then
cp -fv ../tools/nano_files/sysro system/xbin/
else
echo "Found $sys_path"
fi
cd ..
echo
scripts/add_sysrorw_to_update_script
scripts/check_galaxy_s_and_s2
if [ "$?" == "1" ]
then
echo
echo "Nano feature not supported by kitchen for this ROM"
else
scripts/ensure_boot_extracted
if [ -d BOOT-EXTRACTED ]
then
if [ -d WORKING_* ]
then
if [ -d BOOT-EXTRACTED/boot.img-ramdisk ]
then
cd BOOT-EXTRACTED/boot.img-ramdisk
else
echo "Error: BOOT-EXTRACTED/boot.img-ramdisk folder not found!"
exit 0
fi
else
exit 0
fi
else
exit 0
fi
echo
if [ `grep -c TERMINFO init.rc` == 1 ]
then
echo "TERMINFO already defined in init.rc"
cd ../..
rm -rf BOOT-EXTRACTED
else
echo "Setting TERMINFO in init.rc ..."
perl -pi -e 's/ export PATH / export TERMINFO \/system\/etc\/terminfo\n export PATH /g' init.rc
if [ -e init.rc.bak ]
then
rm -f init.rc.bak
fi
if [ "`grep TERMINFO init.rc`" == "" ]
then
echo "Error: Could not update init.rc!"
cd ../..
rm -rf BOOT-EXTRACTED
exit 0
fi
cd ../..
scripts/build_boot_img
echo
echo "Adding /system/etc/terminfo ..."
echo
cd WORKING_*
mkdir -p system/etc/terminfo
cp ../tools/nano_files/terminfo.zip system/etc/terminfo/
cd system/etc/terminfo
unzip terminfo.zip
rm terminfo.zip
cd ../../../..
fi
echo
scripts/nano_exists
res=$?
if [ "$res" == "0" ]
then
cd WORKING_*
cp -fv ../tools/nano_files/nano system/xbin/
cd ..
else
echo "Found nano binary"
fi
scripts/add_nano_to_update_script
fi
scripts/fix_update_script_blanks