This repository has been archived by the owner on Apr 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathkosmos.sh
executable file
·231 lines (196 loc) · 6.78 KB
/
kosmos.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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#!/bin/bash
#
# Kosmos
# Copyright (C) 2019 Nichole Mattera
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
func_result=""
# Prompts for GitHub Username and Password
# Returns:
# The username and password on ${func_result}.
prompt_login () {
echo "It is recommended that you login to GitHub to use this tool. However you"
echo "can continue without logging in, but you may run into rate limits. If you"
echo "use two-factor authentication then you will need to generate a personal"
echo "access token and use it as your password. https://github.com/settings/tokens"
echo ""
read -p "Username: (Leave blank to continue without logging in) " username
if [ ! -z "${username}" ]
then
read -sp "Password or personal access token:" password
func_result="${username}:${password}"
else
func_result=""
fi
}
# =============================================================================
# Main Script
# =============================================================================
if [ $# -le 0 ]
then
echo "Usage: ./kosmos.sh [output_directory]"
exit 1
fi
authenticated=0
username_password=""
while [ $authenticated -ne 1 ]; do
prompt_login
username_password=${func_result}
if [ ! -z "${username_password}" ]
then
authenticated=$(./common.sh test_login "${username_password}")
else
authenticated=1
fi
echo ""
done
# Get version number
version_number=$(head -1 version.txt)
# Build temp directory
temp_directory="/tmp/$(uuidgen)"
mkdir -p "${temp_directory}"
# Start building!
if [ "${auto}" != "1" ]
then
echo "Downloading Atmosphere..."
fi
atmosphere_version=$(./modules.sh download_atmosphere "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading hekate..."
fi
hekate_version=$(./modules.sh download_hekate "${temp_directory}" "${version_number}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading appstore..."
fi
appstore_version=$(./modules.sh download_appstore "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading EdiZon..."
fi
edizon_version=$(./modules.sh download_edizon "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading emuiibo..."
fi
emuiibo_version=$(./modules.sh download_emuiibo "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading Goldleaf..."
fi
goldleaf_version=$(./modules.sh download_goldleaf "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading Kosmos Toolbox..."
fi
kosmos_toolbox_version=$(./modules.sh download_kosmos_toolbox "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading Kosmos Updater..."
fi
kosmos_updater_version=$(./modules.sh download_kosmos_updater "${temp_directory}" "${version_number}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading ldn-mitm..."
fi
ldn_mitm_version=$(./modules.sh download_ldn_mitm "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading Lockpick..."
fi
lockpick_version=$(./modules.sh download_lockpick "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading Lockpick_RCM..."
fi
lockpick_rcm_version=$(./modules.sh download_lockpick_rcm "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading sys-clk..."
fi
sys_clk_version=$(./modules.sh download_sys_clk "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading sys_con..."
fi
sys_con_version=$(./modules.sh download_sys_con "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading sys-ftpd-light..."
fi
sys_ftpd_light_version=$(./modules.sh download_sys_ftpd_light "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading nxdumptool..."
fi
nxdumptool_version=$(./modules.sh download_nxdumptool "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading nx-ovlloader..."
fi
nx_ovlloader_version=$(./modules.sh download_nx_ovlloader "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading ovlSysmodules..."
fi
ovl_sysmodules_version=$(./modules.sh download_ovl_sysmodules "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading Status Monitor Overlay..."
fi
status_monitor_overlay_version=$(./modules.sh download_status_monitor_overlay "${temp_directory}" "${username_password}")
if [ "${auto}" != "1" ]
then
echo "Downloading Tesla Menu..."
fi
tesla_menu_version=$(./modules.sh download_tesla_menu "${temp_directory}" "${username_password}")
# Delete the bundle if it already exists.
dest=$(realpath -s ${1})
rm -f "${dest}/Kosmos-${version_number}.zip"
current_directory=${PWD}
# Bundle Full Package
cd "${temp_directory}"
zip -q -r "${dest}/Kosmos-${version_number}.zip" .
# Bundle Upgrade Package
# cd "${current_directory}"
# ./modules.sh remove_configs "${temp_directory}"
# cd "${temp_directory}"
# zip -q -r "${dest}/UpgradeKosmos-${version_number}.zip" .
# Clean up.
cd "${current_directory}"
rm -rf "${temp_directory}"
# Output some useful information.
echo "Kosmos ${version_number} built with:"
echo " Atmosphere - ${atmosphere_version}"
echo " Hekate - ${hekate_version}"
echo " EdiZon - ${edizon_version}"
echo " Emuiibo - ${emuiibo_version}"
echo " Goldleaf - ${goldleaf_version}"
echo " Homebrew App Store - ${appstore_version}"
echo " Kosmos Toolbox - ${kosmos_toolbox_version}"
echo " Kosmos Updater - ${kosmos_updater_version}"
echo " ldn_mitm - ${ldn_mitm_version}"
echo " Lockpick - ${lockpick_version}"
echo " Lockpick RCM - ${lockpick_rcm_version}"
echo " sys-clk - ${sys_clk_version}"
echo " sys-con - ${sys_con_version}"
echo " sys-ftpd-light - ${sys_ftpd_light_version}"
echo " NXDumpTool - ${nxdumptool_version}"
echo " nx-ovlloader - ${nx_ovlloader_version}"
echo " ovlSysmodules - ${ovl_sysmodules_version}"
echo " Status Monitor Overlay - ${status_monitor_overlay_version}"
echo " Tesla Menu - ${tesla_menu_version}"