forked from pocopico/tinycore-redpill
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathmenu.sh
executable file
·98 lines (82 loc) · 2.51 KB
/
menu.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
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
#!/bin/bash
set -u # Unbound variable errors are not allowed
##### INCLUDES ######################################################################################
. /home/tc/functions.sh
#####################################################################################################
function check_internet() {
ping -c 1 -W 1 8.8.8.8 > /dev/null 2>&1
return $?
}
function gitclone() {
git clone -b master --single-branch --depth=1 https://github.com/PeterSuh-Q3/redpill-load.git
if [ $? -ne 0 ]; then
git clone -b master --single-branch --depth=1 https://gitea.com/PeterSuh-Q3/redpill-load.git
fi
}
function gitdownload() {
cd /home/tc
git config --global http.sslVerify false
if [ -d /home/tc/redpill-load ]; then
echo "Loader sources already downloaded, pulling latest"
cd /home/tc/redpill-load
git pull
if [ $? -ne 0 ]; then
cd /home/tc
rploader clean
gitclone
fi
cd /home/tc
else
gitclone
fi
}
function mmc_modprobe() {
echo "excute modprobe for mmc(include sd)..."
sudo /sbin/modprobe mmc_block
sudo /sbin/modprobe mmc_core
sudo /sbin/modprobe rtsx_pci
sudo /sbin/modprobe rtsx_pci_sdmmc
sudo /sbin/modprobe sdhci
sudo /sbin/modprobe sdhci_pci
sleep 1
if [ `/sbin/lsmod |grep -i mmc|wc -l` -gt 0 ] ; then
echo "Module mmc loaded succesfully!!!"
else
echo "Module mmc failed to load successfully!!!"
fi
}
mmc_modprobe
getloaderdisk
if [ -z "${loaderdisk}" ]; then
echo "Not Supported Loader BUS Type, program Exit!!!"
exit 99
fi
getBus "${loaderdisk}"
tcrppart="${loaderdisk}3"
if [ -d /mnt/${tcrppart}/redpill-load/ ] && [ -d /mnt/${tcrppart}/tcrp-addons/ ] && [ -d /mnt/${tcrppart}/tcrp-modules/ ]; then
echo "Repositories for offline loader building have been confirmed. Copy the repositories to the required location..."
echo "Press any key to continue..."
read answer
cp -rf /mnt/${tcrppart}/redpill-load/ ~/
mv -f /mnt/${tcrppart}/tcrp-addons/ /dev/shm/
mv -f /mnt/${tcrppart}/tcrp-modules/ /dev/shm/
echo "Go directly to the menu. Press any key to continue..."
read answer
else
while true; do
if check_internet; then
getlatestmshell "noask"
break
fi
sleep 5
echo "Waiting for internet connection in menu.sh..."
done
gitdownload
fi
if [ -z "${1-}" ]; then
[ -f /tmp/test_mode ] && rm /tmp/test_mode
else
touch /tmp/test_mode
fi
/home/tc/menu_m.sh
exit 0