-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.sh
367 lines (337 loc) · 15.7 KB
/
Test.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
#!/bin/bash
#--------------------------------------
# ┬ ┬┌─┐┬─┐┬┌─┐┌─┐┌ ┌─┐┌─┐
# └┐┌┘├─┤├┬┘│├─┤├─┤│ ├─ └─┐
# └┘ ┴ ┴┴└─┴┴ ┴└─┘└─┘└─┘┴─┘
#--------------------------------------
CNE=$(tput setaf 0) # Negro
CRE=$(tput setaf 1) # Rojo
CGR=$(tput setaf 2) # Verde
CYE=$(tput setaf 3) # Amarillo
CBL=$(tput setaf 4) # Azul
CMA=$(tput setaf 5) # Morado
CCY=$(tput setaf 6) # Cyan
CWH=$(tput setaf 7) # Blanco
CNC=$(tput sgr0) # Reset
CHROOT="arch-chroot /mnt"
intro () {
printf "
%s
███▄ ▄███▓ ▄▄▄ ▓█████▄ ▓█████ ▄▄▄▄ ▓██ ██▓ -------------------------------------------------
▓██▒▀█▀ ██▒▒████▄ ▒██▀ ██▌▓█ ▀ ▓█████▄▒██ ██▒ - LurchingDart
▓██ ▓██░▒██ ▀█▄ ░██ █▌▒███ ▒██▒ ▄██▒██ ██░ - https://github.com/LurchingDart/Arch-Install
▒██ ▒██ ░██▄▄▄▄██ ░▓█▄ ▌▒▓█ ▄ ▒██░█▀ ░ ▐██▓░ -
▒██▒ ░██▒ ▓█ ▓██▒░▒████▓ ░▒████▒ ░▓█ ▀█▓░ ██▒▓░ - Inspired by
░ ▒░ ░ ░ ▒▒ ▓▒█░ ▒▒▓ ▒ ░░ ▒░ ░ ░▒▓███▀▒ ██▒▒▒ - gh0stzk
░ ░ ░ ▒ ▒▒ ░ ░ ▒ ▒ ░ ░ ░ ▒░▒ ░▓██ ░▒░ - https://github.com/gh0stzk/arch-install
░ ░ ░ ▒ ░ ░ ░ ░ ░ ░▒ ▒ ░░ -
░ ░ ░ ░ ░ ░ ░ ░ ░ - This script is developed for personal use
░ ░░ ░ - and is not intended to be used by others.
░ - This was made for my specific hardware
██▓ █ ██ ██▀███ ▄████▄ ██░ ██ ██▓ ███▄ █ ▄████ ▓█████▄ ▄▄▄ ██▀███ ▄▄▄█████▓ - and is not guaranteed to work on yours.
▓██▒ ██ ▓██▒▓██ ▒ ██▒▒██▀ ▀█ ▓██░ ██▒▓██▒ ██ ▀█ █ ██▒ ▀█▒▒██▀ ██▌▒████▄ ▓██ ▒ ██▒▓ ██▒ ▓▒ - Use at your own risk.
▒██░ ▓██ ▒██░▓██ ░▄█ ▒▒▓█ ▄ ▒██▀▀██░▒██▒▓██ ▀█ ██▒▒██░▄▄▄░░██ █▌▒██ ▀█▄ ▓██ ░▄█ ▒▒ ▓██░ ▒░ -
▒██░ ▓▓█ ░██░▒██▀▀█▄ ▒▓▓▄ ▄██▒░▓█ ░██ ░██░▓██▒ ▐▌██▒░▓█ ██▓░▓█▄ ▌░██▄▄▄▄██ ▒██▀▀█▄ ░ ▓██▓ ░ - My hardware is:
░██████▒▒▒█████▓ ░██▓ ▒██▒▒ ▓███▀ ░░▓█▒░██▓░██░▒██░ ▓██░░▒▓███▀▒░▒████▓ ▓█ ▓██▒░██▓ ▒██▒ ▒██▒ ░ - CPU: Intel i7-12700H
░ ▒░▓ ░░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░░ ░▒ ▒ ░ ▒ ░░▒░▒░▓ ░ ▒░ ▒ ▒ ░▒ ▒ ▒▒▓ ▒ ▒▒ ▓▒█░░ ▒▓ ░▒▓░ ▒ ░░ - GPU: Nvidia RTX 3070ti Mobile
░ ░ ▒ ░░░▒░ ░ ░ ░▒ ░ ▒░ ░ ▒ ▒ ░▒░ ░ ▒ ░░ ░░ ░ ▒░ ░ ░ ░ ▒ ▒ ▒ ▒▒ ░ ░▒ ░ ▒░ ░ - RAM: 16GB DDR4 3200MHz
░ ░ ░░░ ░ ░ ░░ ░ ░ ░ ░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ - SSD: 500GB NVMe M.2
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ - BOOT: UEFI
░ ░ -------------------------------------------------
%s
" "$CMA" "$CNC"
sleep 5
}
titleLogo () {
local text="${1:?}"
printf "
%s
▄▄▄ ██▀███ ▄████▄ ██░ ██
▒████▄ ▓██ ▒ ██▒▒██▀ ▀█ ▓██░ ██▒
▒██ ▀█▄ ▓██ ░▄█ ▒▒▓█ ▄ ▒██▀▀██░
░██▄▄▄▄██ ▒██▀▀█▄ ▒▓▓▄ ▄██▒░▓█ ░██
▓█ ▓██▒░██▓ ▒██▒▒ ▓███▀ ░░▓█▒░██▓
▒▒ ▓▒█░░ ▒▓ ░▒▓░░ ░▒ ▒ ░ ▒ ░░▒░▒
▒ ▒▒ ░ ░▒ ░ ▒░ ░ ▒ ▒ ░▒░ ░
░ ▒ ░░ ░ ░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░
░
██▓ ███▄ █ ██████ ▄▄▄█████▓ ▄▄▄ ██▓ ██▓ ▓█████ ██▀███
▓██▒ ██ ▀█ █ ▒██ ▒ ▓ ██▒ ▓▒▒████▄ ▓██▒ ▓██▒ ▓█ ▀ ▓██ ▒ ██▒
▒██▒▓██ ▀█ ██▒░ ▓██▄ ▒ ▓██░ ▒░▒██ ▀█▄ ▒██░ ▒██░ ▒███ ▓██ ░▄█ ▒
░██░▓██▒ ▐▌██▒ ▒ ██▒░ ▓██▓ ░ ░██▄▄▄▄██ ▒██░ ▒██░ ▒▓█ ▄ ▒██▀▀█▄
░██░▒██░ ▓██░▒██████▒▒ ▒██▒ ░ ▓█ ▓██▒░██████▒░██████▒░▒████▒░██▓ ▒██▒
░▓ ░ ▒░ ▒ ▒ ▒ ▒▓▒ ▒ ░ ▒ ░░ ▒▒ ▓▒█░░ ▒░▓ ░░ ▒░▓ ░░░ ▒░ ░░ ▒▓ ░▒▓░
▒ ░░ ░░ ░ ▒░░ ░▒ ░ ░ ░ ▒ ▒▒ ░░ ░ ▒ ░░ ░ ▒ ░ ░ ░ ░ ░▒ ░ ▒░
▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
%s
" "$CRE" "$CNC"
printf ' \033[0;31m[ \033[34m%s\033[0m \033[0;31m]\033[0m\n\n' "${text}"
sleep 2
}
title () {
local text="${1:?}"
printf " ${CYE}[ ${CMA}%s${CNC} ${CYE}]${CNC}\n\n" "${text}"
sleep 2
}
text () {
local text="${1:?}"
local text2="${2:""}"
printf " ${CBL}%s${CNC} ${CWH}%s${CNC}\n" "${text}" "${text2}"
}
errorsText () {
local text="${1:?}"
printf " ${CRE}%s${CNC}\n\n" "${text}"
sleep 1
}
errorsTitle () {
local text="${1:?}"
printf " ${CYE}[ ${CRE}%s${CNC} ${CYE}]${CNC}\n\n" "${text}"
sleep 1
}
successText () {
local text="${1:?}"
printf " ${CGR}%s${CNC}\n\n" "${text}"
sleep 1
}
successTitle () {
local text="${1:?}"
printf " ${CYE}[ ${CGR}%s${CNC} ${CYE}]${CNC}\n\n" "${text}"
sleep 1
}
warningText () {
local text="${1:?}"
printf " ${CYE}%s${CNC}\n\n" "${text}"
sleep 1
}
warningTitle () {
local text="${1:?}"
printf " ${CRE}[ ${CYE}%s${CNC} ${CRE}]${CNC}\n\n" "${text}"
sleep 1
}
questionsText() {
local text="${1:?}"
local response="${2:?}"
local use_raw="${3:-false}"
local password="${4:-false}"
printf " ${CCY}%s${CNC}" "${text}"
if [[ "$use_raw" == true && "$password" == true ]]; then
read -rs "$response"
elif [[ "$use_raw" == true ]]; then
read -r "$response"
else
read "$response"
fi
printf "\n"
}
questionsTitle () {
local text="${1:?}"
local response="${2:?}"
printf " ${CYE}[ ${CCY}%s${CNC} ${CYE}]${CNC}\n" "${text}"
if [ "$use_raw" = true ]; then
read -r "$response"
elif [ "$password" = true ]; then
read -rs "$response"
else
read "$response"
fi
}
loadingAnimation() {
local -r ancho_campo=10
local -r ancho_asterisco=1
local -r ancho_espacio=$((ancho_campo - ancho_asterisco))
local -r patron_asterisco="* * *"
local -r patron_espacio=$(printf "%${ancho_espacio}s")
local -r patron="$patron_espacio${patron_asterisco}$patron_espacio"
local -r longitud_patron=${#patron}
local -i posicion=0
local direccion=1
local animando=true
while [ $animando == true ]; do
printf "\033[0;34m\r[\033[0m\033[1;93m%s\033[0m \033[0;34m]\033[0m" "${patron:posicion:ancho_campo}"
posicion+=direccion
if [ $posicion -lt 0 ]; then
direccion=1
elif [ $posicion -ge $((longitud_patron - ancho_campo)) ]; then
direccion=-1
fi
sleep 0.1
done
}
loadingAnimationStop () {
animando=false
kill $PID
printf "\r\033[2K"
}
# Imprimir listas de opciones
# # Funciones para imprimir texto con estilo
# CNE=$(tput setaf 0) # Negro
# CRE=$(tput setaf 1) # Rojo
# CGR=$(tput setaf 2) # Verde
# CYE=$(tput setaf 3) # Amarillo
# CBL=$(tput setaf 4) # Azul
# CMA=$(tput setaf 5) # Morado
# CCY=$(tput setaf 6) # Cyan
# CWH=$(tput setaf 7) # Blanco
# CNC=$(tput sgr0) # Reset
# CHROOT="arch-chroot /mnt"
# text () {
# local text="${1:?}"
# local text2="${2:""}"
# printf " ${CBL}%s${CNC} ${CWH}%s${CNC}\n" "${text}" "${text2}"
# }
# questionsText() {
# local text="${1:?}"
# local response="${2:?}"
# local use_raw="${3:-false}"
# local password="${4:-false}"
# printf " ${CCY}%s${CNC}" "${text}"
# if [[ "$use_raw" == true && "$password" == true ]]; then
# read -rs "$response"
# elif [[ "$use_raw" == true ]]; then
# read -r "$response"
# else
# read "$response"
# fi
# printf "\n"
# }
# questionsTitle () {
# local text="${1:?}"
# local response="${2:?}"
# printf " ${CYE}[ ${CCY}%s${CNC} ${CYE}]${CNC}\n" "${text}"
# if [ "$use_raw" = true ]; then
# read -r "$response"
# elif [ "$password" = true ]; then
# read -rs "$response"
# else
# read "$response"
# fi
# }
# audio_options=("1. PulseAudio" "2. ALSA" "3. Jack" "4. PipeWire")
# for f in "${audio_options[@]}"; do
# text "$f"
# done
# # Preguntar al usuario qué opción desea seleccionar
# questionsText "Ingrese el número de opción deseado (1-4, predeterminado es 4): " audio_option
# if [[ -z "$audio_option" ]]; then
# audio_option=4
# fi
# while [[ ! "$audio_option" =~ ^[1-4]$ ]]; do
# questionsText "Opción inválida. Ingrese el número de opción deseado (1-4, predeterminado es 4): " audio_option
# done
# # Configurar las variables de audio según la opción seleccionada
# if [[ "$audio_option" == "1" ]]; then
# audiotitle='PulseAudio'
# audiopack='pipewire-pulse'
# elif [[ "$audio_option" == "2" ]]; then
# audiotitle='ALSA'
# audiopack='pipewire-alsa'
# elif [[ "$audio_option" == "3" ]]; then
# audiotitle='Jack'
# audiopack='pipewire-jack'
# else
# audiotitle='PipeWire'
# audiopack='pipewire pipewire-pulse pipewire-alsa pipewire-jack'
# fi
# echo "Opción de audio seleccionada: $audiotitle"
# echo "Paquetes de audio seleccionados: $audiopack"
# Test de particiones
title "You are using a virtual machine"
text "So i will partition the disk for you"
# loadingAnimation &
sleep 1
DISK_SIZE=$(lsblk -b | grep disk | awk '{print $4}' END {print total})
parted -s /dev/sda mklabel msdos
# if [ $? -eq 0];then
# echo "Partition table created correctly"
# else
# echo "Error creating partition table"
# fi
parted -s /dev/sda mkpart primary fat32 1MiB 513MiB
# if [ $? -eq 0];then
# echo "Partition created correctly"
# else
# echo "Error creating partition"
# fi
parted -s /dev/sda set 1 boot on
# if [ $? -eq 0];then
# echo "Partition set correctly"
# else
# echo "Error setting partition"
# fi
parted -s /dev/sda mkpart primary ext4 513MiB $(($DISK_SIZE-4*1024*1024*1024))B
# if [ $? -eq 0];then
# echo "Root partition created correctly"
# else
# echo "Error creating root partition"
# fi
parted -s /dev/sda mkpart primary linux-swap $(($DISK_SIZE-4*1024*1024*1024+512*1024*1024+1))B 100%
# if [ $? -eq 0];then
# echo "Swap partition created correctly"
# else
# echo "Error creating swap partition"
# fi
sleep 10
# PID=$!
# loadingAnimationStop
# clear
# titleLogo "Time to format the partitions"
# title "Formatting the partitions"
# loadingAnimation &
# sleep 1
# mkfs.fat -F32 /dev/sda1 > /dev/null 2>&1
# if [ $? -eq 0];then
# echo "Partition formatted correctly"
# else
# echo "Error formatting partition"
# fi
# mkfs.ext4 /dev/sda2 > /dev/null 2>&1
# if [ $? -eq 0];then
# echo "Root partition formatted correctly"
# else
# echo "Error formatting root partition"
# fi
# mkswap /dev/sda3 > /dev/null 2>&1
# if [ $? -eq 0];then
# echo "Swap partition formatted correctly"
# else
# echo "Error formatting swap partition"
# fi
# sleep 1
# PID=$!
# loadingAnimationStop
# clear
# titleLogo "Time to mount the partitions"
# title "Mounting the partitions"
# loadingAnimation &
# sleep 1
# mount /dev/sda2 /mnt > /dev/null 2>&1
# if [ $? -eq 0];then
# echo "Root partition mounted correctly"
# else
# echo "Error mounting root partition"
# fi
# mkdir /mnt/boot > /dev/null 2>&1
# if [ $? -eq 0];then
# echo "Boot directory created correctly"
# else
# echo "Error creating boot directory"
# fi
# mount /dev/sda1 /mnt/boot > /dev/null 2>&1
# if [ $? -eq 0];then
# echo "Boot partition mounted correctly"
# else
# echo "Error mounting boot partition"
# fi
# swapon /dev/sda3 > /dev/null 2>&1
# if [ $? -eq 0];then
# echo "Swap partition mounted correctly"
# else
# echo "Error mounting swap partition"
# fi
# sleep 1
# PID=$!
# loadingAnimationStop
echo "Particiones creadas correctamente"
echo "O no? :v"