1
0
mirror of https://gitlab.com/JKANetwork/JKArch.git synced 2026-02-15 17:51:33 +01:00

Dev version beta

This commit is contained in:
JKANetwork
2016-12-26 12:59:09 +01:00
parent 3a67efe603
commit bdcada8b84

View File

@@ -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" mostrardialog "Log" "$(T "You have a install log in") /tmp/install.log"
exit exit
} }
function isanetworkerror { function isanetworkerror {
if [[ $? != 0 ]];then if [[ $? != 0 ]];then
fatalerror "$(T "Network connection error, please check it")" fatalerror "$(T "Network connection error, please check it")"
fi fi
} }
function pacmanerror { function pacmanerror {
if [[ $? != 0 ]];then if [[ $? != 0 ]];then
fatalerror "$(T "Pacman error, problems in repositories, apologizes. You have to try later...")" fatalerror "$(T "Pacman error, problems in repositories, apologizes. You have to try later...")"
fi fi
} }
##This function logs and execute commands
function execl { ##This function logs and execute commands function execl {
local command local command
echo "------" >> "/tmp/install.log" echo "------" >> "/tmp/install.log"
if [[ $1 != "chroot" && $1 != "chuser" ]];then #If it runs normally if [[ $1 != "chroot" && $1 != "chuser" ]];then #If it runs normally
@@ -81,7 +83,7 @@ echo "Error: Code $?" >> "/tmp/install.log"
fi fi
} }
##Function for show to the user if an option is on or off
function optstate { function optstate {
if [[ $1 =~ "$2" ]];then if [[ $1 =~ "$2" ]];then
echo "on" echo "on"
@@ -90,7 +92,7 @@ else
fi fi
} }
##Function to select by the user the partitions for the system install
function particiones { function particiones {
clear clear
mostrardialog "$(T "Questions about partitions where system will be installed")" "$(T "Questions about partitions dialog. Text")" 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"` 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 case $optswap in
1) 1)
##This count the ammount of swap to create dependent of computer RAM
if [[ $ram -le 7500 ]];then if [[ $ram -le 7500 ]];then
swaptype=1 swaptype=1
swapamount=$(expr $ram / 3) swapamount=$(expr $ram / 3)
@@ -305,12 +308,14 @@ fi
#fin del if de pedir los datos si no esta en automatico #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 { function installconf {
clear clear
tput setaf 2 ; echo "$(T "Installing system, this can take about 20 minutes, wait")" ; tput setaf 9 tput setaf 2 ; echo "$(T "Installing system, this can take about 20 minutes, wait")" ; tput setaf 9
sleep 2 sleep 2
tput setaf 2 ; echo "$(T "Formatting and mounting partitions")" ; tput setaf 9 tput setaf 2 ; echo "$(T "Formatting and mounting partitions")" ; tput setaf 9
# Format and mount partitions
execl $formatoraiz /dev/$particionraiz execl $formatoraiz /dev/$particionraiz
e2label /dev/$particionraiz "JKArch" e2label /dev/$particionraiz "JKArch"
execl mount /dev/$particionraiz /mnt/ execl mount /dev/$particionraiz /mnt/
@@ -324,14 +329,15 @@ if [[ $partefi ]];then
execl mount /dev/$partefi /mnt/boot/efi/ execl mount /dev/$partefi /mnt/boot/efi/
fi fi
## Download or install base system. # Download or install base system.
if [[ $isoffline = "0" ]];then if [[ $isoffline = "0" ]];then
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/pacman.conf -O pacman.conf wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/pacman.conf -O pacman.conf
isanetworkerror #Comprueba si hubo un error de descarga isanetworkerror #Comprueba si hubo un error de descarga
tput setaf 2 ; echo "$(T "Optimizing download")" ; tput setaf 9 tput setaf 2 ; echo "$(T "Optimizing download")" ; tput setaf 9
execl reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist execl reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist
tput setaf 2 ; echo "$(T "Downloading")" ; tput setaf 9 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 pacmanerror
mv pacman.conf /mnt/etc/pacman.conf mv pacman.conf /mnt/etc/pacman.conf
fi fi
@@ -356,7 +362,7 @@ if [[ $swaptype ]];then
esac esac
fi fi
# Create bind mountpoints for the rest of the install # Create bind mountpoints for the rest of the install (Chroot)
if [[ $isoffline = 0 ]];then if [[ $isoffline = 0 ]];then
cp -r /etc/netctl/* /mnt/etc/netctl/ cp -r /etc/netctl/* /mnt/etc/netctl/
cp -f /etc/resolv.conf /mnt/etc/resolv.conf cp -f /etc/resolv.conf /mnt/etc/resolv.conf
@@ -365,13 +371,16 @@ mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev mount --bind /dev /mnt/dev
mount --bind /run /mnt/run mount --bind /run /mnt/run
# CD bind if is offline
if [[ $isoffline = 1 ]];then 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 fi
# #
# 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 # 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" $pak="jka-toolkit git wget netctl iw wpa_supplicant dialog sudo alsa-utils dosfstools ntfs-3g bash-completion"
allpackages=$allpackages" "$pak allpackages=$allpackages" "$pak
# For sync # For sync
$pak="ntpd" $pak="ntpd"
@@ -379,11 +388,15 @@ allpackages=$allpackages" "$pak
##GUI and apps selected in "entorno{}" ##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 sed -i "s/\#$langinst/$langinst/g" /mnt/etc/locale.gen
echo "LANG=$opclang" > /mnt/etc/locale.conf echo "LANG=$opclang" > /mnt/etc/locale.conf
echo "LANGUAGE=$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 execl chroot locale-gen
clear clear
#timezone # Timezone
test -n "$NEW_TIMEZONE" && cp -fp /mnt/usr/share/zoneinfo/"$NEW_TIMEZONE" /mnt/etc/localtime test -n "$NEW_TIMEZONE" && cp -fp /mnt/usr/share/zoneinfo/"$NEW_TIMEZONE" /mnt/etc/localtime
execl chroot hwclock --systohc --utc execl chroot hwclock --systohc --utc
execl chroot systemctl enable ntpd execl chroot systemctl enable ntpd
@@ -405,7 +418,7 @@ echo "Clock will not be okay until restart and configure manually because you do
fi fi
#users # User skel move
if [[ $isoffline = 1 ]];then # Is an offline installation? if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/skel.tar.xz -C /mnt/ tar xJf mods/skel.tar.xz -C /mnt/
else #online else #online
@@ -438,25 +451,26 @@ fi
fi fi
#user # Create user
execl chroot useradd -m -G wheel -s /bin/bash $nameuser execl chroot useradd -m -G wheel -s /bin/bash $nameuser
echo "${nameuser}:${passuser}" | execl chroot chpasswd echo "${nameuser}:${passuser}" | execl chroot chpasswd
#root # Root password
echo "root:${passroot}" | execl chroot chpasswd 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" echo "Cambio de permisos por si se quedaron mal en algún momento"
execl chroot chmod 755 / execl chroot chmod 755 /
execl chroot chmod 755 /bin 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 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 execl chroot xdg-user-dirs-update
#Habilitamos ciertos servicios # Turn on some services
execl chroot systemctl enable lightdm execl chroot systemctl enable lightdm
execl chroot systemctl enable NetworkManager execl chroot systemctl enable NetworkManager
execl chroot systemctl enable dhcpcd
# Configure wine if neccesary # Configure wine if neccesary
@@ -466,9 +480,11 @@ if [[ $inswine = 1 ]];then
fi fi
# Set X11 keyboard # Set X11 keyboard, and user GKSU, if there is any enviroment installed
if [[ $optentorno != 7 ]];then if [[ $optentorno != 7 ]];then
keyboardlayout 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 fi
# Install and configure bootloader GRUB/rEFInd # Install and configure bootloader GRUB/rEFInd
@@ -510,21 +526,20 @@ fi
# Hostname # Hostname
echo "JKArch" > /mnt/etc/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 execl chroot mkinitcpio -p linux #Hacemos el mkinitcpio después de tener instalados los gráficos
#Tweaks # Clean pacman
echo "$(T "Last tweaks and cleaning")" echo "$(T "Cleaning")"
execl chroot systemctl enable dhcpcd
execl chroot pacman -Sc --noconfirm execl chroot pacman -Sc --noconfirm
} }
### Date and language ### ## Date and language
function horaidioma { function horaidioma {
while [[ $opclang == "" ]];do while [[ $opclang == "" ]];do
varx="" #Empty var varx="" #Empty var
@@ -556,10 +571,10 @@ esac
done done
} }
##Function for make user select their user
function userpass { function userpass {
clear 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` nameuser=`dialog --stdout --inputbox "Nombre para tu usuario principal:" 10 50`
until [[ $pass1 = $pass2 && $pass1 != "" ]] until [[ $pass1 = $pass2 && $pass1 != "" ]]
@@ -592,6 +607,7 @@ case $opt in
esac esac
} }
##User graphics select
function graficos { 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)"` 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 allpackages=$allpackages" "$pak
} }
##Interactive function for make user select programs
function programasguiuser { function programasguiuser {
clear clear
#Seleccion de programas predeterminados # Default selected apps
opt1="1 6" opt1="1 6"
opt2="1 5" opt2="1 5"
opt3="1" opt3="1"
@@ -739,7 +756,7 @@ fi
} }
### Install desktop enviroment and their style in some cases ### ##Function to select environment
function entorno { function entorno {
clear 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"` 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/*
umount /mnt/ umount /mnt/
# Start questions # Start questions, functions for timezone, enviroment, programs...
#Partitions
particiones particiones
#Configure hour/timezone
horaidioma horaidioma
#Configuraciones varias, en entorno se instala el entorno
entorno entorno
#Programas de usuario si hay entorno escogido #Programas de usuario si hay entorno escogido
@@ -886,11 +899,9 @@ hastosetxkb=1
#Aqui va la personalizacion de programas, ya que son graficos. #Aqui va la personalizacion de programas, ya que son graficos.
programasguiuser 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 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 userpass
#GRUB/rEFInd select #GRUB/rEFInd select
@@ -972,15 +983,15 @@ do
done done
tput setaf 9 tput setaf 9
#Instalación # Real install
pause pause
installconf installconf
#End, other configs #End install, other user configs (If it wants it)
otrasconfig otrasconfig
#Unmount and tweak pacman if necessary # Unmount and tweak pacman if necessary (If offline)
if [[ $isoffline = 1 ]];then # Is an offline installation? if [[ $isoffline = 1 ]];then # Is an offline installation?
echo "Configurando pacman para usar servidores web en los siguientes arranques..." echo "Configurando pacman para usar servidores web en los siguientes arranques..."
mv pacman.conf /mnt/etc/pacman.conf #Put online pacman.conf mv pacman.conf /mnt/etc/pacman.conf #Put online pacman.conf
@@ -997,4 +1008,5 @@ umount /mnt
clear clear
mostrardialog "$(T "End")" "$(T "Setup finished, press enter to reboot.")" mostrardialog "$(T "End")" "$(T "Setup finished, press enter to reboot.")"
mv /tmp/install.log /mnt/home/$nameuser/install.log mv /tmp/install.log /mnt/home/$nameuser/install.log
# Reboot, finished
reboot reboot