diff --git a/archinstall/archinstall.sh b/archinstall/archinstall.sh index ed3648b..892cac9 100755 --- a/archinstall/archinstall.sh +++ b/archinstall/archinstall.sh @@ -81,6 +81,20 @@ case $optpa in echo -e "o\nn\np\n1\n\n\nw\n" | fdisk /dev/$opt particionraiz=${opt}1 formatoraiz="mkfs.ext4 -F" + ram=$(free -m | grep Mem: | awk '1 {print $2 }') + if [[ $ram -le 7500 ]];then + swaptype=1 + swapamount=$(expr $ram / 3) + if [[ $ram -le 3700 ]];then + swapamount=$(expr $swapamount \* 2) + fi + if [[ $ram -le 1500 ]];then + swapamount=$(expr $swapamount \* 2) + fi + if [[ $ram -le 700 ]];then + swapamount=$(expr $swapamount \* 2) + fi + fi break;; *) mostrardialog "Instalacion detenida" "Se detuvo la instalacion. No se hicieron cambios. Al aceptar, se apagara el ordenador" @@ -156,6 +170,32 @@ if [[ ! $optpa -eq 3 ]];then esac ;; esac + + ram=$(free -m | grep Mem: | awk '1 {print $2 }') + optswap=`dialog --stdout --nocancel --menu "¿Quieres crear un archivo swap (Memoria virtual)?" 0 0 4 1 "Si (Con valores por defecto, recomendado)" 2 "Si (Valores a mano)" 3 "Si, pero con una particion que ya cree" 4 "No"` + case $optswap in + 1) + if [[ $ram -le 7500 ]];then + swaptype=1 + swapamount=$(expr $ram / 3) + if [[ $ram -le 3700 ]];then + swapamount=$(expr $swapamount \* 2) + fi + if [[ $ram -le 1500 ]];then + swapamount=$(expr $swapamount \* 2) + fi + if [[ $ram -le 700 ]];then + swapamount=$(expr $swapamount \* 2) + fi + else + #No es que sea necesario, pero como ha pulsado en si, se crea un archivo minimo" + swaptype=1 + swapamount="512" + fi + ;; + 2) swapamount=`dialog --stdout --inputbox "Memoria RAM: $(echo $ram) . Introduzca cuanta memoria para swap desea en MB" 0 50`;; + 3) mostrardialog "Swap" "JKArch detecta automaticamente las particiones swap bien creadas, no debe hacer nada mas";; + esac clear @@ -201,6 +241,21 @@ if [[ $partefi ]];then mkdir -p /mnt/boot/efi mount /dev/$partefi /mnt/boot/efi/ fi +#Create fstab +genfstab -U /mnt >> /mnt/etc/fstab +#Create or activate swap +if [[ $swaptype ]];then + case $swaptype in + 1) + echo "Creando archivo swap, espere" + dd if=/dev/zero of=/swapfile bs=1M count=$swapamount + chmod 600 /swapfile + mkswap /swapfile + echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab + ;; + esac +fi + wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/pacman.conf -O /tmp/pacman.conf if [[ $? != 0 ]];then fatalerror "$(T "Network connection error, please check it")" @@ -215,7 +270,6 @@ if [[ $? != 0 ]];then fatalerror "$(T "Network connection error, please check it")" fi chmod +x /mnt/root/inst/chrootinstall.sh -genfstab -U /mnt >> /mnt/etc/fstab cp -r /etc/netctl/* /mnt/etc/netctl/ mv /tmp/pacman.conf /mnt/etc/pacman.conf cp /root/translations.sh /mnt/root/inst/translations.sh