1
0
mirror of https://gitlab.com/JKANetwork/JKArch.git synced 2026-02-15 17:51:33 +01:00
Files
JKArch/archinstall/chrootinstall.sh
2016-05-30 22:50:25 +02:00

269 lines
7.0 KiB
Bash
Executable File

#!/bin/bash
#Este script corre en el chroot para configurar todo
argpart=$1
partefi=$2
function pause {
echo "Pulse enter para continuar..."
read
}
function horaidioma {
#Idioma
echo "Escoja su idioma. Se irá desde la abreviatura general, a la particular"
options=($(cat /etc/locale.gen | grep '^#[a-zA-Z]' | cut -c2-30 | cut -f1 -d"_" | sort | uniq))
select opt in "${options[@]}"
do
case $opt in
*) langabr=$opt;break;;
esac
done
clear
options=($(cat /etc/locale.gen | grep '^#'$langabr | cut -c2-30 | cut -f1 -d" " | sort | uniq))
select opt in "${options[@]}"
do
case $opt in
*) opclang=$opt;break;;
esac
done
langinst=$(cat /etc/locale.gen | grep -m1 '^#'$opclang | cut -c2-40)
sed "s/\#$langinst/$langinst/g" /etc/locale.gen > /etc/locale.gen.new
mv /etc/locale.gen.new /etc/locale.gen
echo "LANG=$opclang" > /etc/locale.conf
echo "LC_COLLATE=$opclang" >> /etc/locale.conf
echo "KEYMAP=$langabr" > /etc/vconsole.conf
locale-gen
echo "Ahora seleccione su ubicación/país para ajustar el reloj"
NEW_TIMEZONE=$(tzselect)
test -n "$NEW_TIMEZONE" && cp -fp /usr/share/zoneinfo/"$NEW_TIMEZONE" /etc/localtime
hwclock --systohc --utc
}
function userpass {
clear
#Aqui hay que añadir los comandos para crear un usuario, aunque esto correrá dentro del chroot y no aqui
echo "Para seguridad, vamos a cambiar la contraseña de root"
echo "Contraseña para el usuario root:"
passwd root
echo "Ahora crearemos tu usuario:"
echo "Nombre:"
read nameuser
useradd -m -G wheel -s /bin/bash $nameuser
passwd $nameuser
}
function graficos {
optgrafica=`dialog --stdout --nocancel --menu "¿Cual es la marca de su tarjeta gráfica?" 0 0 5 1 "Nvidia" 2 "AMD/ATI" 3 "Intel" 4 "VIA" 5 "Estoy usando VirtualBox" 6 "No se la marca/Otra (Se instalaran las estandar)"`
case $optgrafica in
1)
pacman -S xf86-video-nouveau xf86-video-nv --noconfirm
break
;;
2)
pacman -S xf86-video-ati --noconfirm
break
;;
3)
pacman -S xf86-video-intel --noconfirm
break
;;
4)
pacman -S xf86-video-openchrome --noconfirm
break
;;
5)
pacman -S virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm
break
;;
6)
pacman -S xf86-video-vesa xf86-video-nouveau xf86-video-nv xf86-video-ati xf86-video-intel xf86-video-openchrome --noconfirm
break
;;
esac
}
function programasuser {
clear
dialog --title "Leer" --msgbox "Ahora customizaremos e instalaremos los programas que escoja. Puede seleccionar 'cancelar' en cualquier apartado para no instalar ninguno \n \n Se seleccionan o des seleccionan con la tecla espacio, y con el enter se acepta la selección" 15 60
##Navegadores
opta=`dialog --stdout --checklist "¿Que navegador quieres?" 0 0 6 1 "Firefox" on 2 "Chrome" off 3 "Chromium" off 4 "Opera" off 5 "Otter Browser" off 6 "Soporte Flash Player" on`
case $opta in
*1*)
packa="firefox";;&
*2*)
packa="$packa google-chrome";;&
*3*)
packa="$packa chromium";;&
*4*)
packa="$packa opera";;&
*5*)
packa="$packa otter-browser";;&
*6*)
packa="$packa flashplugin";;&
esac
pacman -S $packa --noconfirm
##Editores de texto/Office
optb=`dialog --stdout --checklist "¿Editores de texto y/o office?" 0 0 6 1 "Libreoffice" on 2 "AbiWord" off 3 "Gnumeric" off 4 "WPS Office" off 5 "leafpad (Bloc de notas)" on 6 "gedit" off 7 "notepadqq" off`
case $optb in
*1*)
packb="libreoffice-fresh";;&
*2*)
packb="$packb abiword";;&
*3*)
packb="$packb gnumeric";;&
*4*)
packb="$packb wps-office";;&
*5*)
packb="$packb leafpad";;&
*6*)
packb="$packb gedit";;&
*7*)
packb="$packb notepadqq";;&
esac
pacman -S $packb --noconfirm
##Audio y video
optc=`dialog --stdout --checklist "Audio y Video" 0 0 6 1 "VLC (Recomendado)" on 2 "SMPlayer" off 3 "Totem" off 4 "Clementine" off 5 "Banshee" off`
case $optc in
*1*)
packc="vlc qt4";;&
*2*)
packc="$packc smplayer";;&
*3*)
packc="$packc totem";;&
*4*)
packc="$packc clementine";;&
*5*)
packc="$packc banshee";;&
esac
pacman -S $packc --noconfirm
##Utilidades varias
optd=`dialog --stdout --checklist "Utilidades varias" 0 0 8 1 "Dropbox" off 2 "MEGA" off 3 "Visor de correo Geary" off 4 "Grabador de discos (k3b)" off 5 "Java (jre8)" off`
case $optd in
*1*)
packd="dropbox";;&
*2*)
packd="$packd megasync";;&
*3*)
packd="$packd geary";;&
*4*)
packd="$packd k3b";;&
*5*)
packd="$packd jre8-openjdk";;&
esac
pacman -S $packd --noconfirm
}
function entorno {
clear
optentorno=`dialog --stdout --nocancel --menu "Escoje tu entorno de escritorio" 0 0 5 1 "LXDE (Muy liviano)" 2 "XFCE (Liviano y bonito)" 3 "Cinnamon (Facil para antiguos usuarios de Windows)" 4 "Gnome (Complejo, pero practico)" 5 "Plasma/KDE (Pesado aunque bonito) " 6 "No instalar nada, solo la terminal de comandos"`
case $optentorno in
1)
pacman -S lxde --noconfirm
#Quitar paquetes no necesarios para correr lxde
pacman -R lxmusic lxlauncher lxdm --noconfirm
instentorno=1
break
;;
2)
pacman -S xfce4 --noconfirm
instentorno=1
break
;;
3)
pacman -S cinnamon --noconfirm
instentorno=1
break
;;
4)
pacman -S gnome --noconfirm
instentorno=1
break
;;
5)
pacman -S plasma --noconfirm
pacman -R plasma-mediacenter ksshaskpass --noconfirm
instentorno=1
break
;;
6)
break
;;
esac
if [[ $instentorno ]];then
graficos
echo "Instalando algún otro programa básico para mejorar la experiencia de usuario.."
pacman -S xorg-server xorg-server-common xf86-input-libinput lightdm lightdm-gtk-greeter lxterminal gvfs udisks networkmanager network-manager-applet Xdialog --noconfirm
systemctl enable lightdm
#Poner el teclado bien en x11
localectl --no-convert set-x11-keymap $langabr
#Aqui va la personalizacion de programas, ya que son graficos.
programasuser
fi
}
function bootinstall {
clear
echo "¿Instalar bootloader?"
options=("Si" "No, no instalar gestor de arranque")
select opt in "${options[@]}"
do
case $opt in
"Si")
if [[ -z $partefi ]];then
echo "Instalando GRUB para BIOS/MBR"
pacman -S grub os-prober --noconfirm
grub-install --target=i386-pc /dev/$argpart
grub-mkconfig -o /boot/grub/grub.cfg
else
echo "Instalando GRUB para GPT/UEFI"
echo "AVISO, GPT/UEFI ES EXPERMIENTAL, FALTA PROBARLO MAS, PUEDES QUEDARTE SIN ARRANQUE"
pacman -S grub os-prober efibootmgr dosfstools --noconfirm
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub_uefi --recheck
grub-mkconfig -o /boot/grub/grub.cfg
fi
break
;;
"No, no instalar gestor de arranque")
#Asi no formateará
echo "No se ha instalado ningún gestor de arranque nuevo"
break
;;
*) echo invalid option;;
esac
done
}
echo "Configuración de su sistema"
echo "Paquetes basicos para la instalación, puede tardar un poco"
pacman -Syu jka-toolkit git wget netctl iw wpa_supplicant dialog sudo alsa-utils --noconfirm
pacman -S pulseaudio pavucontrol --noconfirm
horaidioma
mkinitcpio -p linux
#Configuraciones varias
userpass
entorno
bootinstall
echo "Ultimos retoques y limpieza.."
systemctl enable dhcpcd
pacman -Sc --noconfirm