diff --git a/archinstall/archinstall-dev.sh b/archinstall/archinstall-dev.sh index 56477c5..ed8a2b5 100755 --- a/archinstall/archinstall-dev.sh +++ b/archinstall/archinstall-dev.sh @@ -35,19 +35,21 @@ mostrardialog "Error" "$(T "An error has ocurred, setup will be stopped") $razon mostrardialog "Log" "$(T "You have a install log in") /tmp/install.log" exit } + function isanetworkerror { if [[ $? != 0 ]];then fatalerror "$(T "Network connection error, please check it")" fi } + function pacmanerror { if [[ $? != 0 ]];then fatalerror "$(T "Pacman error, problems in repositories, apologizes. You have to try later...")" fi } - -function execl { ##This function logs and execute commands +##This function logs and execute commands +function execl { local command echo "------" >> "/tmp/install.log" if [[ $1 != "chroot" && $1 != "chuser" ]];then #If it runs normally @@ -81,7 +83,7 @@ echo "Error: Code $?" >> "/tmp/install.log" fi } - +##Function for show to the user if an option is on or off function optstate { if [[ $1 =~ "$2" ]];then echo "on" @@ -90,7 +92,7 @@ else fi } - +##Function to select by the user the partitions for the system install function particiones { clear mostrardialog "$(T "Questions about partitions where system will be installed")" "$(T "Questions about partitions dialog. Text")" @@ -258,6 +260,7 @@ if [[ ! $optpa -eq 3 ]];then 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) + ##This count the ammount of swap to create dependent of computer RAM if [[ $ram -le 7500 ]];then swaptype=1 swapamount=$(expr $ram / 3) @@ -305,12 +308,14 @@ fi #fin del if de pedir los datos si no esta en automatico } -### Install and configure all of the system ### +### Install and configure all of the system, this function is NOT interactive, it works alone ### function installconf { clear tput setaf 2 ; echo "$(T "Installing system, this can take about 20 minutes, wait")" ; tput setaf 9 sleep 2 tput setaf 2 ; echo "$(T "Formatting and mounting partitions")" ; tput setaf 9 + +# Format and mount partitions execl $formatoraiz /dev/$particionraiz e2label /dev/$particionraiz "JKArch" execl mount /dev/$particionraiz /mnt/ @@ -324,14 +329,15 @@ if [[ $partefi ]];then execl mount /dev/$partefi /mnt/boot/efi/ fi -## Download or install base system. +# Download or install base system. if [[ $isoffline = "0" ]];then wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/pacman.conf -O pacman.conf isanetworkerror #Comprueba si hubo un error de descarga tput setaf 2 ; echo "$(T "Optimizing download")" ; tput setaf 9 execl reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist tput setaf 2 ; echo "$(T "Downloading")" ; tput setaf 9 - execl pacstrap -C pacman.conf /mnt/ base btrfs-progs jkarch-mirrorlist + # Reflector and rsync is for updating mirrorlist # + execl pacstrap -C pacman.conf /mnt/ base btrfs-progs jkarch-mirrorlist reflector rsync pacmanerror mv pacman.conf /mnt/etc/pacman.conf fi @@ -341,9 +347,9 @@ if [[ $isoffline = "1" ]];then mv pacman-offline.conf /mnt/etc/pacman.conf #Move pacman.conf (offline) to pacman chroot location fi -#Create fstab +# Create fstab execl genfstab -U /mnt > /mnt/etc/fstab -#Create or activate swap if neccesary +# Create or activate swap if neccesary if [[ $swaptype ]];then case $swaptype in 1) @@ -356,7 +362,7 @@ if [[ $swaptype ]];then esac fi -# Create bind mountpoints for the rest of the install +# Create bind mountpoints for the rest of the install (Chroot) if [[ $isoffline = 0 ]];then cp -r /etc/netctl/* /mnt/etc/netctl/ cp -f /etc/resolv.conf /mnt/etc/resolv.conf @@ -365,25 +371,32 @@ mount --bind /sys /mnt/sys mount --bind /proc /mnt/proc mount --bind /dev /mnt/dev mount --bind /run /mnt/run + +# CD bind if is offline if [[ $isoffline = 1 ]];then - mount --bind /run/archiso/bootmnt/ /mnt/run/archiso/bootmnt/ # CD bind + mount --bind /run/archiso/bootmnt/ /mnt/run/archiso/bootmnt/ fi # -#Do allpackages var contain base packages -$pak="jka-toolkit git wget netctl iw wpa_supplicant reflector dialog sudo alsa-utils dosfstools ntfs-3g bash-completion" +# Var allpackages have in this moment all the packages selected by user, and will be the install packages list for pacman # +# Do allpackages var contain base packages +$pak="jka-toolkit git wget netctl iw wpa_supplicant dialog sudo alsa-utils dosfstools ntfs-3g bash-completion" allpackages=$allpackages" "$pak -#For sync +# For sync $pak="ntpd" allpackages=$allpackages" "$pak ##GUI and apps selected in "entorno{}" -#Here, allpackages have the user selected packages because selected before. -execl chroot pacman -Syu $allpackages --noconfirm --needed #Install packages , reflector is for updating mirrorlist +# Before install, configure mirrorlist if its online +if [[ $isoffline = 0 ]];then +execl chroot reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist +fi +# Here, allpackages have the user selected packages because selected before. Then, install it +execl chroot pacman -Syu $allpackages --noconfirm --needed -#language +# Language sed -i "s/\#$langinst/$langinst/g" /mnt/etc/locale.gen echo "LANG=$opclang" > /mnt/etc/locale.conf echo "LANGUAGE=$opclang" >> /mnt/etc/locale.conf @@ -392,7 +405,7 @@ echo "KEYMAP=$langabr" > /mnt/etc/vconsole.conf execl chroot locale-gen clear -#timezone +# Timezone test -n "$NEW_TIMEZONE" && cp -fp /mnt/usr/share/zoneinfo/"$NEW_TIMEZONE" /mnt/etc/localtime execl chroot hwclock --systohc --utc execl chroot systemctl enable ntpd @@ -405,14 +418,14 @@ echo "Clock will not be okay until restart and configure manually because you do fi -#users +# User skel move if [[ $isoffline = 1 ]];then # Is an offline installation? tar xJf mods/skel.tar.xz -C /mnt/ else #online wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/skel.tar.xz -O- | tar xJf - -C /mnt/ fi -#Themes skel before creating user and remove some progs +# Themes skel before creating user and remove some progs if [[ $optentorno = 1 ]];then #LXDE if [[ $isoffline = 1 ]];then # Is an offline installation? tar xJf mods/LXDE.tar.xz -C /mnt/ @@ -438,40 +451,43 @@ fi fi -#user +# Create user execl chroot useradd -m -G wheel -s /bin/bash $nameuser echo "${nameuser}:${passuser}" | execl chroot chpasswd -#root +# Root password echo "root:${passroot}" | execl chroot chpasswd -#For some strange login bugs +# Fix for some strange login bugs echo "Cambio de permisos por si se quedaron mal en algún momento" execl chroot chmod 755 / execl chroot chmod 755 /bin -#Añadir soporte sudo para este nuevo usuario (por ser del grupo wheel) +# Add sudo support for wheel users like user added sed -i "s/\# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" /mnt/etc/sudoers -#Directorios para usuarios +# User directory (Photos, Desktop..) create execl chroot xdg-user-dirs-update -#Habilitamos ciertos servicios +# Turn on some services execl chroot systemctl enable lightdm execl chroot systemctl enable NetworkManager +execl chroot systemctl enable dhcpcd -#Configure wine if neccesary +# Configure wine if neccesary if [[ $inswine = 1 ]];then echo "$(T "Configuring wine for better experience") (32 bit winearch)" execl chuser WINEARCH=win32 wineboot -u fi -# Set X11 keyboard +# Set X11 keyboard, and user GKSU, if there is any enviroment installed if [[ $optentorno != 7 ]];then keyboardlayout + # Modify gksu for ask user password and not root one + execl chuser gconftool-2 --set /apps/gksu/sudo-mode --type=bool true --owner=$(echo $nameuser) fi -#Install and configure bootloader GRUB/rEFInd +# Install and configure bootloader GRUB/rEFInd if [[ -z $partefi ]];then #If it dont have EFI case $optboot in 1) @@ -507,24 +523,23 @@ else #With EFI esac fi -#Hostname +# Hostname echo "JKArch" > /mnt/etc/hostname -#Linux +# Linux kernel execl chroot mkinitcpio -p linux #Hacemos el mkinitcpio después de tener instalados los gráficos -#Tweaks -echo "$(T "Last tweaks and cleaning")" -execl chroot systemctl enable dhcpcd +# Clean pacman +echo "$(T "Cleaning")" execl chroot pacman -Sc --noconfirm } -### Date and language ### +## Date and language function horaidioma { while [[ $opclang == "" ]];do varx="" #Empty var @@ -556,10 +571,10 @@ esac done } - +##Function for make user select their user function userpass { clear -#Aqui hay que añadir los comandos para crear un usuario, aunque esto correrá dentro del chroot y no aqui + nameuser=`dialog --stdout --inputbox "Nombre para tu usuario principal:" 10 50` until [[ $pass1 = $pass2 && $pass1 != "" ]] @@ -592,6 +607,7 @@ case $opt in esac } +##User graphics select function graficos { optgrafica=`dialog --stdout --nocancel --scrollbar --menu "$(T "What is your graphics card brand?")" 0 0 6 1 "Nvidia" 2 "AMD/ATI" 3 "Intel" 4 "VIA" 5 "Estoy usando VirtualBox" 6 "Estoy usando VMWare" 7 "No se la marca/Otra (Se instalaran todos los drivers graficos estandar)"` @@ -611,9 +627,10 @@ pak="xf86-video-vesa mesa-libgl" allpackages=$allpackages" "$pak } +##Interactive function for make user select programs function programasguiuser { clear -#Seleccion de programas predeterminados +# Default selected apps opt1="1 6" opt2="1 5" opt3="1" @@ -739,7 +756,7 @@ fi } -### Install desktop enviroment and their style in some cases ### +##Function to select environment function entorno { clear optentorno=`dialog --stdout --nocancel --menu "$(T "Select your desktop enviroment")" 0 0 5 1 "LXDE (Muy ligero)" 2 "XFCE (Ligero)" 3 "Cinnamon (Facil para antiguos usuarios de Windows)" 4 "Gnome (Complejo, pero practico)" 5 "MATE (Tradicional)" 6 "Plasma/KDE (Pesado aunque bonito) " 7 "No instalar entorno de escritorio"` @@ -867,14 +884,10 @@ umount /mnt/boot/efi/ umount /mnt/* umount /mnt/ -# Start questions -#Partitions +# Start questions, functions for timezone, enviroment, programs... + particiones - -#Configure hour/timezone horaidioma - -#Configuraciones varias, en entorno se instala el entorno entorno #Programas de usuario si hay entorno escogido @@ -886,11 +899,9 @@ hastosetxkb=1 #Aqui va la personalizacion de programas, ya que son graficos. programasguiuser -#Modificar gksu para preguntar por contraseña del usuario -execl chuser gconftool-2 --set /apps/gksu/sudo-mode --type=bool true --owner=$(echo $nameuser) fi -#Se crea el usuario despues del entorno pero antes de instalar más (para una correcta configuración) y se añaden los ficheros de configuracion de skel +# Ask for user and password for the new system userpass #GRUB/rEFInd select @@ -972,15 +983,15 @@ do done tput setaf 9 -#Instalación +# Real install pause installconf -#End, other configs +#End install, other user configs (If it wants it) otrasconfig -#Unmount and tweak pacman if necessary +# Unmount and tweak pacman if necessary (If offline) if [[ $isoffline = 1 ]];then # Is an offline installation? echo "Configurando pacman para usar servidores web en los siguientes arranques..." mv pacman.conf /mnt/etc/pacman.conf #Put online pacman.conf @@ -989,7 +1000,7 @@ fi echo "Sincronizando datos al disco duro, puede tardar unos segundos" sync -#Unmounting partitions +# Unmounting partitions umount /mnt/* umount /mnt # @@ -997,4 +1008,5 @@ umount /mnt clear mostrardialog "$(T "End")" "$(T "Setup finished, press enter to reboot.")" mv /tmp/install.log /mnt/home/$nameuser/install.log +# Reboot, finished reboot