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

dev changes

This commit is contained in:
kprkpr
2017-01-04 13:50:53 +01:00
parent 74071ffe7a
commit e581fe1e1c

View File

@@ -17,79 +17,79 @@ if [[ ! -z "$2" ]];then
fi fi
function pause { function pause {
echo "$(T "Press enter to continue...")" echo "$(T "Press enter to continue...")"
read read
} }
function mostrardialog { function mostrardialog {
local titled local titled
local msgd local msgd
titled=$1 titled=$1
msgd=$2 msgd=$2
dialog --title "$titled" --msgbox "$msgd" 15 60 dialog --title "$titled" --msgbox "$msgd" 15 60
} }
function fatalerror { function fatalerror {
razon=$1 razon=$1
mostrardialog "Error" "$(T "An error has ocurred, setup will be stopped") $razon" 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 ##This function logs and execute commands
function execl { 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
command="$1" command="$1"
for (( i=2; i<=$#; i++ )) for (( i=2; i<=$#; i++ ))
do do
command="$command $(echo $* | cut -f$i -d" ")" command="$command $(echo $* | cut -f$i -d" ")"
done done
echo "$command" >> "/tmp/install.log" echo "$command" >> "/tmp/install.log"
$command $command
else #There is a "First word", avoid it else #There is a "First word", avoid it
for (( i=2; i<=$#; i++ )) for (( i=2; i<=$#; i++ ))
do do
command="$command $(echo $* | cut -f$i -d" ")" command="$command $(echo $* | cut -f$i -d" ")"
done done
fi fi
if [[ $1 = "chroot" ]];then #If it runs in chroot if [[ $1 = "chroot" ]];then #If it runs in chroot
echo "(In the install partition/chroot) $command" >> "/tmp/install.log" echo "(In the install partition/chroot) $command" >> "/tmp/install.log"
chroot /mnt /bin/bash -c "$command" chroot /mnt /bin/bash -c "$command"
elif [[ $1 = "chuser" ]];then #If it has to run in chroot but in the user name elif [[ $1 = "chuser" ]];then #If it has to run in chroot but in the user name
echo "(In a 'user' chroot in install partition) $command" >> "/tmp/install.log" echo "(In a 'user' chroot in install partition) $command" >> "/tmp/install.log"
chroot /mnt /bin/bash -c "su $nameuser -c \"$command\" " chroot /mnt /bin/bash -c "su $nameuser -c \"$command\" "
fi fi
#Log result of the command #Log result of the command
if [[ $? == 0 ]];then if [[ $? == 0 ]];then
echo "Result Ok " >> "/tmp/install.log" echo "Result Ok " >> "/tmp/install.log"
else else
echo "Error: Code $?" >> "/tmp/install.log" echo "Error: Code $?" >> "/tmp/install.log"
fi fi
} }
##Function for show to the user if an option is on or off ##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"
else else
echo "off" echo "off"
fi fi
} }
##Function to select by the user the partitions for the system install ##Function to select by the user the partitions for the system install
@@ -193,7 +193,7 @@ if [[ ! $optpa -eq 3 ]];then
varf="dialog --stdout --nocancel --menu \"Selecciona disco duro a utilizar para seleccionar las particiones\" 0 0 5 $varx" varf="dialog --stdout --nocancel --menu \"Selecciona disco duro a utilizar para seleccionar las particiones\" 0 0 5 $varx"
hd=`bash -c "$varf"` hd=`bash -c "$varf"`
#Detectar tipo de tabla de particiones (gpt o msdos) y si es gpt, preparar para UEFI # Detectar tipo de tabla de particiones (gpt o msdos) y si es gpt, preparar para UEFI
tabletype="$(parted /dev/${hd} p | grep "Partition Table" | awk '1 {print $3}')" tabletype="$(parted /dev/${hd} p | grep "Partition Table" | awk '1 {print $3}')"
if [[ $tabletype = "gpt" ]];then if [[ $tabletype = "gpt" ]];then
@@ -225,7 +225,7 @@ if [[ ! $optpa -eq 3 ]];then
opthpart=`dialog --stdout --nocancel --menu "¿Quieres separar la particion /home de /?" 0 0 4 1 "No (Por defecto)" 2 "Si (Tendras que elegir la particion)"` opthpart=`dialog --stdout --nocancel --menu "¿Quieres separar la particion /home de /?" 0 0 4 1 "No (Por defecto)" 2 "Si (Tendras que elegir la particion)"`
case $opthpart in case $opthpart in
2) 2)
#Selección de home # Selección de home
variable=$(lsblk --output KNAME /dev/${hd} | cut -c1-4 | tail -n +3) variable=$(lsblk --output KNAME /dev/${hd} | cut -c1-4 | tail -n +3)
i=3 i=3
varx="" varx=""
@@ -240,14 +240,10 @@ if [[ ! $optpa -eq 3 ]];then
if [[ $particionhome ]];then if [[ $particionhome ]];then
optfh=`dialog --stdout --nocancel --menu "Formato para la particion home (/home)" 0 0 4 1 "EXT4 (Recomendado)" 2 "BTRFS" 3 "XFS" 4 "No formatear (Si ya esta formateada)"` optfh=`dialog --stdout --nocancel --menu "Formato para la particion home (/home)" 0 0 4 1 "EXT4 (Recomendado)" 2 "BTRFS" 3 "XFS" 4 "No formatear (Si ya esta formateada)"`
case $optfh in case $optfh in
1) 1) formatohome="mkfs.ext4 -F";;
formatohome="mkfs.ext4 -F";; 2) formatohome="mkfs.btrfs -f";;
2) 3) formatohome="mkfs.xfs -f";;
formatohome="mkfs.btrfs -f";; 4) formatohome="echo No formatear ";;
3)
formatohome="mkfs.xfs -f";;
4)
formatohome="echo No formatear ";;
esac esac
fi fi
;; ;;
@@ -260,7 +256,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 # 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)
@@ -274,7 +270,7 @@ if [[ ! $optpa -eq 3 ]];then
swapamount=$(expr $swapamount \* 2) swapamount=$(expr $swapamount \* 2)
fi fi
else else
#No es que sea necesario, pero como ha pulsado en si, se crea un archivo minimo" # No es que sea necesario, pero como ha pulsado en si, se crea un archivo minimo"
swaptype=1 swaptype=1
swapamount="512" swapamount="512"
fi fi
@@ -305,34 +301,34 @@ if [[ ! $optpa -eq 3 ]];then
fi fi
fi 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, this function is NOT interactive, it works alone ### ##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 # 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/
if [[ $particionhome ]];then if [[ $particionhome ]];then
execl $formatohome /dev/$particionhome execl $formatohome /dev/$particionhome
mkdir -p /mnt/home/ mkdir -p /mnt/home/
execl mount /dev/$particionhome /mnt/home/ execl mount /dev/$particionhome /mnt/home/
fi fi
if [[ $partefi ]];then if [[ $partefi ]];then
mkdir -p /mnt/boot/efi mkdir -p /mnt/boot/efi
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
@@ -340,17 +336,17 @@ if [[ $isoffline = "0" ]];then
execl pacstrap -C pacman.conf /mnt/ base btrfs-progs jkarch-mirrorlist reflector rsync 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
if [[ $isoffline = "1" ]];then if [[ $isoffline = "1" ]];then
tput setaf 2 ; echo "$(T "Installing packages")..." ; tput setaf 9 tput setaf 2 ; echo "$(T "Installing packages")..." ; tput setaf 9
execl pacstrap -C pacman-offline.conf /mnt/ base btrfs-progs jkarch-mirrorlist execl pacstrap -C pacman-offline.conf /mnt/ base btrfs-progs jkarch-mirrorlist
mv pacman-offline.conf /mnt/etc/pacman.conf #Move pacman.conf (offline) to pacman chroot location mv pacman-offline.conf /mnt/etc/pacman.conf #Move pacman.conf (offline) to pacman chroot location
fi fi
# Create fstab # Create fstab
execl genfstab -U /mnt > /mnt/etc/fstab execl genfstab -U /mnt > /mnt/etc/fstab
# Create or activate swap if neccesary # Create or activate swap if neccesary
if [[ $swaptype ]];then if [[ $swaptype ]];then
case $swaptype in case $swaptype in
1) 1)
echo "$(T "Creating swap file")" echo "$(T "Creating swap file")"
@@ -360,72 +356,71 @@ if [[ $swaptype ]];then
echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
;; ;;
esac esac
fi fi
# Create bind mountpoints for the rest of the install (Chroot) # 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
fi fi
mount --bind /sys /mnt/sys # CD bind if is offline
mount --bind /proc /mnt/proc if [[ $isoffline = 1 ]];then
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/ mount --bind /run/archiso/bootmnt/ /mnt/run/archiso/bootmnt/
fi fi
# mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /run /mnt/run
#
# Var allpackages have in this moment all the packages selected by user, and will be the install packages list for pacman # # 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 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"
allpackages=$allpackages" "$pak allpackages=$allpackages" "$pak
##GUI and apps selected in "entorno{}" # GUI and apps selected in "entorno{}"
# Before install, configure mirrorlist if its online # Before install, configure mirrorlist if its online
if [[ $isoffline = 0 ]];then if [[ $isoffline = 0 ]];then
execl chroot reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist execl chroot reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist
fi fi
# Here, allpackages have the user selected packages because selected before. Then, install it # Here, allpackages have the user selected packages because selected before. Then, install it
execl chroot pacman -Syu $allpackages --noconfirm --needed 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
echo "LC_COLLATE=$opclang" >> /mnt/etc/locale.conf echo "LC_COLLATE=$opclang" >> /mnt/etc/locale.conf
echo "KEYMAP=$langabr" > /mnt/etc/vconsole.conf 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
if [[ $isoffline = 0 ]];then #Only sync if its online if [[ $isoffline = 0 ]];then #Only sync if its online
echo "$(T "Syncing hour to internet")"; echo "$(T "Syncing hour to internet")";
execl chroot ntpd -qg execl chroot ntpd -qg
execl chroot hwclock -w execl chroot hwclock -w
else else
echo "Clock will not be okay until restart and configure manually because you dont have net" echo "Clock will not be okay until restart and configure manually because you dont have net"
fi fi
# User skel move # 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
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/skel.tar.xz -O- | tar xJf - -C /mnt/ wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/skel.tar.xz -O- | tar xJf - -C /mnt/
fi 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 [[ $optentorno = 1 ]];then #LXDE
if [[ $isoffline = 1 ]];then # Is an offline installation? if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/LXDE.tar.xz -C /mnt/ tar xJf mods/LXDE.tar.xz -C /mnt/
@@ -451,44 +446,43 @@ fi
fi fi
# Create 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 password # Root password
echo "root:${passroot}" | execl chroot chpasswd echo "root:${passroot}" | execl chroot chpasswd
# Fix 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 / execl chroot chmod 755 /bin
execl chroot chmod 755 /bin
# Add sudo support for wheel users like user added # 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
# User directory (Photos, Desktop..) create # User directory (Photos, Desktop..) create
execl chroot xdg-user-dirs-update execl chroot xdg-user-dirs-update
# Turn on some services # 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 execl chroot systemctl enable dhcpcd
# Configure wine if neccesary # Configure wine if neccesary
if [[ $inswine = 1 ]];then if [[ $inswine = 1 ]];then
echo "$(T "Configuring wine for better experience") (32 bit winearch)" echo "$(T "Configuring wine for better experience") (32 bit winearch)"
execl chuser WINEARCH=win32 wineboot -u execl chuser WINEARCH=win32 wineboot -u
fi fi
# Set X11 keyboard, and user GKSU, if there is any enviroment installed # 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 # 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) 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
if [[ -z $partefi ]];then #If it dont have EFI if [[ -z $partefi ]];then #If it dont have EFI
case $optboot in case $optboot in
1) 1)
execl chroot pacman -S grub os-prober --noconfirm execl chroot pacman -S grub os-prober --noconfirm
@@ -500,7 +494,7 @@ if [[ -z $partefi ]];then #If it dont have EFI
execl chroot grub-mkconfig -o /boot/grub/grub.cfg execl chroot grub-mkconfig -o /boot/grub/grub.cfg
;; ;;
esac esac
else #With EFI else #With EFI
case $optboot in case $optboot in
1) 1)
echo "Instalando rEFInd para UEFI" echo "Instalando rEFInd para UEFI"
@@ -521,77 +515,74 @@ else #With EFI
mostrardialog "GRUB" "GRUB fue instalado. Si no funciona, verificar en la bios que este seleccionado grub_uefi o grub como arranque, y no Windows u otro" mostrardialog "GRUB" "GRUB fue instalado. Si no funciona, verificar en la bios que este seleccionado grub_uefi o grub como arranque, y no Windows u otro"
;; ;;
esac esac
fi fi
# Hostname # Hostname
echo "JKArch" > /mnt/etc/hostname echo "JKArch" > /mnt/etc/hostname
# Linux kernel # 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
# Clean pacman
echo "$(T "Cleaning")"
# Clean pacman execl chroot pacman -Sc --noconfirm
echo "$(T "Cleaning")" } # Fin installconf
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
langs=$(cat /etc/locale.gen | grep '^#[a-zA-Z]' | cut -f1 -d" " | cut -c2-30 | sort | uniq) langs=$(cat /etc/locale.gen | grep '^#[a-zA-Z]' | cut -f1 -d" " | cut -c2-30 | sort | uniq)
for addr in $(echo $langs | tr " " "\n") for addr in $(echo $langs | tr " " "\n")
do do
varx+=" $addr $addr" varx+=" $addr $addr"
done done
varf="dialog --stdout --nocancel --menu \"$(T "Select language for JKArch")\" 0 0 5 $varx" varf="dialog --stdout --nocancel --menu \"$(T "Select language for JKArch")\" 0 0 5 $varx"
opclang=`bash -c "$varf"` opclang=`bash -c "$varf"`
varx="" #Empty varx varx="" #Empty varx
langabr=$(echo $opclang | cut -f1 -d"_") langabr=$(echo $opclang | cut -f1 -d"_")
langinst=$(cat /etc/locale.gen | grep -m1 '^#'$opclang | cut -c2-40) langinst=$(cat /etc/locale.gen | grep -m1 '^#'$opclang | cut -c2-40)
opt=`dialog --stdout --nocancel --menu "$(T "Your language:") $opclang" 0 0 4 1 "$(T "It's right")" 2 "$(T "No,edit")"` opt=`dialog --stdout --nocancel --menu "$(T "Your language:") $opclang" 0 0 4 1 "$(T "It's right")" 2 "$(T "No,edit")"`
case $opt in case $opt in
2) opclang="";; 2) opclang="";;
esac esac
done #End of selecting lang done #End of selecting lang
echo "$(T "Now select your timezone for adjusting the clock")" echo "$(T "Now select your timezone for adjusting the clock")"
while [[ $NEW_TIMEZONE == "" ]];do while [[ $NEW_TIMEZONE == "" ]];do
NEW_TIMEZONE=$(execl tzselect) NEW_TIMEZONE=$(execl tzselect)
opt=`dialog --stdout --nocancel --menu "$(T "Your timezone:") $NEW_TIMEZONE" 0 0 4 1 "$(T "It's right")" 2 "$(T "No,edit")"` opt=`dialog --stdout --nocancel --menu "$(T "Your timezone:") $NEW_TIMEZONE" 0 0 4 1 "$(T "It's right")" 2 "$(T "No,edit")"`
case $opt in case $opt in
2) NEW_TIMEZONE="";; 2) NEW_TIMEZONE="";;
esac esac
done done
} }
##Function for make user select their user ##Function for make user select their user
function userpass { function userpass {
clear clear
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 != "" ]]
do do
pass1=`dialog --stdout --insecure --passwordbox "$(T "Password for ") $nameuser" 9 50` pass1=`dialog --stdout --insecure --passwordbox "$(T "Password for ") $nameuser" 9 50`
pass2=`dialog --stdout --insecure --passwordbox "$(T "Repeat password")" 9 50` pass2=`dialog --stdout --insecure --passwordbox "$(T "Repeat password")" 9 50`
if ! [[ $pass1 = $pass2 && $pass1 != "" ]];then if ! [[ $pass1 = $pass2 && $pass1 != "" ]];then
mostrardialog "$(T "Password")" "$(T "Passwords do not match")" mostrardialog "$(T "Password")" "$(T "Passwords do not match")"
fi fi
done done
passuser=${pass1} passuser=${pass1}
pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione
#See if user wants to edit root password or not. #See if user wants to edit root password or not.
opt=`dialog --stdout --nocancel --menu "$(T "You want to edit root (admin) password or set same as user?")" 0 0 4 1 "$(T "Same as user")" 2 "$(T "Edit")"` opt=`dialog --stdout --nocancel --menu "$(T "You want to edit root (admin) password or set same as user?")" 0 0 4 1 "$(T "Same as user")" 2 "$(T "Edit")"`
case $opt in case $opt in
1) passroot=${pass2};; 1) passroot=${pass2};;
2) until [[ $pass1 = $pass2 && $pass1 != "" ]] 2) until [[ $pass1 = $pass2 && $pass1 != "" ]]
do do
@@ -604,14 +595,14 @@ case $opt in
passroot=${pass2} passroot=${pass2}
pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione
;; ;;
esac esac
} }
##User graphics select ##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)"`
case $optgrafica in case $optgrafica in
1) pak="xf86-video-nouveau xf86-video-nv libva-vdpau-driver mesa-vdpau";; 1) pak="xf86-video-nouveau xf86-video-nv libva-vdpau-driver mesa-vdpau";;
2) pak="xf86-video-ati xf86-video-amdgpu libva-mesa-driver libva-vdpau-driver mesa-vdpau";; 2) pak="xf86-video-ati xf86-video-amdgpu libva-mesa-driver libva-vdpau-driver mesa-vdpau";;
3) pak="xf86-video-intel libva-intel-driver libvdpau-va-gl";; 3) pak="xf86-video-intel libva-intel-driver libvdpau-va-gl";;
@@ -619,26 +610,26 @@ case $optgrafica in
5) pak="virtualbox-guest-utils virtualbox-guest-modules-arch";; 5) pak="virtualbox-guest-utils virtualbox-guest-modules-arch";;
6) pak="xf86-video-vmware xf86-input-vmmouse open-vm-tools";; 6) pak="xf86-video-vmware xf86-input-vmmouse open-vm-tools";;
7) pak=$(execl chroot pacman -Ssq xf86-video-*);; 7) pak=$(execl chroot pacman -Ssq xf86-video-*);;
esac esac
allpackages=$allpackages" "$pak allpackages=$allpackages" "$pak
#Instalar siempre la estandar, por se acaso #Instalar siempre la estandar, por se acaso
pak="xf86-video-vesa mesa-libgl" pak="xf86-video-vesa mesa-libgl"
allpackages=$allpackages" "$pak allpackages=$allpackages" "$pak
} }
##Interactive function for make user select programs ##Interactive function for make user select programs
function programasguiuser { function programasguiuser {
clear clear
# Default selected apps # Default selected apps
opt1="1 6" opt1="1 6"
opt2="1 5" opt2="1 5"
opt3="1" opt3="1"
opt5="1 2" opt5="1 2"
opt6="1 2 3 4 5 6" opt6="1 2 3 4 5 6"
mostrardialog "Leer" "Ahora se le presenta la opcion de elegir que programas quieres que sean instalados, cosa que recomendamos, aunque, dejamos tambien una opcion rapida, que instalara lo basico y recomendado desde nuestro punto de vista." mostrardialog "Leer" "Ahora se le presenta la opcion de elegir que programas quieres que sean instalados, cosa que recomendamos, aunque, dejamos tambien una opcion rapida, que instalara lo basico y recomendado desde nuestro punto de vista."
tipoinstall=`dialog --stdout --nocancel --menu "¿Elegir los programas que quiere?" 0 0 5 1 "Si, elegir (Muy recomendado)" 2 "No, instalar preseleccion de programas (No recomendado)" 3 "No, no instalar ninguno (Solo tendras el entorno y poco más)"` tipoinstall=`dialog --stdout --nocancel --menu "¿Elegir los programas que quiere?" 0 0 5 1 "Si, elegir (Muy recomendado)" 2 "No, instalar preseleccion de programas (No recomendado)" 3 "No, no instalar ninguno (Solo tendras el entorno y poco más)"`
case $tipoinstall in case $tipoinstall in
1) 1)
until [[ $surep -eq 1 ]] until [[ $surep -eq 1 ]]
do do
@@ -667,9 +658,9 @@ case $tipoinstall in
3) mostrardialog "Ningun programa" "No se instalara ningun programa opcional." 3) mostrardialog "Ningun programa" "No se instalara ningun programa opcional."
nooptprogs="1" # Not install anything nooptprogs="1" # Not install anything
;; ;;
esac esac
if [[ $nooptprogs != "1" ]];then if [[ $nooptprogs != "1" ]];then
packages="" #Erase var before packages="" #Erase var before
case $opt1 in case $opt1 in
*1*) packages="firefox";;& *1*) packages="firefox";;&
@@ -748,16 +739,16 @@ if [[ $nooptprogs != "1" ]];then
esac esac
allpackages=$allpackages" "$packages allpackages=$allpackages" "$packages
packages="" packages=""
fi fi
} }
##Function to select environment ##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"`
case $optentorno in case $optentorno in
1) 1)
pak="lxappearance lxappearance-obconf lxde-common lxinput lxpanel lxrandr lxsession lxtask lxterminal openbox pcmanfm xfce4-notifyd gtk-engine-aurora faenza-icon-theme" pak="lxappearance lxappearance-obconf lxde-common lxinput lxpanel lxrandr lxsession lxtask lxterminal openbox pcmanfm xfce4-notifyd gtk-engine-aurora faenza-icon-theme"
#Themes: gtk-engine-aurora faenza-icon-theme #Themes: gtk-engine-aurora faenza-icon-theme
@@ -783,18 +774,17 @@ case $optentorno in
pak="plasma" pak="plasma"
#Remove plasma-mediacenter ksshaskpass after, in installconf #Remove plasma-mediacenter ksshaskpass after, in installconf
;; ;;
esac esac
#Pass pak to allpackages #Pass pak to allpackages
allpackages=$allpackages" "$pak allpackages=$allpackages" "$pak
# Basic programs (Xorg) and audio support if there is selected any
if [[ $optentorno != 7 ]];then
pak="xorg-server xorg-xinit xorg-server-common xf86-input-libinput xterm lightdm lightdm-gtk-greeter gvfs gvfs-mtp gvfs-smb gvfs-afc udisks networkmanager network-manager-applet gnome-keyring xdialog lxterminal ttf-inconsolata octopi octopi-notifier gksu pulseaudio pavucontrol xdg-user-dirs jkarch-appearance xfce4-power-manager"
#Gestor de energia xfce4-power-manager
allpackages=$allpackages" "$pak
fi
# Basic programs (Xorg) and audio support if there is selected any
if [[ $optentorno != 7 ]];then
pak="xorg-server xorg-xinit xorg-server-common xf86-input-libinput xterm lightdm lightdm-gtk-greeter gvfs gvfs-mtp gvfs-smb gvfs-afc udisks networkmanager network-manager-applet gnome-keyring xdialog lxterminal ttf-inconsolata octopi octopi-notifier gksu pulseaudio pavucontrol xdg-user-dirs jkarch-appearance xfce4-power-manager"
#Gestor de energia xfce4-power-manager
allpackages=$allpackages" "$pak
fi
} }
### More optional configs ### ### More optional configs ###
@@ -833,19 +823,18 @@ done
## Set X11 keyboard ## Set X11 keyboard
function keyboardlayout { function keyboardlayout {
echo "KEYMAP=$langabr" > /mnt/etc/vconsole.conf echo "KEYMAP=$langabr" > /mnt/etc/vconsole.conf
echo "# Read and parsed by systemd-localed. It's probably wise not to edit this file" > /mnt/etc/X11/xorg.conf.d/00-keyboard.conf echo "# Read and parsed by systemd-localed. It's probably wise not to edit this file" > /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo "# manually too freely." >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf echo "# manually too freely." >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo 'Section "InputClass"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf echo 'Section "InputClass"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo ' Identifier "system-keyboard"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf echo ' Identifier "system-keyboard"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo ' MatchIsKeyboard "on"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf echo ' MatchIsKeyboard "on"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo ' Option "XkbLayout" "'$langabr'"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf echo ' Option "XkbLayout" "'$langabr'"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo 'EndSection' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf echo 'EndSection' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
} }
function bootselect { function bootselect {
if [[ -z $partefi ]];then
if [[ -z $partefi ]];then
#Si no usa EFI, preguntar por instalar GRUB #Si no usa EFI, preguntar por instalar GRUB
optboot=`dialog --stdout --nocancel --menu "¿Instalar bootloader/gestor de arranque?" 0 0 4 1 "Si (GRUB)" 2 "No, no instalar gestor de arranque"` optboot=`dialog --stdout --nocancel --menu "¿Instalar bootloader/gestor de arranque?" 0 0 4 1 "Si (GRUB)" 2 "No, no instalar gestor de arranque"`
case $optboot in case $optboot in
@@ -854,7 +843,7 @@ if [[ -z $partefi ]];then
mostrardialog "Bootloader" "$(T "No new bootloader will be installed")" mostrardialog "Bootloader" "$(T "No new bootloader will be installed")"
;; ;;
esac esac
else else
#Si usa EFI, preguntar por instalar rEFInd #Si usa EFI, preguntar por instalar rEFInd
optboot=`dialog --stdout --nocancel --menu "¿Instalar bootloader/gestor de arranque?" 0 0 4 1 "Si (rEFInd) (Recomendado)" 2 "Si (GRUB) (Suele fallar)" 3 "No, no instalar gestor de arranque"` optboot=`dialog --stdout --nocancel --menu "¿Instalar bootloader/gestor de arranque?" 0 0 4 1 "Si (rEFInd) (Recomendado)" 2 "Si (GRUB) (Suele fallar)" 3 "No, no instalar gestor de arranque"`
case $optboot in case $optboot in
@@ -863,7 +852,7 @@ else
mostrardialog "Bootloader" "$(T "No new bootloader will be installed")" mostrardialog "Bootloader" "$(T "No new bootloader will be installed")"
;; ;;
esac esac
fi fi
} }
##End of declaring functions, start of script ##End of declaring functions, start of script
@@ -989,8 +978,8 @@ otrasconfig
# Unmount and tweak pacman if necessary (If offline) # 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
fi fi
echo "Sincronizando datos al disco duro, puede tardar unos segundos" echo "Sincronizando datos al disco duro, puede tardar unos segundos"