forked from wilssonmartee/instalarch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.isoinstallerv1-6-beta
executable file
·1149 lines (911 loc) · 36 KB
/
.isoinstallerv1-6-beta
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# Instalarch 1.4
# Fork Revenge_Installer
#
source ./trans
lang="en"
man_partition() {
#
title="$(__ Particionado manual) - $titlep"
> .devices1.txt
lsblk -lno NAME,TYPE,SIZE | grep 'disk' | awk '{print "/dev/" $1 " " $3}' | sort -u > .devices1.txt
devices1=` awk '{print "FALSE " $0}' .devices1.txt `
#
dev=$(zenity --list --ok-label="$(__ Siguiente)" --cancel-label="$(__ Atras)" --radiolist --height=300 --width=650 --title="$title" --text "$(__ Seleccione el disco que desea utilizar para la instalacion)." --column $(__ Seleccione) --column="$(__ Discos) " --column $(__ Tamaño) $devices1 )
if [ "$?" = "1" ]
then partition
fi
if [ "$dev" = "" ]
then man_partition
fi
# Partitioning
# using gparted
zenity --question --height=150 --width=650 --ok-label="$(__ Deseo particionar)" --cancel-label="$(__ Ya he particionado)" --title="$title" --text "$(__ Necesita particionar y/o formatear el disco) $dev?\n \n$(__ De ser asi seleccione [Deseo particionar] y realice todos los cambios pertinentes).\n$(__ El instalador no realizara ningun cambio ni formateara las particiones despues de esto)."
if [ "$?" = "0" ]
then
gparted $dev &
sleep 5
if [ "$SYSTEM" = "UEFI" ]
then
(sleep 3 && wmctrl -F -a "$title" -b add,above) &
(zenity --list --title="$title" --ok-label="$(__ He terminado)" --cancel-label="$(__ Atras)" --text="$(__ Sugerencia de particionado) [UEFI]: *$(__ Formato de disco) GPT\n$(__ Una vez termine el proceso pulse [He terminado] para continuar la instalacion). \n*$(__ no ciere esta ventana).\n*$(__ formatee las particiones de ser necesario).\n*$(__ el instalador no formateara las particiones despues de esto)." --column "$(__ Particion) " --column "$(__ Nombre) " --column "$(__ Sistema de archivos)" --column "$(__ Tamaño)" --width=450 --height=250 "${dev}X" "ROOT" "ext4" "16GiB+" "${dev}Y" "EFI" "fat32" "256-512MiB") ;
else
(sleep 3 && wmctrl -F -a "$title" -b add,above) &
(zenity --list --title="$title" --ok-label="$(__ He terminado)" --cancel-label="$(__ Atras)" --text="$(__ Sugerencia de particionado) [BIOS]: *$(__ Formato de disco) MBR\n$(__ Una vez termine el proceso pulse [He terminado] para continuar la instalacion). \n*$(__ no ciere esta ventana)" --column "$(__ Particion) " --column "$(__ Nombre) " --column "$(__ Sistema de archivos)" --column "$(__ Tamaño)" --width=450 --height=250 "${dev}Y" "ROOT" "ext4" "16GiB+") ;
fi
if [ "$?" = "0" ]; then
pkill gparted
else
pkill gparted
man_partition
fi
fi
root_part
}
root_part() {
greplist="Disk"
# Select root partition
root_part=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=500 --width=650 --title="$title" --text="Seleccione la particion para ROOT\nAdvertencia! la lista muestra todas las particiones disponibles.\nPor favor elige con cuidado." --column 'Seleccione' --column "Particiones " --column 'Tamaño ' --column 'Tipo' $(fdisk -l $dev -o Device,Size,Type | grep dev | grep -v $greplist | awk '{print $1 " " $2 " " $3}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
#mounting root partition
if [ "$?" = "1" ]
then man_partition
fi
if [[ "$root_part" != *[!\ ]* ]] || [ "$root_part" = "(null)" ]
then root_part
else
greplist=$greplist"\|"$root_part
fi
swap_partition
}
swap_partition() {
# Swap partition?
zenity --question --height=100 --width=350 --ok-label="Si" --cancel-label="No" --title="$title" --text " \n Desea utilizar una particion swap? "
if [ "$?" = "0" ]
then
swap_part=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=500 --width=650 --title="$title" --text="Seleccione la particion SWAP\nAdvertencia! la lista muestra todas las particiones disponibles.\nPor favor elige con cuidado." --column 'Seleccione' --column "Particiones " --column 'Tamaño ' --column 'Tipo' $(fdisk -l $dev -o Device,Size,Type | grep dev | grep -v $greplist | awk '{print $1 " " $2 " " $3}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
if [ "$?" = "1" ]
then swap_partition
fi
if [[ "$swap_part" != *[!\ ]* ]] || [ "$swap_part" = "(null)" ]
then swap_partition
else
greplist=$greplist"\|"$swap_part
fi
else
zenity --question --height=100 --width=350 --ok-label="Si" --cancel-label="No" --title="$title" --text " \nDesea crear un archivo swap? "
if [ "$?" = "0" ]
then swapfile="yes"
fi
fi
boot_partition
}
boot_partition() {
# Boot Partition?
if [ "$SYSTEM" = "UEFI" ]
then
zenity --question --height=100 --width=550 --ok-label="Si" --cancel-label="No" --title="$title" --text "Desea compartir la particion ROOT con BOOT? (recomendado). \nSi la espuesta es [ SI ] la particion EFI sera destinada exclusivamente para el gestor de arranque, de lo contrario sera compartida con boot"
bootloc="$?"
boot_part=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=500 --width=650 --title="$title" --text="Seleccione la particion EFI\nAdvertencia! la lista muestra todas las particiones disponibles.\nPor favor elige con cuidado." --column 'Seleccione' --column "Particiones " --column 'Tamaño ' --column 'Tipo' $(fdisk -l $dev -o Device,Size,Type | grep dev | grep -v $greplist | awk '{print $1 " " $2 " " $3}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
if [ "$?" = "1" ]
then boot_partition
fi
if [[ "$boot_part" != *[!\ ]* ]] || [ "$boot_part" = "(null)" ]
then boot_partition
else
greplist=$greplist"\|"$boot_part
fi
fi
home_partition
}
home_partition() {
# Home Partition?
zenity --question --height=100 --width=350 --ok-label="Si" --cancel-label="No" --title="$title" --text " \n Desea utilizar una particion separada para /home? "
if [ "$?" = "0" ]
then
home_part=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=500 --width=650 --title="$title" --text="Seleccione la particion para HOME\nAdvertencia! la lista muestra todas las particiones disponibles.\nPor favor elige con cuidado." --column 'Seleccione' --column "Particiones " --column 'Tamaño ' --column 'Tipo' $(fdisk -l $dev -o Device,Size,Type | grep dev | grep -v $greplist | awk '{print $1 " " $2 " " $3}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
# mounting home partition
if [ "$?" = "1" ]
then home_partition
fi
if [[ "$home_part" != *[!\ ]* ]] || [ "$home_part" = "(null)" ]
then home_partition
fi
fi
configure
}
auto_partition() {
title="Particionado automatico - $titlep"
#
> .devices1.txt
lsblk -lno NAME,TYPE,SIZE | grep 'disk' | awk '{print "/dev/" $1 " " $3}' | sort -u > .devices1.txt
devices1=` awk '{print "FALSE " $0}' .devices1.txt `
#
dev=$(zenity --list --ok-label="Siguiente" --cancel-label="Atras" --radiolist --height=300 --width=650 --title="$title" --text "Seleccione el disco que desea utilizar para la instalacion." --column Seleccione --column="Disco " --column Tamaño $devices1 )
if [ "$?" = "1" ]
then partition
fi
if [ "$dev" = "" ]
then auto_partition
fi
zenity --question --height=120 --ok-label="Siguiente" --cancel-label="Atras" --width=650 --title="$title" --text " \nAdvertencia! Esto borrará todos los datos en $dev\. $dev1 Esta seguro que desea continuar?"
yn="$?"
> .root_part.txt
touch .root_part.txt
if [ "$SYSTEM" = "BIOS" ]
then echo ${dev}"1" >> .root_part.txt
else echo ${dev}"2" >> .root_part.txt
fi
if [ "$yn" = "1" ]
then partition
fi
# Find total amount of RAM
ram=$(grep MemTotal /proc/meminfo | awk '{print $2/1024}' | sed 's/\..*//')
# Find where swap partition stops
num=4000
if [ "$ram" -gt "$num" ]
then swap_space=4096
else swap_space=$ram
fi
uefi_swap=$(($swap_space + 513))
#BIOS or UEFI
if [ "$SYSTEM" = "BIOS" ]
then
(
echo "# Formateando disco [BIOS]..."
echo "25"
dd if=/dev/zero of=$dev bs=512 count=1
echo "# Creando particiones [BIOS]..."
echo "40"
Parted "mklabel msdos"
Parted "mkpart primary ext4 1MiB 100%"
Parted "set 1 boot on"
mkfs.ext4 -F ${dev}1
echo "# Montando particiones [BIOS]..."
echo "60"
mount ${dev}1 /mnt
echo "# Creando archivo swap [BIOS]..."
echo "80"
touch /mnt/swapfile
dd if=/dev/zero of=/mnt/swapfile bs=1M count=${swap_space}
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
echo "99"
swapfile="yes"
) | zenity --progress --percentage=0 --title="$title" --width=450 --no-cancel --auto-close
else
(
echo "# Formateando disco [UEFI]..."
echo "25"
dd if=/dev/zero of=$dev bs=512 count=1
echo "# Creando particiones [UEFI]..."
echo "40"
Parted "mklabel gpt"
Parted "mkpart primary fat32 1MiB 513MiB"
Parted "mkpart primary ext4 513MiB 100%"
Parted "set 1 boot on"
mkfs.fat -F32 ${dev}1
mkfs.ext4 -F ${dev}2
echo "# Montando particiones [UEFI]..."
echo "60"
mount ${dev}2 /mnt
mkdir -p /mnt/boot
mount ${dev}1 /mnt/boot
esp="/boot"
echo "# Creando archivo swap [UEFI]..."
echo "80"
touch /mnt/swapfile
dd if=/dev/zero of=/mnt/swapfile bs=1M count=${swap_space}
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
echo "# Creando archivo swap [UEFI]..."
echo "99"
swapfile="yes"
) | zenity --progress --percentage=0 --title="$title" --width=450 --no-cancel --auto-close
fi
configure
}
partition() {
title="Particionado - $titlep"
ans=$(zenity --list --radiolist --height=220 --width=650 --ok-label="Siguiente" --cancel-label="Salir" --title="$title" --text "¿Desea utilizar el particionamiento automático o desea particionar el disco usted mismo?\nEl Particionamiento automático borrará completamente el disco que seleccione e instalará Arch." --column Seleccione --column Opcion TRUE "Particionado Automatico" FALSE "Particionado Manual")
if [ "$ans" = "" ]
then start
fi
if [ "$ans" = "Particionado Automatico" ]
then auto_partition
else
man_partition
fi
}
configure() {
title="Configuraciones - $titlep"
# Getting Locale
locales
}
locales() {
locales=$(cat /etc/locale.gen | grep -v "# " | sed 's/#//g' | sed 's/ UTF-8//g' | grep .UTF-8 | sort | awk '{ printf "FALSE ""\0"$0"\0" }')
locale=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=500 --width=650 --title="$title" --text "Seleccione su idioma.\nPor defecto es Ingles Americano 'en_US.UTF-8'." --column Seleccion --column Idioma TRUE en_US.UTF-8 $locales)
if [ "$?" = "1" ]
then partition
fi
keymap
}
keymap() {
keymap=$(zenity --list --radiolist --height=500 --ok-label="Siguiente" --cancel-label="Atras" --width=650 --ok-label="Siguiente" --cancel-label="Atras" --title="$title" --text="Seleccione su keymap (mapa del teclado)" --column Seleccion --column Keymap TRUE us FALSE es FALSE latam $(localectl list-x11-keymap-layouts | awk '{ printf " FALSE ""\0"$0"" }'))
if [ "$?" = "1" ]
then locales
fi
if [ "$keymap" = "" ]
then keymap
fi
clock
}
timezone() {
zones=$(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sed "s/\/.*//g" | sort -ud | sort | awk '{ printf " FALSE ""\0"$0"\0" }')
zone=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=500 --width=650 --title="$title" --text "Seleccione la zona de su pais." --column Seleccion --column Zona $zones)
if [ "$?" = "1" ]
then keymap
fi
if [ "$zone" = "" ]
then timezone
fi
subzones
}
subzones() {
subzones=$(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "$zone/" | sed "s/$zone\///g" | sort -ud | sort | awk '{ printf " FALSE ""\0"$0"\0" }')
subzone=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=500 --width=650 --title="$title" --text "Seleccione su sub-zona." --column Seleccion --column Sub-Zona $subzones)
if [ "$?" = "1" ]
then timezone
fi
if [ "$subzone" = "" ]
then subzones
fi
clock
}
clock() {
# Getting Clock Preference
clock=$(zenity --list --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=220 --width=650 --title="$title" --text "Desea utilizar UTC o Local Time\nUTC es recomenado si no tienes dual boot con Windows." --column Seleccion --column Tiempo TRUE utc FALSE localtime)
if [ "$?" = "1" ]
then keymap
fi
hostnamez
}
# Getting hostname, username, root password, and user password
hostnamez() {
title="Configuraciones - $titlep"
hname=$(zenity --entry --title="$title" --width=450 --ok-label="Siguiente" --cancel-label="Atras" --text "Por favor introduzca el hostname para su equipo.\nTodas las letras deben ser minusculas." --entry-text "instalarch")
if [ "$?" = "1" ]
then clock
fi
if [ "$hname" = "" ]
then hostnamez
fi
usernamez
}
usernamez(){
title="Configurando usuarios - $titlep"
username=$(zenity --entry --title="$title" --width=450 --ok-label="Siguiente" --cancel-label="Atras" --text "Por favor introduzca el nombre de usuario para el nuevo usuario.\nTodo en letras minusculas." --entry-text "miusuario")
if [ "$?" = "1" ]
then hostnamez
fi
if [ "$username" = "" ]
then usernamez
fi
root_password
}
root_password() {
rtpasswd=$(zenity --entry --title="$title" --width=450 --ok-label="Siguiente" --cancel-label="Atras" --text "Introduzca la contraseña para root." --hide-text)
if [ "$?" = "1" ]
then usernamez
fi
if [ "$rtpasswd" = "" ]
then
zenity --error --height=100 --width=350 --title="$title" --text "No puede dejar este campo vacio."
root_password
fi
rtpasswd2=$(zenity --entry --title="$title" --width=450 --ok-label="Siguiente" --cancel-label="Atras" --text "Vuelva a introducir la contraseña de root" --hide-text)
if [ "$?" = "1" ]
then root_password
fi
if [ "$rtpasswd" != "$rtpasswd2" ]
then zenity --error --height=100 --width=350 --title="$title" --text "Las contraseñas no coinciden, vuelva a intentarlo."
root_password
fi
user_password
}
user_password() {
title="Configurando usuarios - $titlep"
userpasswd=$(zenity --entry --title="$title" --width=450 --ok-label="Siguiente" --cancel-label="Atras" --text "Introduzca la contraseña para $username." --hide-text)
if [ "$?" = "1" ]
then root_password
fi
if [ "$userpasswd" = "" ]
then
zenity --error --height=100 --width=350 --title="$title" --text "No puede dejar este campo vacio."
user_password
fi
userpasswd2=$(zenity --entry --title="$title" --width=450 --ok-label="Siguiente" --cancel-label="Atras" --text "Vuelva a introducir la contraseña para $username." --hide-text)
if [ "$?" = "1" ]
then user_password
fi
if [ "$userpasswd" != "$userpasswd2" ]
then zenity --error --height=100 --width=450 --title="$title" --text "Las contraseñas no coinciden, vuelva a intentarlo."
user_password
fi
kernel
}
##
kernel() {
title="Seleccion de kernel - $titlep"
kernel=$(zenity --list --ok-label="Siguiente" --cancel-label="Atras" --radiolist --height=520 --width=650 --title="$title" --text "Hay varios nucleos(kernel) disponibles:\n \n*El mas comun es el kernel linux.\nEste kernel es el más actualizado y proporciona el mejor soporte de hardware. Sin embargo, \npodría haber posibles errores en este núcleo, a pesar de las pruebas.\n \n*El kernel linux-lts esta enfocado mas en la estabilidad.\nSe basa en un núcleo antiguo, por lo que puede carecer de algunas características más nuevas.\n \n*El kernel linux-hardened esta enfocado en la seguridad\nContiene el parche de Grsecurity Patchset y PaX para una maxima seguridad.\n \n*El kernel linux-zen es el resultado de la colaboracion de hackers\npara proveer el mejor kernel posible para uso diario.\n" --column "Seleccion" --column "Kernel" TRUE linux FALSE linux-lts FALSE linux-hardened FALSE linux-zen)
if [ "$?" = "1" ]
then user_password
fi
videocont
}
##
videocont() {
title="Controlador de video - $titlep"
videocontroller=$(zenity --list --title="$title" --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=300 --width=650 --text "Seleccione su tarjeta grafica:" --column "Seleccion" --column "Controlador" --column "Descripcion" TRUE "xf86-video-vesa" "Controlador generico" FALSE "xf86-video-ati" "Controlador AMD ATI / Radeon - opensource" FALSE "xf86-video-amdgpu" "Controlador AMD Radeon (ultimos modelos) - opensource" FALSE "xf86-video-intel" "Graficas Intel - opensource" FALSE "xf86-video-nouveau" "Graficas nvidia - opensource" FALSE "nvidia" "Graficas envidia - propietario")
if [ "$?" = "1" ]
then kernel
fi
desktop
}
desktop() {
# Choosing Desktop
title="Seleccion de escritorio - $titlep"
desktops=$(zenity --list --height=300 --width=650 --ok-label="Siguiente" --cancel-label="Atras" --title="$title" --radiolist --text "Cual gestor de ventanas (WM) desea instalar?" --column Seleccion --column Paquete --column Descripcion TRUE "awesome" "Awesome WM + Pack Customizado" FALSE "xmonad" "Xmonad + Xmobar (Navy Blue)" FALSE "i3-gaps" "i3-gaps + Polybar (multicolor)" FALSE "qtile" "Proximamente" FALSE "Ninguno" "Solo instalar Xorg" )
if [ "$?" = "1" ]
then videocont
fi
if [ "$desktops" = "qtile" ]
then
desktops="Ninguno"
fi
displaymanager
}
displaymanager() {
title="Gestor de pantalla - $titlep"
dm=$(zenity --list --title="$title" --radiolist --ok-label="Siguiente" --cancel-label="Atras" --height=300 --width=650 --text "Cual gestor de pantalla desea instalar?" --column "Seleccion" --column "Display Manager" TRUE "ly" FALSE "sddm" FALSE "lxdm" FALSE "lightdm" FALSE "gdm" FALSE "Ninguno")
if [ "$?" = "1" ]
then desktop
fi
packagemanager
}
multilib() {
## Disabled
title="Repositorios - $titlep"
zenity --question --height=100 --width=550 --ok-label="Si" --cancel-label="No" --title="$title" --text="Desea habilitar los repositorios multilib? Puedes necesitar esto para Steam, Wine, o cualquier otro software 32-bit."
multilib="$?"
packagemanager
}
packagemanager() {
title="Seleccion de paquetes - $titlep"
zenity --question --title="$title" --ok-label="Si" --cancel-label="No" --height=100 --width=550 --text="¿Desea instalar un administrador de paquetes gráfico?\nEsto le permitirá instalar y eliminar aplicaciones sin tener que lidiar con la línea de comando."
pm="$?"
if [ "$pm" = "0" ]
then
pack=$(zenity --list --radiolist --title="$title" --ok-label="Siguiente" --cancel-label="Atras" --height=220 --width=650 --text="Que administrador de paquetes desea instalar?" --column Seleccion --column "Adm de paquetes" --column "Descripcion" FALSE "octopi" "Plasma o libreria qt" FALSE "pamac-aur" "Gnome o libreria gtk")
if [ "$?" = "1" ]
then displaymanager
fi
if [ "$pack" = "" ]
then packagemanager
fi
fi
archuserrepo
}
archuserrepo() {
title="Seleccion de paquetes - $titlep"
zenity --question --height=100 --width=550 --ok-label="Si" --cancel-label="No" --title="$title" --text "Desea instalar yay (AUR Herlper)? Podras instalar paquetes del repositorio de usuarios."
abs="$?"
bootloader
}
# bootloader?
bootloader() {
title="Bootloader - $titlep"
grub=$(zenity --question --height=100 --width=550 --ok-label="Si" --cancel-label="No" --title="$title" --text "Desea instalar un cargador de arranque?\nLa respuesta usualmente es [ SI ], a menos que tenga otro arrancador que desee conservar")
grb="$?"
if [ "$grb" = "0" ]
then
> .devices1.txt
lsblk -lno NAME,TYPE,SIZE | grep 'disk' | awk '{print "/dev/" $1 " " $3}' | sort -u > .devices1.txt
devices1=` awk '{print "FALSE " $0}' .devices1.txt `
#
devices1=$(echo $devices1 | sed "s#FALSE $dev#TRUE $dev#g")
grub_device=$(zenity --list --radiolist --height=300 --ok-label="Siguiente" --cancel-label="Atras" --width=650 --title="$title" --text "Seleccione el disco para instalar el cargador de arranque.($dev)" --column Seleccion --column "Disco " --column Tamaño $devices1)
probe="$?"
if [ "$?" = "1" ]
then bootloader
fi
if [ "$grub_device" = "" ]
then bootloader
fi
fi
installing
}
# Installation
installing() {
title="Instalacion - $titlep"
zenity --question --height=150 --width=550 --ok-label="Continuar" --cancel-label="Abortar" --title="$title" --text "El proceso de instalacion esta por iniciar, todos los paquetes seran descargados desde internet, asi que asegurese de contar con una conexion constante a internet.\nEste proceso puede demorar."
if [ "$?" = "1" ]
then exit
else
title="Instalando - $titlep"
echo "0" >> percent
yadconfig="--progress --center --no-buttons --auto-close --width=700 --height=400 --log-expanded --log-on-top --log-height=380 --no-cancel"
i=0
{
#start partitions
if [ "$ans" = "Particionado Manual" ]
then
#montando home
if [ "$root_part" != "" ]
then
echo "# Montando particion root..."
touch .root_part.txt
echo $root_part >> .root_part.txt
if [ "$SYSTEM" = "BIOS" ]
then
root_number=$(echo $root_part | sed "s#$dev##g")
Parted "set $root_number boot on"
fi
##mkfs.ext4 -F $root_part
mount $root_part /mnt
fi
#montando particion swap
if [ "$swap_part" != "" ]
then
echo "# Montando particion swap..."
swap_number=$(echo $swap_part | sed "s#$dev##g")
Parted "set $swap_number swap on"
mkswap $swap_part
swapon $swap_part
fi
#creando archivoswap
if [ "$swapfile" = "yes" ]
then
echo "# Creando archivo swap (esto puede demorarse)..."
ram=$(grep MemTotal /proc/meminfo | awk '{print $2/1024}' | sed 's/\..*//')
# Find where swap partition stops
num=4000
if [ "$ram" -gt "$num" ]
then swap_space=4096
else swap_space=$ram
fi
uefi_swap=$(($swap_space + 513))
touch /mnt/swapfile
dd if=/dev/zero of=/mnt/swapfile bs=1M count=${swap_space}
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
fi
# Montando boot
if [ "$boot_part" != "" ]
then
echo "# Montando particion EFI..."
boot_number=$(echo $boot_part | sed "s#$dev##g")
Parted "set $boot_number boot on"
#mkfs.fat -F32 $boot_part
if [ "$bootloc" = "1" ]
then
mkdir -p /mnt/boot
mount $boot_part /mnt/boot
esp="/boot"
else
mkdir -p /mnt/efi
mount $boot_part /mnt/efi
esp="/efi"
fi
fi
#Montando home
if [ "$home_part" != "" ]
then
echo "# Montando particion home..."
greplist=$greplist"\|"$home_part
mkdir -p /mnt/home
mount $home_part /mnt/home
fi
fi
#End partitions
echo "# Buscando los servidores mas rapidos..."
reflector -l 10 --sort rate --save /etc/pacman.d/mirrorlist
# updating pacman cache
echo "5" >> percent
echo "# Sincronizando base de datos..."
pacman -Syy
echo "# Actualizando claves..."
pacman -S archlinux-keyring --noconfirm
echo "10" >> percent
#installing base
echo "# Instalando Base (esto puede demorar)..."
basedownloaded=""
while [ "$basedownloaded" == "" ] ; do
pacstrap /mnt base base-devel nano dhcpcd netctl iwd net-tools
if [ -f "/mnt/bin/bash" ] ; then
basedownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
echo "# Instalando kernel (esto puede demorar)..."
echo "25" >> percent
kerneldownloaded=""
while [ "$kerneldownloaded" == "" ] ; do
pacstrap /mnt linux-firmware mkinitcpio linux-headers $kernel
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q linux-firmware "/mnt/pkglist.txt"; then
kerneldownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
echo "40" >> percent
echo "# Generando tabla de particiones..."
genfstab -p /mnt >> /mnt/etc/fstab
if grep -q "/mnt/swapfile" "/mnt/etc/fstab"; then
sed -i '/swapfile/d' /mnt/etc/fstab
echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
fi
echo "43" >> percent
echo "# Instalando complementos..."
complementsdownloaded=""
while [ "$complementsdownloaded" == "" ] ; do
pacstrap /mnt networkmanager ifplugd xf86-input-synaptics gtk2 gtk3 wget xdg-user-dirs acpi pulseaudio pulseaudio-alsa alsa-utils fzf ntfs-3g htop lsb-release neofetch unzip gvfs reflector
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q fzf "/mnt/pkglist.txt"; then
complementsdownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
echo "53" >> percent
echo "# Instalando servidor grafico..."
xorgdownloaded=""
while [ "$xorgdownloaded" == "" ] ; do
pacstrap /mnt xorg xorg-apps xorg-xinit xorg-twm xorg-xclock $videocontroller
echo "59" >> percent
arch_chroot "pacman -Rns xorg-docs --noconfirm"
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q xorg-xinit "/mnt/pkglist.txt"; then
xorgdownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
echo "63" >> percent
echo "68" >> percent
##
##
echo "# Habilitando servicios..."
# enabling network manager
arch_chroot "systemctl enable dhcpcd"
arch_chroot "systemctl enable NetworkManager"
echo "69" >> percent
echo "# Actualizando pacman.conf..."
# adding repo
echo -e "\n[instalarch]" >> /mnt/etc/pacman.conf;echo -e "SigLevel = Optional TrustAll" >> /mnt/etc/pacman.conf;echo -e "Server = https://github.com/wilssonmartee/instalarch/releases/download/1/\nServer = https://downloads.sourceforge.net/project/instalarch/x86_64\n" >> /mnt/etc/pacman.conf
echo "# Sincronizando base de datos..."
arch_chroot "pacman -Syy"
echo "70" >> percent
# installing pamac-aur - octopi
if [ "$pm" = "0" ]
then
echo "# Instalando gestor de paquetes grafico..."
gpgdownloaded=""
while [ "$gpgdownloaded" == "" ] ; do
arch_chroot "pacman -Sy --noconfirm $pack"
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q $pack "/mnt/pkglist.txt"; then
gpgdownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
fi
echo "74" >> percent
# AUR
if [ "$abs" = "0" ]
then
echo "# Instalando AUR Herlper..."
yaydownloaded=""
while [ "$yaydownloaded" == "" ] ; do
arch_chroot "pacman -Sy yay --noconfirm"
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q yay "/mnt/pkglist.txt"; then
yaydownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
fi
echo "78" >> percent
echo "# Instalando ucode y gotop..."
# installing ucode
proc=$(grep -m1 vendor_id /proc/cpuinfo | awk '{print $3}')
if [ "$proc" = "GenuineIntel" ]
then
arch_chroot "pacman -Sy --noconfirm intel-ucode gotop-git"
elif [ "$proc" = "AuthenticAMD" ]
then
arch_chroot "pacman -Sy --noconfirm amd-ucode gotop-git"
fi
echo "83" >> percent
if [ "$grb" = "0" ]
then
echo "# Instalando os-prober..."
osdownloaded=""
while [ "$osdownloaded" == "" ] ; do
pacstrap /mnt os-prober
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q os-prober "/mnt/pkglist.txt"; then
osdownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
echo "86" >> percent
if [ "$SYSTEM" = 'BIOS' ]
then echo "# Instalando Bootloader (BIOS)..."
grubdownloaded=""
while [ "$grubdownloaded" == "" ] ; do
pacstrap /mnt grub
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q grub "/mnt/pkglist.txt"; then
grubdownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
arch_chroot "grub-install --target=i386-pc $grub_device"
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg"
else
echo "# Instalando Bootloader (UEFI)..."
if [ "$ans" = "Particionado Automatico" ]
then root_part=${dev}2
esp="/boot"
fi
#instalando grub
grubdownloaded=""
while [ "$grubdownloaded" == "" ] ; do
pacstrap /mnt grub efibootmgr
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q grub "/mnt/pkglist.txt"; then
grubdownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
arch_chroot "grub-install --target=x86_64-efi --efi-directory=$esp --bootloader-id=Instalarch"
arch_chroot "grub-install --target=x86_64-efi --efi-directory=$esp --removable"
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg"
fi
fi
echo "91" >> percent
#root password
echo "# Configurando usuario root..."
touch .passwd
echo -e "$rtpasswd\n$rtpasswd2" > .passwd
arch_chroot "passwd root" < .passwd >/dev/null
rm .passwd
#adding user
echo "# Configurando nuevo usuario $username..."
arch_chroot "useradd -m -g users -G adm,lp,wheel,power,audio,video,input,games,mail,scanner,storage,disk -s /bin/bash $username"
touch .passwd
echo -e "$userpasswd\n$userpasswd2" > .passwd
arch_chroot "passwd $username" < .passwd >/dev/null
rm .passwd
echo "93" >> percent
#setting locale
echo "# Configurando idioma..."
echo "LANG=\"${locale}\"" > /mnt/etc/locale.conf
echo "${locale} UTF-8" > /mnt/etc/locale.gen
arch_chroot "locale-gen"
arch_chroot "export LANG=${locale}"
export LANG=${locale}
echo "# Configurando mapa del teclado..."
#setting keymap
#echo KEYMAP=$keymap >> /mnt/etc/vconsole.conf
localectl set-x11-keymap $keymap
cp /etc/vconsole.conf /mnt/etc/vconsole.conf
cp /etc/X11/xorg.conf.d/* /mnt/etc/X11/xorg.conf.d/
echo "95" >> percent
#setting timezone
echo "# Configurando zona horaria..."
arch_chroot "rm /etc/localtime"
arch_chroot "ln -s /usr/share/zoneinfo/$(curl https://ipapi.co/timezone) /etc/localtime"
#setting hw clock
echo "# Configurando hora del sistema..."
arch_chroot "hwclock --systohc --$clock"
#setting hostname
echo "# Configurando usuario..."
arch_chroot "echo $hname > /etc/hostname"
# setting n permissions
echo "%wheel ALL=(ALL) ALL" >> /mnt/etc/sudoers
echo "# Instalando shell..."
# selecting shell
shell="zsh"
shelldownloaded=""
while [ "$shelldownloaded" == "" ] ; do
if [ "$shell" = "zsh" ]
then arch_chroot "pacman -S --noconfirm zsh zsh-autosuggestions;chsh -s /usr/bin/zsh $username"
elif [ "$shell" = "bash" ]
then arch_chroot "pacman -S --noconfirm bash;chsh -s /bin/bash $username"
elif [ "$shell" = "fish" ]
then arch_chroot "pacman -S --noconfirm fish;chsh -s /usr/bin/fish $username"
fi
arch_chroot "pacman -Qqe > pkglist.txt"
if grep -q zsh "/mnt/pkglist.txt"; then
shelldownloaded="yes"
else
res=$(zenity --error --height=100 --width=550 --extra-button="Reintentar" --ok-label="Reiniciar" --title="$title" --text "Ha ocurrido un error al descargar los paquetes, verifique su conexion a internet y pulse [Reintentar]. Si el problema persiste reinicie la instalacion")
if [ "$res" != "Reintentar" ]
then
reboot
fi
fi
done
echo "97" >> percent
if [ "$dm" != "Ninguno" ]
then
# desktop manager
echo "# Configurando gestor de pantalla..."
dmdownloaded=""
while [ "$dmdownloaded" == "" ] ; do
if [ "$dm" = "lightdm" ]
then pacstrap /mnt lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings;arch_chroot "systemctl enable lightdm.service"
else pacstrap /mnt $dm;arch_chroot "systemctl enable $dm.service"
fi
arch_chroot "pacman -Qqe > pkglist.txt"