forked from PeterSuh-Q3/tinycore-redpill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
myv
executable file
·195 lines (163 loc) · 9.73 KB
/
myv
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
#!/bin/bash
# myv.sh (Batch Shell Script for rploader.sh)
# Made by Peter Suh
# 2022.04.18
##### INCLUDES #########################################################################################################
source myfunc.h # my.sh / myv.sh common use
########################################################################################################################
mshellgz="my.sh.gz"
mshtarfile="https://raw.githubusercontent.com/PeterSuh-Q3/tinycore-redpill/main/my.sh.gz"
# ==============================================================================
# Color Function
# ==============================================================================
function cecho () {
# if [ -n "$3" ]
# then
# case "$3" in
# black | bk) bgcolor="40";;
# red | r) bgcolor="41";;
# green | g) bgcolor="42";;
# yellow | y) bgcolor="43";;
# blue | b) bgcolor="44";;
# purple | p) bgcolor="45";;
# cyan | c) bgcolor="46";;
# gray | gr) bgcolor="47";;
# esac
# else
bgcolor="0"
# fi
code="\033["
case "$1" in
black | bk) color="${code}${bgcolor};30m";;
red | r) color="${code}${bgcolor};31m";;
green | g) color="${code}${bgcolor};32m";;
yellow | y) color="${code}${bgcolor};33m";;
blue | b) color="${code}${bgcolor};34m";;
purple | p) color="${code}${bgcolor};35m";;
cyan | c) color="${code}${bgcolor};36m";;
gray | gr) color="${code}${bgcolor};37m";;
esac
text="$color$2${code}0m"
echo -e "$text"
}
# Function EXDRIVER_FN
# Made by FOXBI
# 2022.04.14
# ==============================================================================
# Extension Driver Function
# ==============================================================================
function EXDRIVER_FN() {
# ==============================================================================
# Clear extension & install extension driver
# ==============================================================================
echo
cecho c "Delete extension file..."
sudo rm -rf ./redpill-load/custom/extensions/*
echo
# cecho c "Update ext-manager..."
# ./redpill-load/ext-manager.sh update
echo
cecho r "Add to Driver Repository..."
echo
READ_YN "Do you want Add Driver? Y/N : "
ICHK=$Y_N
while [ "$ICHK" == "y" ] || [ "$ICHK" == "Y" ]
do
ICNT=
JCNT=
IRRAY=()
while read LINE_I;
do
ICNT=$(($ICNT + 1))
JCNT=$(($ICNT%5))
if [ "$JCNT" -eq "0" ]
then
IRRAY+=("$ICNT) $LINE_I\ln");
else
IRRAY+=("$ICNT) $LINE_I\lt");
fi
done < <(curl --no-progress-meter https://github.com/PeterSuh-Q3/rp-ext | grep "raw.githubusercontent.com" | awk '{print $2}' | awk -F= '{print $2}' | sed "s/\"//g" | awk -F/ '{print $7}')
echo ""
echo -e " ${IRRAY[@]}" | sed 's/\\ln/\n/g' | sed 's/\\lt/\t\t/g'
echo ""
read -n100 -p " -> Select Number Enter (To select multiple, separate them with , ): " I_O
echo ""
I_OCHK=`echo $I_O | grep , | wc -l`
if [ "$I_OCHK" -gt "0" ]
then
while read LINE_J;
do
j=$((LINE_J - 1))
IEXT=`echo "${IRRAY[$j]}" | sed 's/\\\ln//g' | sed 's/\\\lt//g' | awk '{print $2}'`
if [ $TARGET_REVISION == "42218" ] ; then
./rploader.sh ext ${TARGET_PLATFORM}-7.0.1-${TARGET_REVISION}-JUN add https://raw.githubusercontent.com/PeterSuh-Q3/rp-ext/master/$IEXT/rpext-index.json
else
./rploader.sh ext ${TARGET_PLATFORM}-7.1.1-${TARGET_REVISION} add https://raw.githubusercontent.com/PeterSuh-Q3/rp-ext/master/$IEXT/rpext-index.json
fi
done < <(echo $I_O | tr ',' '\n')
else
I_O=$(($I_O - 1))
for (( i = 0; i < $ICNT; i++)); do
if [ "$I_O" == $i ]
then
export IEXT=`echo "${IRRAY[$i]}" | sed 's/\\\ln//g' | sed 's/\\\lt//g' | awk '{print $2}'`
fi
done
if [ $TARGET_REVISION == "42218" ] ; then
./rploader.sh ext ${TARGET_PLATFORM}-7.0.1-${TARGET_REVISION}-JUN add https://raw.githubusercontent.com/PeterSuh-Q3/rp-ext/master/$IEXT/rpext-index.json
else
./rploader.sh ext ${TARGET_PLATFORM}-7.1.1-${TARGET_REVISION} add https://raw.githubusercontent.com/PeterSuh-Q3/rp-ext/master/$IEXT/rpext-index.json
fi
fi
echo
READ_YN "Do you want add driver? Y/N : "
ICHK=$Y_N
done
}
function checkinternet() {
echo -n "Checking Internet Access -> "
curl -L https://github.com/about.html -O 2>&1 >/dev/null
if [ $? -eq 0 ]; then
echo "OK"
else
cecho g "Error: No internet found, or github.com is not accessible"
exit 99
fi
}
###############################################################################
# git clone redpill-load
function gitdownload() {
git config --global http.sslVerify false
if [ -d "/home/tc/redpill-load" ]; then
cecho y "Loader sources already downloaded, pulling latest !!!"
cd /home/tc/redpill-load
git pull
cd /home/tc
else
git clone -b master "https://github.com/PeterSuh-Q3/redpill-load.git"
fi
}
checkinternet
getlatestmshell
if [ $# -lt 1 ]; then
showhelp
exit 99
fi
gitdownload
getvars "$1"
curl --location --progress-bar "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/custom_config.json" -O
curl --location --progress-bar "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/custom_config_jun.json" -O
curl --location --progress-bar "https://github.com/PeterSuh-Q3/rp-ext/raw/main/rpext-index.json" -O
echo "======Mount the ramdisk for quick add processing of extensions frmo myv.sh.======="
[ ! -d /home/tc/redpill-load/custom/extensions ] && mkdir /home/tc/redpill-load/custom/extensions
[ ! -n "$(mount | grep -i extensions)" ] && sudo mount -t tmpfs -o size=512M tmpfs /home/tc/redpill-load/custom/extensions
cecho y "Adding Ext in progress..."
EXDRIVER_FN
if [ ! -f my ]; then
echo "my file not found, trying to download"
curl --location "https://github.com/PeterSuh-Q3/tinycore-redpill/raw/main/my.sh.gz" --output my.sh.gz
tar -zxvf my.sh.gz
fi
cecho g "Call my now..."
./my $@ frmyv
exit 0