1
0
mirror of https://gitlab.com/JKANetwork/JKArch.git synced 2026-02-17 10:41:32 +01:00

Restructure

This commit is contained in:
kprkpr
2016-09-27 23:39:03 +02:00
parent ddb4ab5603
commit df202e043c
3 changed files with 360 additions and 1219 deletions

View File

@@ -1,723 +0,0 @@
#!/bin/bash
## Note: Some text editors in some lines its wrong the "markup color" because much '"'($) things.
sclang=$1
source translations.sh
##Offline var
isoffline=0
if [[ ! -z "$2" ]];then
isoffline="$2" #If its offline will be 1
fi
#Try to disable ctrl+C
trap '' INT
#No black screensaver
setterm -blank 0 -powerdown 0 -powersave off
#Fix para caracteres de dialog, ñ o tildes
export NCURSES_NO_UTF8_ACS=1
function pause {
echo "$(T "Press enter to continue...")"
read
}
function mostrardialog {
local titled
local msgd
titled=$1
msgd=$2
dialog --title "$titled" --msgbox "$msgd" 15 60
}
function fatalerror {
razon=$1
mostrardialog "Error" "$(T "An error has ocurred, setup will be stopped") $razon"
exit
}
function isanetworkerror {
if [[ $? != 0 ]];then
fatalerror "$(T "Network connection error, please check it")"
fi
}
function inchroot {
chroot /mnt /bin/bash -c "$*"
}
function optstate {
if [[ $1 =~ "$2" ]];then
echo "on"
else
echo "off"
fi
}
function particiones {
clear
mostrardialog "$(T "Questions about partitions where system will be installed")" "$(T "Questions about partitions dialog. Text")"
clear
if [[ ! $(lsblk --output KNAME | cut -c1-3 | sort | uniq | sed '1d' | grep 'sd\|hd') ]];then
mostrardialog "ERROR" "$(T "ERROR: You dont have HDD, insert one, poweroff")"
reboot
fi
optpa=`dialog --stdout --nocancel --menu "$(T "¿Do you want to edit partitions?¿How?")" 0 0 5 1 "Grafico con Gparted (Recomendado)" 2 "Terminal (Pequeño asistente o por tu cuenta)" 3 "Borrar un disco duro e instalar JKArch en el (usar con cuidado!)" 4 "No editar nada"`
case $optpa in
1)
#Abrir gparted grafico
mostrardialog "Gparted" "$(T "Gparted will be opened. Help text")"
startx;;
2)
#Terminal
echo $(T "Select hard disk to edit")
echo "AVISO, GPT/UEFI ES EXPERMIENTAL, FALTA PROBARLO MAS, PUEDES QUEDARTE SIN ARRANQUE"
lsblk --output NAME,KNAME,FSTYPE,SIZE,LABEL
options=($(lsblk --output KNAME | cut -c1-3 | sort | uniq | sed '1d' | grep 'sd\|hd') "No editar" "Terminal")
select opt in "${options[@]}"
do
case $opt in
"Terminal")
echo "Haga los cambios pertinentes, asegurese, y escriba exit continuar la instalación"
bash
break;;
"No editar") break;;
*) cfdisk /dev/$opt;break;;
esac
done
;;
3)
mostrardialog "$(T "Full hard disk install")" "$(T "Full hard disk install. Text")"
clear
tput setaf 6 ; echo "$(T "Your partition scheme")" ; tput setaf 9
lsblk --output NAME,KNAME,FSTYPE,SIZE,LABEL
tput setaf 6 ; echo "$(T "Select hard disk to delete and use by JKArch")" ; tput setaf 9
options=($(lsblk --output KNAME | cut -c1-3 | sort | uniq | sed '1d' | grep 'sd\|hd') "$(T "Exit")")
select opt in "${options[@]}"
do
case $opt in
"$(T "Exit")")
mostrardialog "Instalacion detenida" "Se detuvo la instalacion. No se hicieron cambios. Al aceptar, reiniciara la instalacion"
exec ./selectlang.sh
;;
*)
if [[ -z $opt ]];then
echo "$(T "Not valid")"
else
optseg=`dialog --stdout --nocancel --menu "¿Estas seguro de borrar todo /dev/$opt y meter JKArch aqui? No es reversible" 0 0 4 1 "No" 2 "No" 3 "Si, estoy seguro" 4 "No"`
case $optseg in
3)
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"
poweroff;;
esac
fi;;
esac
done
;;
esac
clear
# Solo pedir datos si no esta en modo automatico, evidentemente.
if [[ ! $optpa -eq 3 ]];then
tput setaf 6 ; echo "$(T "Your partition scheme")" ; tput setaf 9
lsblk --output NAME,KNAME,FSTYPE,SIZE,LABEL
tput setaf 6 ; echo "$(T "I recommend to take notes before continue. Next, you will have the questions about it")" ; tput setaf 9
pause
harddisks=$(lsblk --output KNAME | cut -c1-3 | sort | uniq | sed '1d' | grep 'sd\|hd')
i=3
for addr in $(echo $harddisks | tr " " "\n")
do
varx+=" $addr '- $(lsblk --output SIZE /dev/$addr | sed '1d' | head -1)'"
done
varf="dialog --stdout --nocancel --menu \"Selecciona disco duro a utilizar para seleccionar las particiones\" 0 0 5 $varx"
hd=`bash -c "$varf"`
#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}')"
if [[ $tabletype = "gpt" ]];then
mostrardialog "$(T "GPT Partition Table")" "$(T "You are using GPT, you will have to select EFI")"
fi
clear
variable=$(lsblk --output KNAME /dev/${hd} | cut -c1-4 | tail -n +3)
i=3
varx=""
for addr in $(echo $variable | tr " " "\n")
do
varx+=" $addr '$(lsblk --output KNAME,FSTYPE,SIZE,LABEL /dev/${hd} | tail -n +$i | head -1)'"
i=$((i+1))
done
varf="dialog --stdout --nocancel --menu \"Selecciona la particion raiz(/)\" 0 0 5 $varx"
particionraiz=`bash -c "$varf"`
optfr=`dialog --stdout --nocancel --menu "Formato para la particion raiz(/)" 0 0 4 1 "EXT4 (Recomendado)" 2 "BTRFS" 3 "XFS" 4 "No formatear (Si ya esta formateada)"`
case $optfr in
1) formatoraiz="mkfs.ext4 -F";;
2) formatoraiz="mkfs.btrfs -f";;
3) formatoraiz="mkfs.xfs -f";;
4) formatoraiz="echo No formatear ";;
esac
clear
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
2)
#Selección de home
variable=$(lsblk --output KNAME /dev/${hd} | cut -c1-4 | tail -n +3)
i=3
varx=""
for addr in $(echo $variable | tr " " "\n")
do
varx+=" $addr '$(lsblk --output KNAME,FSTYPE,SIZE,LABEL /dev/${hd} | tail -n +$i | head -1)'"
i=$((i+1))
done
varf="dialog --stdout --nocancel --menu \"Selecctiona la particion home (/home)\" 0 0 5 $varx"
particionhome=`bash -c "$varf"`
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)"`
case $optfh in
1)
formatohome="mkfs.ext4 -F";;
2)
formatohome="mkfs.btrfs -f";;
3)
formatohome="mkfs.xfs -f";;
4)
formatohome="echo No formatear ";;
esac
fi
;;
esac
if [[ $formatoraiz -eq "mkfs.btrfs -f" ]];then
mostrardialog "No swapfile" "Es contraproducente hacer un fichero swap en una particion btrfs, no debes hacerlo, pero si antes creaste una particion swap, se puede utilizar"
fi
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 "RAM: $(echo $ram) . $(T "Enter how much memory you want to use for swap (MB)")" 9 50`;;
3) mostrardialog "Swap" "$(T "JKArch autodetects swap partitions")";;
esac
clear
if [[ $tabletype = "gpt" ]];then
lsblk --output NAME,KNAME,FSTYPE,SIZE,LABEL
tput setaf 6 ; echo "$(T "Select EFI partition")" ; tput setaf 9
options=($(lsblk --output KNAME | sed '1d' | grep 'sd\|hd' | grep '[1-9]$'))
select opt in "${options[@]}"
do
case $opt in
*)
if [[ -z $opt ]];then
echo "$(T "Not valid")"
else
partefi=$opt
break
fi;;
esac
done
fi
fi
#fin del if de pedir los datos si no esta en automatico
}
function baseinstall {
clear
tput setaf 2 ; echo "$(T "Installing system, this can take about 10 minutes, wait")" ; tput setaf 9
sleep 2
tput setaf 2 ; echo "$(T "Formatting and mounting partitions")" ; tput setaf 9
$formatoraiz /dev/$particionraiz
e2label /dev/$particionraiz "JKArch"
mount /dev/$particionraiz /mnt/
if [[ $particionhome ]];then
$formatohome /dev/$particionhome
mkdir -p /mnt/home/
mount /dev/$particionhome /mnt/home/
fi
if [[ $partefi ]];then
mkdir -p /mnt/boot/efi
mount /dev/$partefi /mnt/boot/efi/
fi
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
reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist
tput setaf 2 ; echo "$(T "Downloading")" ; tput setaf 9
pacstrap -C pacman.conf /mnt/ base btrfs-progs jkarch-mirrorlist
mv pacman.conf /mnt/etc/pacman.conf
fi
if [[ $isoffline = "1" ]];then
tput setaf 2 ; echo "$(T "Installing packages")..." ; tput setaf 9
pacstrap -C /root/offlinefiles/pacman-offline.conf /mnt/ base btrfs-progs jkarch-mirrorlist
mv pacman.conf /mnt/etc/pacman.conf.post #Move pacman.conf ("original online") to a chroot location
mv pacman-offline.conf /mnt/etc/pacman.conf #Move pacman.conf (offline) to pacman chroot location
fi
#Create fstab
genfstab -U /mnt >> /mnt/etc/fstab
#Create or activate swap if neccesary
if [[ $swaptype ]];then
case $swaptype in
1)
echo "$(T "Creating swap file")"
dd if=/dev/zero of=/mnt/swapfile bs=1M count=$swapamount
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
;;
esac
fi
mkdir -p /mnt/root/inst/
if [[ $isoffline = 0 ]];then
cp -r /etc/netctl/* /mnt/etc/netctl/
cp -f /etc/resolv.conf /mnt/etc/resolv.conf
fi
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /run /mnt/run
if [[ $isoffline = 1 ]];then
mount --bind /run/archiso/bootmnt/ /mnt/run/archiso/bootmnt/
fi
}
function horaidioma {
#Idioma
while [[ $opclang == "" ]];do
langs=$(cat /mnt/etc/locale.gen | grep '^#[a-zA-Z]' | cut -f1 -d" " | cut -c2-30 | sort | uniq)
for addr in $(echo $langs | tr " " "\n")
do
varx+=" $addr $addr"
done
varf="dialog --stdout --nocancel --menu \"$(T "Select language for JKArch")\" 0 0 5 $varx"
opclang=`bash -c "$varf"`
varx="" #Empty varx
langabr=$(echo $opclang | cut -f1 -d"_")
langinst=$(cat /mnt/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")"`
case $opt in
2) opclang="";;
esac
done #End of selecting lang
sed -i "s/\#$langinst/$langinst/g" /mnt/etc/locale.gen
echo "LANG=$opclang" > /mnt/etc/locale.conf
echo "LANGUAGE=$opclang" >> /mnt/etc/locale.conf
echo "LC_COLLATE=$opclang" >> /mnt/etc/locale.conf
echo "KEYMAP=$langabr" > /mnt/etc/vconsole.conf
inchroot locale-gen
clear
echo "$(T "Now select your timezone for adjusting the clock")"
while [[ $NEW_TIMEZONE == "" ]];do
NEW_TIMEZONE=$(inchroot tzselect)
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
2) NEW_TIMEZONE="";;
esac
done
test -n "$NEW_TIMEZONE" && cp -fp /mnt/usr/share/zoneinfo/"$NEW_TIMEZONE" /mnt/etc/localtime
inchroot hwclock --systohc --utc
echo "$(T "Syncing hour to internet")";
inchroot pacman -S ntp --noconfirm
inchroot systemctl enable ntpd
if [[ $isoffline = 0 ]];then
inchroot ntpd -qg
inchroot hwclock -w
else
echo "Clock will not be okay until restart and configure manually because you dont have net"
fi
}
function userpass {
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/skel.tar.gz -C /mnt/
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/skel.tar.gz -O- | tar xJf - -C /mnt/
fi
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 "Ahora crearemos tu usuario \nNombre para tu usuario:" 10 50`
inchroot useradd -m -G wheel -s /bin/bash $nameuser
until [[ $pass1 = $pass2 && $pass1 != "" ]]
do
pass1=`dialog --stdout --insecure --passwordbox "$(T "Password for ") . $nameuser" 9 50`
pass2=`dialog --stdout --insecure --passwordbox "$(T "Repeat password")" 9 50`
if ! [[ $pass1 = $pass2 && $pass1 != "" ]];then
mostrardialog "$(T "Password")" "$(T "Passwords do not match")"
fi
done
echo "${nameuser}:${pass1}" | inchroot chpasswd
pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione
#Añadir soporte sudo para este nuevo usuario
sed -i "s/\# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" /mnt/etc/sudoers
#Modificar gksu si lleva una sesion grafica
if [[ $optentorno != "6" ]];then
inchroot gconftool-2 --set /apps/gksu/sudo-mode --type=bool true --owner=$(echo $nameuser)
fi
}
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)"`
case $optgrafica in
1) inchroot pacman -S xf86-video-nouveau xf86-video-nv libva-vdpau-driver mesa-vdpau --noconfirm;;
2) inchroot pacman -S xf86-video-ati xf86-video-amdgpu libva-mesa-driver libva-vdpau-driver mesa-vdpau --noconfirm;;
3) inchroot pacman -S xf86-video-intel libva-intel-driver libvdpau-va-gl --noconfirm;;
4) inchroot pacman -S xf86-video-openchrome --noconfirm;;
5) inchroot pacman -S virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm;;
6) inchroot pacman -S xf86-video-vmware xf86-input-vmmouse open-vm-tools --noconfirm;;
7) inchroot pacman -S $(inchroot pacman -Ssq xf86-video-*) --noconfirm;;
esac
#Instalar siempre la estandar, por se acaso
inchroot pacman -S xf86-video-vesa mesa-libgl --noconfirm
}
function programasguiuser {
clear
#Seleccion de programas predeterminados
opt1="1 6"
opt2="1 5"
opt3="1"
opt5="1"
opt6="1 2"
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, opcion rapida (No recomendado)"`
case $tipoinstall in
1)
until [[ $surep -eq 1 ]]
do
optprogramas=`dialog --stdout --nocancel --scrollbar --menu "Categorías" 0 0 9 1 "Navegadores web ($(echo $opt1 | wc -w) seleccionados)" 2 "Editores de texto y Office ($(echo $opt2 | wc -w) seleccionados)" 3 "Audio y Video ($(echo $opt3 | wc -w) seleccionados)" 4 "Imagen ($(echo $opt4 | wc -w) seleccionado)" 5 "Fuentes/Tipos de letra ($(echo $opt5 | wc -w) seleccionado)" 6 "Visores ($(echo $opt6 | wc -w) seleccionado)" 7 "Soportes (Impresoras,Bluetooth...) ($(echo $opt7 | wc -w) seleccionado)" 8 "Utilidades varias ($(echo $opt8 | wc -w) seleccionado)" I "Instalar"`
#Menu con cada una de las categorias
case $optprogramas in
# La variable optstate "$optX" Y es una funcion que devuelve on o off, para mostrar la ultima seleccion bien
1) opt1=`dialog --stdout --checklist "Navegadores web" 0 0 6 1 "Firefox" $(optstate "$opt1" 1) 2 "Chrome" $(optstate "$opt1" 2) 3 "Chromium" $(optstate "$opt1" 3) 4 "Opera" $(optstate "$opt1" 4) 5 "Otter Browser" $(optstate "$opt1" 5) 6 "Soporte Flash Player" $(optstate "$opt1" 6)`;;
2) opt2=`dialog --stdout --scrollbar --checklist "Editores de texto y Office" 0 0 7 1 "Libreoffice (Recomendado)" $(optstate "$opt2" 1) 2 "AbiWord" $(optstate "$opt2" 2) 3 "Gnumeric" $(optstate "$opt2" 3) 4 "WPS Office" $(optstate "$opt2" 4) 5 "leafpad (Bloc de notas)" $(optstate "$opt2" 5) 6 "gedit" $(optstate "$opt2" 6) 7 "notepadqq" $(optstate "$opt2" 7)`;;
3) opt3=`dialog --stdout --checklist "Audio y Video" 0 0 6 1 "VLC (Recomendado)" $(optstate "$opt3" 1) 2 "SMPlayer" $(optstate "$opt3" 2) 3 "Totem" $(optstate "$opt3" 3) 4 "Clementine" $(optstate "$opt3" 4) 5 "Banshee" $(optstate "$opt3" 5)`;;
4) opt4=`dialog --stdout --checklist "Imagen" 0 0 6 1 "GIMP" $(optstate "$opt4" 1) 2 "Inkscape" $(optstate "$opt4" 2) 3 "Pinta" $(optstate "$opt4" 3) 4 "Krita (Dibujo)" $(optstate "$opt4" 4)`;;
5) opt5=`dialog --stdout --checklist "Fuentes/Tipos de letra" 0 0 6 1 "noto-fonts (Muy recomendado)" $(optstate "$opt5" 1) 2 "Microsoft Fonts" $(optstate "$opt5" 2) 3 "Recopilatorio de fuentes de Google (mas de 300)" $(optstate "$opt5" 3)`;;
6) opt6=`dialog --stdout --checklist "Recomendado pulsar todos \nVisores" 0 0 6 1 "Evince (PDF)" $(optstate "$opt6" 1) 2 "Ristretto (imagenes como jpg,png...)" $(optstate "$opt6" 2)`;;
7) opt7=`dialog --stdout --checklist "Soportes (Impresoras,Bluetooth...)" 0 0 6 1 "CUPS (Soporte impresoras)" $(optstate "$opt7" 1) 2 "HPLIP (Soporte impresoras HP)" $(optstate "$opt7" 2) 3 "Bluetooth" $(optstate "$opt7" 3)`;;
8) opt8=`dialog --stdout --scrollbar --checklist "Utilidades varias" 0 0 8 1 "Dropbox" $(optstate "$opt8" 1) 2 "MEGA" $(optstate "$opt8" 2) 3 "Visor de correo Evolution" $(optstate "$opt8" 3) 4 "Grabador de discos (k3b)" $(optstate "$opt8" 4) 5 "Java (jre8)" $(optstate "$opt8" 5) 6 "Wine ('Emulador' de programas de Windows)" $(optstate "$opt8" 6) 7 "BleachBit (Limpiador de disco duro)" $(optstate "$opt8" 7)`;;
9) opt9=`dialog --stdout --scrollbar --checklist "Programacion" 0 0 8 1 "Sublime Text 3" $(optstate "$opt9" 1) 2 "Sublime Text 2" $(optstate "$opt9" 2) 3 "Visual Studio Code" $(optstate "$opt9" 3) 4 "Eclipse" $(optstate "$opt9" 4) 5 "Monodevelop" $(optstate "$opt9" 5) 6 "Brackets" $(optstate "$opt9" 6) 7 "Atom" $(optstate "$opt9" 7) 8 "Gamedevelop" $(optstate "$opt9" 8) 9 "Poedit (gettext)" $(optstate "$opt9" 9) A "Arduino IDE" $(optstate "$opt9" A)`;;
"I")
#Instalar
surep=1
break;;
esac
done
;;
2) mostrardialog "Programas predeterminados" "Ahora se van a instalar los programas predeterminados, espere"
esac
packages="" #Erase var before
case $opt1 in
*1*) packages="firefox";;&
*2*) packages="$packages google-chrome";;&
*3*) packages="$packages chromium";;&
*4*) packages="$packages opera";;&
*5*) packages="$packages otter-browser";;&
*6*) packages="$packages flashplugin";;&
esac
case $opt2 in
*1*) packages="$packages libreoffice-fresh";;&
*2*) packages="$packages abiword";;&
*3*) packages="$packages gnumeric";;&
*4*) packages="$packages wps-office";;&
*5*) packages="$packages leafpad";;&
*6*) packages="$packages gedit";;&
*7*) packages="$packages notepadqq";;&
esac
case $opt3 in
*1*) packages="$packages vlc qt4";;&
*2*) packages="$packages smplayer";;&
*3*) packages="$packages totem";;&
*4*) packages="$packages clementine";;&
*5*) packages="$packages banshee";;&
esac
case $opt4 in
*1*) packages="$packages gimp";;&
*2*) packages="$packages inkscape";;&
*3*) packages="$packages pinta";;&
*4*) packages="$packages krita";;&
esac
case $opt5 in
*1*) packages="$packages noto-fonts";;&
*2*) packages="$packages ttf-ms-fonts";;&
*3*) packages="$packages ttf-google-fonts-git";;&
esac
case $opt6 in
*1*) packages="$packages evince";;&
*2*) packages="$packages ristretto librsvg";;&
esac
case $opt7 in
*1*) packages="$packages cups cups-filters";;&
*2*) packages="$packages hplip";;&
*3*) packages="$packages bluez bluez-utils bluez-cups bluez-firmware bluez-libs blueberry";;&
esac
case $opt8 in
*1*) packages="$packages dropbox";;&
*2*) packages="$packages megasync";;&
*3*) packages="$packages geary";;&
*4*) packages="$packages k3b";;&
*5*) packages="$packages jre8-openjdk";;&
*6*) packages="$packages wine-staging wine_gecko winetricks"
packages="$packages lib32-libpng lib32-libldap lib32-gnutls lib32-mpg123 lib32-libpulse lib32-ncurses lib32-openal lib32-alsa-lib" #Some 32bit libs for winearch 32 work better
inswine=1;;&
*7*) packages="$packages bleachbit";;&
esac
case $opt9 in
*1*) packages="$packages sublime-text-dev";;&
*2*) packages="$packages sublime-text";;&
*3*) packages="$packages visual-studio-code";;&
*4*) packages="$packages jdk8-openjdk eclipse-java";;&
*5*) packages="$packages monodevelop";;&
*6*) packages="$packages brackets";;&
*7*) packages="$packages atom-editor-bin";;&
*8*) packages="$packages gdevelop";;&
*9*) packages="$packages poedit";;&
*A*) packages="$packages arduino";;&
esac
pacman -S $packages --noconfirm --needed
if [[ $inswine = 1 ]];then
echo "$(T "Configuring wine for better experience") (32 bit winearch)"
inchroot su $nameuser -c "WINEARCH=win32 wineboot -u"
fi
packages=""
}
function baseconX {
tput setaf 2 ;echo "$(T "Installing desktop and basic programs, please wait")" ; tput setaf 9
sleep 2
inchroot pacman -S xorg-server xorg-xinit xorg-server-common xf86-input-libinput lightdm lightdm-gtk-greeter gvfs gvfs-mtp gvfs-smb udisks networkmanager network-manager-applet gnome-keyring xdialog --noconfirm
inchroot pacman -S lxterminal ttf-inconsolata file-roller --noconfirm
#Instalar pulseaudio si tiene entorno grafico, sino es tonteria
inchroot pacman -S pulseaudio pavucontrol --noconfirm
echo "Instalando octopi, gestor visual de actualizaciones y paquetes"
inchroot pacman -S octopi octopi-notifier gksu --noconfirm
inchroot pacman -S xdg-user-dirs --noconfirm
inchroot xdg-user-dirs-update
#Gestor de energia
inchroot pacman -S xfce4-power-manager --noconfirm
#Habilitamos ciertos servicios
inchroot systemctl enable lightdm
inchroot systemctl enable NetworkManager
#Parte visual
inchroot pacman -S jkarch-appearance --noconfirm
clear
}
function keyboardlayout {
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 "# 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 ' 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 ' Option "XkbLayout" "'$langabr'"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo 'EndSection' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
}
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"`
case $optentorno in
1)
baseconX
inchroot pacman -S lxappearance lxappearance-obconf lxde-common lxinput lxpanel lxrandr lxsession lxtask lxterminal openbox pcmanfm xfce4-notifyd --noconfirm
inchroot pacman -S gtk-engine-aurora faenza-icon-theme --noconfirm
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/LXDE.tar.xz -C /mnt/
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/LXDE.tar.xz -O- | tar xJf - -C /mnt/
fi
;;
2)
baseconX
inchroot pacman -S xfce4 --noconfirm
inchroot pacman -S faenza-icon-theme --noconfirm
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/XFCE4.tar.xz -C /mnt/
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/XFCE4.tar.xz -O- | tar xJf - -C /mnt/
fi
;;
3)
baseconX
inchroot pacman -S cinnamon --noconfirm
;;
4)
optgnome=`dialog --stdout --nocancel --menu "¿Gnome base o gnome con sus extras?" 0 0 5 1 "Gnome base" 2 "Gnome+extras"`
baseconX
case $optgnome in
1) inchroot pacman -S gnome --noconfirm;;
2) inchroot pacman -S gnome gnome-extra --noconfirm;;
esac
inchroot pacman -R gdm --noconfirm
;;
5)
optmate=`dialog --stdout --nocancel --menu "¿MATE base o MATE con sus extras?" 0 0 5 1 "MATE base" 2 "MATE+extras"`
baseconX
case $optmate in
1) inchroot pacman -S mate --noconfirm;;
2) inchroot pacman -S mate mate-extra --noconfirm;;
esac
;;
6)
baseconX
inchroot pacman -S plasma --noconfirm
inchroot pacman -R plasma-mediacenter ksshaskpass --noconfirm
;;
esac
if [[ $optentorno != "7" ]];then
graficos
#Poner el teclado bien en x11
keyboardlayout
#Aqui va la personalizacion de programas, ya que son graficos.
programasguiuser
fi
}
clear
mostrardialog "$(T "JKArch install script")" "$(T "Intro arch install script")"
mostrardialog "JKArch" "El script esta en estado beta y se esta actualizando casi constantemente. Puede haber fallos importantes. En caso de fallo, vuelva a probar en unas horas"
echo "Desmontando posibles particiones"
umount /mnt/boot/efi/
umount /mnt/*
umount /mnt/
particiones
clear
tput setaf 6
echo "$(T "Ok, last thing before start installing, summary of changes")"
echo "$(T "Partition scheme before your changes")"
tput setaf 9
lsblk --output NAME,KNAME,FSTYPE,SIZE,LABEL
tput setaf 6
echo "$(T "Your changes")"
tput setaf 9
case $formatoraiz in
"mkfs.ext4 -F")
mosfraiz="$(T "ext4 formatted")";;
"mkfs.btrfs -f")
mosfraiz="$(T "btrfs formatted")";;
"mkfs.xfs -f")
mosfraiz="$(T "XFS formatted")";;
"echo No formatear ")
mosfraiz="$(T "not formatted")";;
esac
echo "$(T "Root partition"): $particionraiz , $mosfraiz"
if [[ $particionhome ]];then
case $formatohome in
"mkfs.ext4 -F")
mosfhome="$(T "ext4 formatted")";;
"mkfs.btrfs -f")
mosfhome="$(T "btrfs formatted")";;
"mkfs.xfs -f")
mosfhome="$(T "XFS formatted")";;
"echo No formatear ")
mosfhome="$(T "not formatted")";;
esac
echo "$(T "Home partition"): $particionhome , $mosfhome"
fi
if [[ $partefi ]];then
echo "$(T "EFI partition in") $partefi"
fi
tput setaf 1 ; echo "$(T "If you agree with that, press enter. If not, turn off the computer")" ; tput setaf 9
pause
baseinstall
echo "$(T "System configuration")"
echo "$(T "Basic setup packages, this can take a minute")"
inchroot pacman -Syu jka-toolkit git wget netctl iw wpa_supplicant dialog sudo alsa-utils dosfstools ntfs-3g bash-completion --noconfirm --needed
horaidioma
echo "JKArch" > /mnt/etc/hostname
#Configuraciones varias, en entorno se instala el entorno y programas del usuario
entorno
mkinitcpio -p linux #Hacemos el mkinitcpio después de tener instalados los gráficos
#Ahora, se crea el usuario y se añaden los ficheros de configuracion de skel
userpass
bootinstall
otrasconfig
echo "$(T "Last tweaks and cleaning")"
inchroot systemctl enable dhcpcd
inchroot pacman -Sc --noconfirm
echo "Sincronizando datos al disco duro, puede tardar unos segundos"
sync
if [[ $isoffline = 1 ]];then # Is an offline installation?
echo "Configurando pacman para usar servidores web en los siguientes arranques..."
mv -f /mnt/etc/pacman.conf.post /mnt/etc/pacman.conf
fi
clear
mostrardialog "$(T "End")" "$(T "Setup finished, press enter to reboot.")"
rm -rf /mnt/root/inst
reboot

379
archinstall/archinstall.sh Executable file → Normal file
View File

@@ -41,6 +41,19 @@ fatalerror "$(T "Network connection error, please check it")"
fi fi
} }
function inchroot {
chroot /mnt /bin/bash -c "$*"
}
function optstate {
if [[ $1 =~ "$2" ]];then
echo "on"
else
echo "off"
fi
}
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")"
@@ -113,8 +126,9 @@ case $optpa in
fi fi
break;; break;;
*) *)
mostrardialog "Instalacion detenida" "Se detuvo la instalacion. No se hicieron cambios. Al aceptar, se apagara el ordenador" mostrardialog "Instalacion detenida" "Se detuvo la instalacion. No se hicieron cambios. Al aceptar, reiniciara la instalacion"
poweroff;; exec ./selectlang.sh
;;
esac esac
fi;; fi;;
esac esac
@@ -253,7 +267,8 @@ 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
} }
function install { ### Base install of the system ###
function baseinstall {
clear clear
tput setaf 2 ; echo "$(T "Installing system, this can take about 10 minutes, wait")" ; tput setaf 9 tput setaf 2 ; echo "$(T "Installing system, this can take about 10 minutes, wait")" ; tput setaf 9
sleep 2 sleep 2
@@ -281,14 +296,13 @@ if [[ $isoffline = "0" ]];then
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
pacstrap -C /root/offlinefiles/pacman-offline.conf /mnt/ base btrfs-progs jkarch-mirrorlist pacstrap -C pacman-offline.conf /mnt/ base btrfs-progs jkarch-mirrorlist
mv pacman.conf /mnt/etc/pacman.conf.post #Move pacman.conf ("original online") to a chroot location
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
inchroot pacman -Syu jka-toolkit git wget netctl iw wpa_supplicant dialog sudo alsa-utils dosfstools ntfs-3g bash-completion --noconfirm --needed
#Create fstab #Create fstab
genfstab -U /mnt >> /mnt/etc/fstab 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
@@ -302,27 +316,331 @@ if [[ $swaptype ]];then
esac esac
fi fi
mkdir -p /mnt/root/inst/
if [[ $isoffline = 0 ]];then if [[ $isoffline = 0 ]];then
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/chrootinstall.sh -O /mnt/root/inst/chrootinstall.sh
isanetworkerror
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
else # Its offline
mv chrootinstall.sh /mnt/root/inst/chrootinstall.sh
cp -r /root/offlinefiles/ /mnt/run/archiso/ # Copy offline files
fi fi
chmod +x /mnt/root/inst/chrootinstall.sh
cp translations.sh /mnt/root/inst/translations.sh
mount --bind /sys /mnt/sys 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
if [[ $isoffline = 1 ]];then if [[ $isoffline = 1 ]];then
mount --bind /run/archiso/bootmnt/ /mnt/run/archiso/bootmnt/ mount --bind /run/archiso/bootmnt/ /mnt/run/archiso/bootmnt/ # CD bind
fi fi
chroot /mnt /bin/bash -c "./root/inst/chrootinstall.sh $sclang $particionraiz $partefi"
} }
function horaidioma {
#Idioma
while [[ $opclang == "" ]];do
varx="" #Empty var
langs=$(cat /mnt/etc/locale.gen | grep '^#[a-zA-Z]' | cut -f1 -d" " | cut -c2-30 | sort | uniq)
for addr in $(echo $langs | tr " " "\n")
do
varx+=" $addr $addr"
done
varf="dialog --stdout --nocancel --menu \"$(T "Select language for JKArch")\" 0 0 5 $varx"
opclang=`bash -c "$varf"`
varx="" #Empty varx
langabr=$(echo $opclang | cut -f1 -d"_")
langinst=$(cat /mnt/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")"`
case $opt in
2) opclang="";;
esac
done #End of selecting lang
sed -i "s/\#$langinst/$langinst/g" /mnt/etc/locale.gen
echo "LANG=$opclang" > /mnt/etc/locale.conf
echo "LANGUAGE=$opclang" >> /mnt/etc/locale.conf
echo "LC_COLLATE=$opclang" >> /mnt/etc/locale.conf
echo "KEYMAP=$langabr" > /mnt/etc/vconsole.conf
inchroot locale-gen
clear
echo "$(T "Now select your timezone for adjusting the clock")"
while [[ $NEW_TIMEZONE == "" ]];do
NEW_TIMEZONE=$(inchroot tzselect)
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
2) NEW_TIMEZONE="";;
esac
done
test -n "$NEW_TIMEZONE" && cp -fp /mnt/usr/share/zoneinfo/"$NEW_TIMEZONE" /mnt/etc/localtime
inchroot hwclock --systohc --utc
echo "$(T "Syncing hour to internet")";
inchroot pacman -S ntp --noconfirm
inchroot systemctl enable ntpd
if [[ $isoffline = 0 ]];then #Only sync if its online
inchroot ntpd -qg
inchroot hwclock -w
else
echo "Clock will not be okay until restart and configure manually because you dont have net"
fi
}
function userpass {
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/skel.tar.gz -C /mnt/
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/skel.tar.gz -O- | tar xJf - -C /mnt/
fi
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 "Ahora crearemos tu usuario \nNombre para tu usuario:" 10 50`
inchroot useradd -m -G wheel -s /bin/bash $nameuser
until [[ $pass1 = $pass2 && $pass1 != "" ]]
do
pass1=`dialog --stdout --insecure --passwordbox "$(T "Password for ") . $nameuser" 9 50`
pass2=`dialog --stdout --insecure --passwordbox "$(T "Repeat password")" 9 50`
if ! [[ $pass1 = $pass2 && $pass1 != "" ]];then
mostrardialog "$(T "Password")" "$(T "Passwords do not match")"
fi
done
echo "${nameuser}:${pass1}" | inchroot chpasswd
pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione
#Añadir soporte sudo para este nuevo usuario
sed -i "s/\# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" /mnt/etc/sudoers
#Modificar gksu si lleva una sesion grafica
if [[ $optentorno != "6" ]];then
inchroot gconftool-2 --set /apps/gksu/sudo-mode --type=bool true --owner=$(echo $nameuser)
fi
}
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)"`
case $optgrafica in
1) inchroot pacman -S xf86-video-nouveau xf86-video-nv libva-vdpau-driver mesa-vdpau --noconfirm;;
2) inchroot pacman -S xf86-video-ati xf86-video-amdgpu libva-mesa-driver libva-vdpau-driver mesa-vdpau --noconfirm;;
3) inchroot pacman -S xf86-video-intel libva-intel-driver libvdpau-va-gl --noconfirm;;
4) inchroot pacman -S xf86-video-openchrome --noconfirm;;
5) inchroot pacman -S virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm;;
6) inchroot pacman -S xf86-video-vmware xf86-input-vmmouse open-vm-tools --noconfirm;;
7) inchroot pacman -S $(inchroot pacman -Ssq xf86-video-*) --noconfirm;;
esac
#Instalar siempre la estandar, por se acaso
inchroot pacman -S xf86-video-vesa mesa-libgl --noconfirm
}
function programasguiuser {
clear
#Seleccion de programas predeterminados
opt1="1 6"
opt2="1 5"
opt3="1"
opt5="1"
opt6="1 2"
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, opcion rapida (No recomendado)"`
case $tipoinstall in
1)
until [[ $surep -eq 1 ]]
do
optprogramas=`dialog --stdout --nocancel --scrollbar --menu "Categorías" 0 0 9 1 "Navegadores web ($(echo $opt1 | wc -w) seleccionados)" 2 "Editores de texto y Office ($(echo $opt2 | wc -w) seleccionados)" 3 "Audio y Video ($(echo $opt3 | wc -w) seleccionados)" 4 "Imagen ($(echo $opt4 | wc -w) seleccionado)" 5 "Fuentes/Tipos de letra ($(echo $opt5 | wc -w) seleccionado)" 6 "Visores ($(echo $opt6 | wc -w) seleccionado)" 7 "Soportes (Impresoras,Bluetooth...) ($(echo $opt7 | wc -w) seleccionado)" 8 "Utilidades varias ($(echo $opt8 | wc -w) seleccionado)" I "Instalar"`
#Menu con cada una de las categorias
case $optprogramas in
# La variable optstate "$optX" Y es una funcion que devuelve on o off, para mostrar la ultima seleccion bien
1) opt1=`dialog --stdout --checklist "Navegadores web" 0 0 6 1 "Firefox" $(optstate "$opt1" 1) 2 "Chrome" $(optstate "$opt1" 2) 3 "Chromium" $(optstate "$opt1" 3) 4 "Opera" $(optstate "$opt1" 4) 5 "Otter Browser" $(optstate "$opt1" 5) 6 "Soporte Flash Player" $(optstate "$opt1" 6)`;;
2) opt2=`dialog --stdout --scrollbar --checklist "Editores de texto y Office" 0 0 7 1 "Libreoffice (Recomendado)" $(optstate "$opt2" 1) 2 "AbiWord" $(optstate "$opt2" 2) 3 "Gnumeric" $(optstate "$opt2" 3) 4 "WPS Office" $(optstate "$opt2" 4) 5 "leafpad (Bloc de notas)" $(optstate "$opt2" 5) 6 "gedit" $(optstate "$opt2" 6) 7 "notepadqq" $(optstate "$opt2" 7)`;;
3) opt3=`dialog --stdout --checklist "Audio y Video" 0 0 6 1 "VLC (Recomendado)" $(optstate "$opt3" 1) 2 "SMPlayer" $(optstate "$opt3" 2) 3 "Totem" $(optstate "$opt3" 3) 4 "Clementine" $(optstate "$opt3" 4) 5 "Banshee" $(optstate "$opt3" 5)`;;
4) opt4=`dialog --stdout --checklist "Imagen" 0 0 6 1 "GIMP" $(optstate "$opt4" 1) 2 "Inkscape" $(optstate "$opt4" 2) 3 "Pinta" $(optstate "$opt4" 3) 4 "Krita (Dibujo)" $(optstate "$opt4" 4)`;;
5) opt5=`dialog --stdout --checklist "Fuentes/Tipos de letra" 0 0 6 1 "noto-fonts (Muy recomendado)" $(optstate "$opt5" 1) 2 "Microsoft Fonts" $(optstate "$opt5" 2) 3 "Recopilatorio de fuentes de Google (mas de 300)" $(optstate "$opt5" 3)`;;
6) opt6=`dialog --stdout --checklist "Recomendado pulsar todos \nVisores" 0 0 6 1 "Evince (PDF)" $(optstate "$opt6" 1) 2 "Ristretto (imagenes como jpg,png...)" $(optstate "$opt6" 2)`;;
7) opt7=`dialog --stdout --checklist "Soportes (Impresoras,Bluetooth...)" 0 0 6 1 "CUPS (Soporte impresoras)" $(optstate "$opt7" 1) 2 "HPLIP (Soporte impresoras HP)" $(optstate "$opt7" 2) 3 "Bluetooth" $(optstate "$opt7" 3)`;;
8) opt8=`dialog --stdout --scrollbar --checklist "Utilidades varias" 0 0 8 1 "Dropbox" $(optstate "$opt8" 1) 2 "MEGA" $(optstate "$opt8" 2) 3 "Visor de correo Evolution" $(optstate "$opt8" 3) 4 "Grabador de discos (k3b)" $(optstate "$opt8" 4) 5 "Java (jre8)" $(optstate "$opt8" 5) 6 "Wine ('Emulador' de programas de Windows)" $(optstate "$opt8" 6) 7 "BleachBit (Limpiador de disco duro)" $(optstate "$opt8" 7)`;;
9) opt9=`dialog --stdout --scrollbar --checklist "Programacion" 0 0 8 1 "Sublime Text 3" $(optstate "$opt9" 1) 2 "Sublime Text 2" $(optstate "$opt9" 2) 3 "Visual Studio Code" $(optstate "$opt9" 3) 4 "Eclipse" $(optstate "$opt9" 4) 5 "Monodevelop" $(optstate "$opt9" 5) 6 "Brackets" $(optstate "$opt9" 6) 7 "Atom" $(optstate "$opt9" 7) 8 "Gamedevelop" $(optstate "$opt9" 8) 9 "Poedit (gettext)" $(optstate "$opt9" 9) A "Arduino IDE" $(optstate "$opt9" A)`;;
"I")
#Instalar
surep=1
break;;
esac
done
;;
2) mostrardialog "Programas predeterminados" "Ahora se van a instalar los programas predeterminados, espere"
esac
packages="" #Erase var before
case $opt1 in
*1*) packages="firefox";;&
*2*) packages="$packages google-chrome";;&
*3*) packages="$packages chromium";;&
*4*) packages="$packages opera";;&
*5*) packages="$packages otter-browser";;&
*6*) packages="$packages flashplugin";;&
esac
case $opt2 in
*1*) packages="$packages libreoffice-fresh";;&
*2*) packages="$packages abiword";;&
*3*) packages="$packages gnumeric";;&
*4*) packages="$packages wps-office";;&
*5*) packages="$packages leafpad";;&
*6*) packages="$packages gedit";;&
*7*) packages="$packages notepadqq";;&
esac
case $opt3 in
*1*) packages="$packages vlc qt4";;&
*2*) packages="$packages smplayer";;&
*3*) packages="$packages totem";;&
*4*) packages="$packages clementine";;&
*5*) packages="$packages banshee";;&
esac
case $opt4 in
*1*) packages="$packages gimp";;&
*2*) packages="$packages inkscape";;&
*3*) packages="$packages pinta";;&
*4*) packages="$packages krita";;&
esac
case $opt5 in
*1*) packages="$packages noto-fonts";;&
*2*) packages="$packages ttf-ms-fonts";;&
*3*) packages="$packages ttf-google-fonts-git";;&
esac
case $opt6 in
*1*) packages="$packages evince";;&
*2*) packages="$packages ristretto librsvg";;&
esac
case $opt7 in
*1*) packages="$packages cups cups-filters";;&
*2*) packages="$packages hplip";;&
*3*) packages="$packages bluez bluez-utils bluez-cups bluez-firmware bluez-libs blueberry";;&
esac
case $opt8 in
*1*) packages="$packages dropbox";;&
*2*) packages="$packages megasync";;&
*3*) packages="$packages geary";;&
*4*) packages="$packages k3b";;&
*5*) packages="$packages jre8-openjdk";;&
*6*) packages="$packages wine-staging wine_gecko winetricks"
packages="$packages lib32-libpng lib32-libldap lib32-gnutls lib32-mpg123 lib32-libpulse lib32-ncurses lib32-openal lib32-alsa-lib" #Some 32bit libs for winearch 32 work better
inswine=1;;&
*7*) packages="$packages bleachbit";;&
esac
case $opt9 in
*1*) packages="$packages sublime-text-dev";;&
*2*) packages="$packages sublime-text";;&
*3*) packages="$packages visual-studio-code";;&
*4*) packages="$packages jdk8-openjdk eclipse-java";;&
*5*) packages="$packages monodevelop";;&
*6*) packages="$packages brackets";;&
*7*) packages="$packages atom-editor-bin";;&
*8*) packages="$packages gdevelop";;&
*9*) packages="$packages poedit";;&
*A*) packages="$packages arduino";;&
esac
inchroot pacman -S $packages --noconfirm --needed
if [[ $inswine = 1 ]];then
echo "$(T "Configuring wine for better experience") (32 bit winearch)"
inchroot su $nameuser -c "WINEARCH=win32 wineboot -u"
fi
packages=""
}
function baseconX {
tput setaf 2 ;echo "$(T "Installing desktop and basic programs, please wait")" ; tput setaf 9
sleep 2
inchroot pacman -S xorg-server xorg-xinit xorg-server-common xf86-input-libinput lightdm lightdm-gtk-greeter gvfs gvfs-mtp gvfs-smb udisks networkmanager network-manager-applet gnome-keyring xdialog --noconfirm
inchroot pacman -S lxterminal ttf-inconsolata file-roller --noconfirm
#Instalar pulseaudio si tiene entorno grafico, sino es tonteria
inchroot pacman -S pulseaudio pavucontrol --noconfirm
echo "Instalando octopi, gestor visual de actualizaciones y paquetes"
inchroot pacman -S octopi octopi-notifier gksu --noconfirm
inchroot pacman -S xdg-user-dirs --noconfirm
inchroot xdg-user-dirs-update
#Gestor de energia
inchroot pacman -S xfce4-power-manager --noconfirm
#Habilitamos ciertos servicios
inchroot systemctl enable lightdm
inchroot systemctl enable NetworkManager
#Parte visual
inchroot pacman -S jkarch-appearance --noconfirm
clear
}
function keyboardlayout {
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 "# 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 ' 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 ' Option "XkbLayout" "'$langabr'"' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
echo 'EndSection' >> /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
}
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"`
case $optentorno in
1)
baseconX
inchroot pacman -S lxappearance lxappearance-obconf lxde-common lxinput lxpanel lxrandr lxsession lxtask lxterminal openbox pcmanfm xfce4-notifyd --noconfirm
inchroot pacman -S gtk-engine-aurora faenza-icon-theme --noconfirm
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/LXDE.tar.xz -C /mnt/
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/LXDE.tar.xz -O- | tar xJf - -C /mnt/
fi
;;
2)
baseconX
inchroot pacman -S xfce4 --noconfirm
inchroot pacman -S faenza-icon-theme --noconfirm
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf mods/XFCE4.tar.xz -C /mnt/
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/XFCE4.tar.xz -O- | tar xJf - -C /mnt/
fi
;;
3)
baseconX
inchroot pacman -S cinnamon --noconfirm
;;
4)
optgnome=`dialog --stdout --nocancel --menu "¿Gnome base o gnome con sus extras?" 0 0 5 1 "Gnome base" 2 "Gnome+extras"`
baseconX
case $optgnome in
1) inchroot pacman -S gnome --noconfirm;;
2) inchroot pacman -S gnome gnome-extra --noconfirm;;
esac
inchroot pacman -R gdm --noconfirm
;;
5)
optmate=`dialog --stdout --nocancel --menu "¿MATE base o MATE con sus extras?" 0 0 5 1 "MATE base" 2 "MATE+extras"`
baseconX
case $optmate in
1) inchroot pacman -S mate --noconfirm;;
2) inchroot pacman -S mate mate-extra --noconfirm;;
esac
;;
6)
baseconX
inchroot pacman -S plasma --noconfirm
inchroot pacman -R plasma-mediacenter ksshaskpass --noconfirm
;;
esac
if [[ $optentorno != "7" ]];then
graficos
#Poner el teclado bien en x11
keyboardlayout
#Aqui va la personalizacion de programas, ya que son graficos.
programasguiuser
fi
}
clear clear
mostrardialog "$(T "JKArch install script")" "$(T "Intro arch install script")" mostrardialog "$(T "JKArch install script")" "$(T "Intro arch install script")"
mostrardialog "JKArch" "El script esta en estado beta y se esta actualizando casi constantemente. Puede haber fallos importantes. En caso de fallo, vuelva a probar en unas horas" mostrardialog "JKArch" "El script esta en estado beta y se esta actualizando casi constantemente. Puede haber fallos importantes. En caso de fallo, vuelva a probar en unas horas"
@@ -370,8 +688,31 @@ if [[ $partefi ]];then
fi fi
tput setaf 1 ; echo "$(T "If you agree with that, press enter. If not, turn off the computer")" ; tput setaf 9 tput setaf 1 ; echo "$(T "If you agree with that, press enter. If not, turn off the computer")" ; tput setaf 9
pause pause
install baseinstall
horaidioma #Configure hour/timezone
echo "JKArch" > /mnt/etc/hostname
#Configuraciones varias, en entorno se instala el entorno y programas del usuario
entorno
mkinitcpio -p linux #Hacemos el mkinitcpio después de tener instalados los gráficos
#Ahora, se crea el usuario y se añaden los ficheros de configuracion de skel
userpass
bootinstall
otrasconfig
echo "$(T "Last tweaks and cleaning")"
inchroot systemctl enable dhcpcd
inchroot pacman -Sc --noconfirm
echo "Sincronizando datos al disco duro, puede tardar unos segundos"
sync
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
fi
clear clear
mostrardialog "$(T "End")" "$(T "Setup finished, press enter to reboot.")" mostrardialog "$(T "End")" "$(T "Setup finished, press enter to reboot.")"
rm -rf /mnt/root/inst
reboot reboot

View File

@@ -1,477 +0,0 @@
#!/bin/bash
cd /root/inst
#Fix para caracteres de dialog, ñ o tildes
export NCURSES_NO_UTF8_ACS=1
#Este script corre en el chroot para configurar todo
particionraiz=$2
partefi=$3
sclang=$1
source translations.sh
argpart=$(echo $particionraiz | cut -c1-3)
if [[ -f /etc/pacman.conf.post ]];then # Is an offline installation?
isoffline=1
else
isoffline=0
fi
#Try to disable ctrl+C
trap '' INT
function pause {
echo "$(T "Press enter to continue...")"
read
}
function mostrardialog {
local titled
local msgd
titled=$1
msgd=$2
dialog --title "$titled" --msgbox "$msgd" 15 60
}
function fatalerror {
razon=$1
mostrardialog "Error" "$(T "An error has ocurred, setup will be stopped") $razon"
exit
}
function optstate {
if [[ $1 =~ "$2" ]];then
echo "on"
else
echo "off"
fi
}
function horaidioma {
#Idioma
while [[ $opclang == "" ]];do
langs=$(cat /etc/locale.gen | grep '^#[a-zA-Z]' | cut -f1 -d" " | cut -c2-30 | sort | uniq)
for addr in $(echo $langs | tr " " "\n")
do
varx+=" $addr $addr"
done
varf="dialog --stdout --nocancel --menu \"$(T "Select language for JKArch")\" 0 0 5 $varx"
opclang=`bash -c "$varf"`
varx="" #Empty varx
langabr=$(echo $opclang | cut -f1 -d"_")
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")"`
case $opt in
2) opclang="";;
esac
done #End of selecting lang
sed -i "s/\#$langinst/$langinst/g" /etc/locale.gen
echo "LANG=$opclang" > /etc/locale.conf
echo "LANGUAGE=$opclang" >> /etc/locale.conf
echo "LC_COLLATE=$opclang" >> /etc/locale.conf
echo "KEYMAP=$langabr" > /etc/vconsole.conf
locale-gen
clear
echo "$(T "Now select your timezone for adjusting the clock")"
while [[ $NEW_TIMEZONE == "" ]];do
NEW_TIMEZONE=$(tzselect)
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
2) NEW_TIMEZONE="";;
esac
done
test -n "$NEW_TIMEZONE" && cp -fp /usr/share/zoneinfo/"$NEW_TIMEZONE" /etc/localtime
hwclock --systohc --utc
echo "$(T "Syncing hour to internet")";
pacman -S ntp --noconfirm
systemctl enable ntpd
if [[ $isoffline = 0 ]];then
ntpd -qg
hwclock -w
else
echo "Clock will not be okay until restart and configure manually because you dont have net"
fi
}
function userpass {
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf /run/archiso/offlinefiles/mods/skel.tar.gz -C /
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/skel.tar.gz -O- | tar xJf - -C /
fi
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 "Ahora crearemos tu usuario \nNombre para tu usuario:" 10 50`
useradd -m -G wheel -s /bin/bash $nameuser
until [[ $pass1 = $pass2 && $pass1 != "" ]]
do
pass1=`dialog --stdout --insecure --passwordbox "$(T "Password for ") . $nameuser" 9 50`
pass2=`dialog --stdout --insecure --passwordbox "$(T "Repeat password")" 9 50`
if ! [[ $pass1 = $pass2 && $pass1 != "" ]];then
mostrardialog "$(T "Password")" "$(T "Passwords do not match")"
fi
done
echo "${nameuser}:${pass1}" | chpasswd
pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione
#Añadir soporte sudo para este nuevo usuario
sed -i "s/\# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" /etc/sudoers
#Modificar gksu si lleva una sesion grafica
if [[ $optentorno != "6" ]];then
gconftool-2 --set /apps/gksu/sudo-mode --type=bool true --owner=$(echo $nameuser)
fi
}
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)"`
case $optgrafica in
1) pacman -S xf86-video-nouveau xf86-video-nv libva-vdpau-driver mesa-vdpau --noconfirm;;
2) pacman -S xf86-video-ati xf86-video-amdgpu libva-mesa-driver libva-vdpau-driver mesa-vdpau --noconfirm;;
3) pacman -S xf86-video-intel libva-intel-driver libvdpau-va-gl --noconfirm;;
4) pacman -S xf86-video-openchrome --noconfirm;;
5) pacman -S virtualbox-guest-utils virtualbox-guest-modules-arch --noconfirm;;
6) pacman -S xf86-video-vmware xf86-input-vmmouse open-vm-tools --noconfirm;;
7) pacman -S $(pacman -Ssq xf86-video-*) --noconfirm;;
esac
#Instalar siempre la estandar, por se acaso
pacman -S xf86-video-vesa mesa-libgl --noconfirm
}
function programasguiuser {
clear
#Seleccion de programas predeterminados
opt1="1 6"
opt2="1 5"
opt3="1"
opt5="1"
opt6="1 2"
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, opcion rapida (No recomendado)"`
case $tipoinstall in
1)
until [[ $surep -eq 1 ]]
do
optprogramas=`dialog --stdout --nocancel --scrollbar --menu "Categorías" 0 0 9 1 "Navegadores web ($(echo $opt1 | wc -w) seleccionados)" 2 "Editores de texto y Office ($(echo $opt2 | wc -w) seleccionados)" 3 "Audio y Video ($(echo $opt3 | wc -w) seleccionados)" 4 "Imagen ($(echo $opt4 | wc -w) seleccionado)" 5 "Fuentes/Tipos de letra ($(echo $opt5 | wc -w) seleccionado)" 6 "Visores ($(echo $opt6 | wc -w) seleccionado)" 7 "Soportes (Impresoras,Bluetooth...) ($(echo $opt7 | wc -w) seleccionado)" 8 "Utilidades varias ($(echo $opt8 | wc -w) seleccionado)" I "Instalar"`
#Menu con cada una de las categorias
case $optprogramas in
# La variable optstate "$optX" Y es una funcion que devuelve on o off, para mostrar la ultima seleccion bien
1) opt1=`dialog --stdout --checklist "Navegadores web" 0 0 6 1 "Firefox" $(optstate "$opt1" 1) 2 "Chrome" $(optstate "$opt1" 2) 3 "Chromium" $(optstate "$opt1" 3) 4 "Opera" $(optstate "$opt1" 4) 5 "Otter Browser" $(optstate "$opt1" 5) 6 "Soporte Flash Player" $(optstate "$opt1" 6)`;;
2) opt2=`dialog --stdout --scrollbar --checklist "Editores de texto y Office" 0 0 7 1 "Libreoffice (Recomendado)" $(optstate "$opt2" 1) 2 "AbiWord" $(optstate "$opt2" 2) 3 "Gnumeric" $(optstate "$opt2" 3) 4 "WPS Office" $(optstate "$opt2" 4) 5 "leafpad (Bloc de notas)" $(optstate "$opt2" 5) 6 "gedit" $(optstate "$opt2" 6) 7 "notepadqq" $(optstate "$opt2" 7)`;;
3) opt3=`dialog --stdout --checklist "Audio y Video" 0 0 6 1 "VLC (Recomendado)" $(optstate "$opt3" 1) 2 "SMPlayer" $(optstate "$opt3" 2) 3 "Totem" $(optstate "$opt3" 3) 4 "Clementine" $(optstate "$opt3" 4) 5 "Banshee" $(optstate "$opt3" 5)`;;
4) opt4=`dialog --stdout --checklist "Imagen" 0 0 6 1 "GIMP" $(optstate "$opt4" 1) 2 "Inkscape" $(optstate "$opt4" 2) 3 "Pinta" $(optstate "$opt4" 3) 4 "Krita (Dibujo)" $(optstate "$opt4" 4)`;;
5) opt5=`dialog --stdout --checklist "Fuentes/Tipos de letra" 0 0 6 1 "noto-fonts (Muy recomendado)" $(optstate "$opt5" 1) 2 "Microsoft Fonts" $(optstate "$opt5" 2) 3 "Recopilatorio de fuentes de Google (mas de 300)" $(optstate "$opt5" 3)`;;
6) opt6=`dialog --stdout --checklist "Recomendado pulsar todos \nVisores" 0 0 6 1 "Evince (PDF)" $(optstate "$opt6" 1) 2 "Ristretto (imagenes como jpg,png...)" $(optstate "$opt6" 2)`;;
7) opt7=`dialog --stdout --checklist "Soportes (Impresoras,Bluetooth...)" 0 0 6 1 "CUPS (Soporte impresoras)" $(optstate "$opt7" 1) 2 "HPLIP (Soporte impresoras HP)" $(optstate "$opt7" 2) 3 "Bluetooth" $(optstate "$opt7" 3)`;;
8) opt8=`dialog --stdout --scrollbar --checklist "Utilidades varias" 0 0 8 1 "Dropbox" $(optstate "$opt8" 1) 2 "MEGA" $(optstate "$opt8" 2) 3 "Visor de correo Evolution" $(optstate "$opt8" 3) 4 "Grabador de discos (k3b)" $(optstate "$opt8" 4) 5 "Java (jre8)" $(optstate "$opt8" 5) 6 "Wine ('Emulador' de programas de Windows)" $(optstate "$opt8" 6) 7 "BleachBit (Limpiador de disco duro)" $(optstate "$opt8" 7)`;;
9) opt9=`dialog --stdout --scrollbar --checklist "Programacion" 0 0 8 1 "Sublime Text 3" $(optstate "$opt9" 1) 2 "Sublime Text 2" $(optstate "$opt9" 2) 3 "Visual Studio Code" $(optstate "$opt9" 3) 4 "Eclipse" $(optstate "$opt9" 4) 5 "Monodevelop" $(optstate "$opt9" 5) 6 "Brackets" $(optstate "$opt9" 6) 7 "Atom" $(optstate "$opt9" 7) 8 "Gamedevelop" $(optstate "$opt9" 8) 9 "Poedit (gettext)" $(optstate "$opt9" 9) A "Arduino IDE" $(optstate "$opt9" A)`;;
"I")
#Instalar
surep=1
break;;
esac
done
;;
2) mostrardialog "Programas predeterminados" "Ahora se van a instalar los programas predeterminados, espere"
esac
case $opt1 in
*1*) packages="firefox";;&
*2*) packages="$packages google-chrome";;&
*3*) packages="$packages chromium";;&
*4*) packages="$packages opera";;&
*5*) packages="$packages otter-browser";;&
*6*) packages="$packages flashplugin";;&
esac
case $opt2 in
*1*) packages="$packages libreoffice-fresh";;&
*2*) packages="$packages abiword";;&
*3*) packages="$packages gnumeric";;&
*4*) packages="$packages wps-office";;&
*5*) packages="$packages leafpad";;&
*6*) packages="$packages gedit";;&
*7*) packages="$packages notepadqq";;&
esac
case $opt3 in
*1*) packages="$packages vlc qt4";;&
*2*) packages="$packages smplayer";;&
*3*) packages="$packages totem";;&
*4*) packages="$packages clementine";;&
*5*) packages="$packages banshee";;&
esac
case $opt4 in
*1*) packages="$packages gimp";;&
*2*) packages="$packages inkscape";;&
*3*) packages="$packages pinta";;&
*4*) packages="$packages krita";;&
esac
case $opt5 in
*1*) packages="$packages noto-fonts";;&
*2*) packages="$packages ttf-ms-fonts";;&
*3*) packages="$packages ttf-google-fonts-git";;&
esac
case $opt6 in
*1*) packages="$packages evince";;&
*2*) packages="$packages ristretto librsvg";;&
esac
case $opt7 in
*1*) packages="$packages cups cups-filters";;&
*2*) packages="$packages hplip";;&
*3*) packages="$packages bluez bluez-utils bluez-cups bluez-firmware bluez-libs blueberry";;&
esac
case $opt8 in
*1*) packages="$packages dropbox";;&
*2*) packages="$packages megasync";;&
*3*) packages="$packages geary";;&
*4*) packages="$packages k3b";;&
*5*) packages="$packages jre8-openjdk";;&
*6*) packages="$packages wine-staging wine_gecko winetricks"
packages="$packages lib32-libpng lib32-libldap lib32-gnutls lib32-mpg123 lib32-libpulse lib32-ncurses lib32-openal lib32-alsa-lib" #Some 32bit libs for winearch 32 work better
inswine=1;;&
*7*) packages="$packages bleachbit";;&
esac
case $opt9 in
*1*) packages="$packages sublime-text-dev";;&
*2*) packages="$packages sublime-text";;&
*3*) packages="$packages visual-studio-code";;&
*4*) packages="$packages jdk8-openjdk eclipse-java";;&
*5*) packages="$packages monodevelop";;&
*6*) packages="$packages brackets";;&
*7*) packages="$packages atom-editor-bin";;&
*8*) packages="$packages gdevelop";;&
*9*) packages="$packages poedit";;&
*A*) packages="$packages arduino";;&
esac
pacman -S $packages --noconfirm --needed
if [[ $inswine = 1 ]];then
echo "$(T "Configuring wine for better experience") (32 bit winearch)"
su $nameuser -c "WINEARCH=win32 wineboot -u"
fi
packages=""
}
function baseconX {
tput setaf 2 ;echo "$(T "Installing desktop and basic programs, please wait")" ; tput setaf 9
sleep 2
pacman -S xorg-server xorg-xinit xorg-server-common xf86-input-libinput lightdm lightdm-gtk-greeter gvfs gvfs-mtp gvfs-smb udisks networkmanager network-manager-applet gnome-keyring xdialog --noconfirm
pacman -S lxterminal ttf-inconsolata file-roller --noconfirm
#Instalar pulseaudio si tiene entorno grafico, sino es tonteria
pacman -S pulseaudio pavucontrol --noconfirm
echo "Instalando octopi, gestor visual de actualizaciones y paquetes"
pacman -S octopi octopi-notifier gksu --noconfirm
pacman -S xdg-user-dirs --noconfirm
xdg-user-dirs-update
#Gestor de energia
pacman -S xfce4-power-manager --noconfirm
#Habilitamos ciertos servicios
systemctl enable lightdm
systemctl enable NetworkManager
#Parte visual
pacman -S jkarch-appearance --noconfirm
clear
}
function keyboardlayout {
echo "KEYMAP=$langabr" > /etc/vconsole.conf
echo "# Read and parsed by systemd-localed. It's probably wise not to edit this file" > /etc/X11/xorg.conf.d/00-keyboard.conf
echo "# manually too freely." >> /etc/X11/xorg.conf.d/00-keyboard.conf
echo 'Section "InputClass"' >> /etc/X11/xorg.conf.d/00-keyboard.conf
echo ' Identifier "system-keyboard"' >> /etc/X11/xorg.conf.d/00-keyboard.conf
echo ' MatchIsKeyboard "on"' >> /etc/X11/xorg.conf.d/00-keyboard.conf
echo ' Option "XkbLayout" "'$langabr'"' >> /etc/X11/xorg.conf.d/00-keyboard.conf
echo 'EndSection' >> /etc/X11/xorg.conf.d/00-keyboard.conf
}
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"`
case $optentorno in
1)
baseconX
pacman -S lxappearance lxappearance-obconf lxde-common lxinput lxpanel lxrandr lxsession lxtask lxterminal openbox pcmanfm xfce4-notifyd --noconfirm
pacman -S gtk-engine-aurora faenza-icon-theme --noconfirm
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf /run/archiso/offlinefiles/mods/LXDE.tar.xz -C /
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/LXDE.tar.xz -O- | tar xJf - -C /
fi
;;
2)
baseconX
pacman -S xfce4 --noconfirm
pacman -S faenza-icon-theme --noconfirm
if [[ $isoffline = 1 ]];then # Is an offline installation?
tar xJf /run/archiso/offlinefiles/mods/XFCE4.tar.xz -C /
else #online
wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/mods/XFCE4.tar.xz -O- | tar xJf - -C /
fi
;;
3)
baseconX
pacman -S cinnamon --noconfirm
;;
4)
optgnome=`dialog --stdout --nocancel --menu "¿Gnome base o gnome con sus extras?" 0 0 5 1 "Gnome base" 2 "Gnome+extras"`
baseconX
case $optgnome in
1)
pacman -S gnome --noconfirm;;
2)
pacman -S gnome gnome-extra --noconfirm;;
esac
pacman -R gdm --noconfirm
;;
5)
optmate=`dialog --stdout --nocancel --menu "¿MATE base o MATE con sus extras?" 0 0 5 1 "MATE base" 2 "MATE+extras"`
baseconX
case $optmate in
1)
pacman -S mate --noconfirm;;
2)
pacman -S mate mate-extra --noconfirm;;
esac
;;
6)
baseconX
pacman -S plasma --noconfirm
pacman -R plasma-mediacenter ksshaskpass --noconfirm
;;
esac
if [[ $optentorno != "7" ]];then
graficos
#Poner el teclado bien en x11
keyboardlayout
#Aqui va la personalizacion de programas, ya que son graficos.
programasguiuser
fi
}
function otrasconfig {
mostrardialog "$(T "Other configs")" "Aquí puedes seleccionar otras configuraciones que puedes hacer a Arch antes de terminar la instalacion, como su nombre"
# Loop infinito en otras configuraciones hasta que se pulse la de terminar
for (( ; ; ))
do
othopt=`dialog --stdout --nocancel --menu "$(T "Other configs")" 0 0 8 e "Nada mas / Finalizar instalacion" 1 "Cambiar hostname (Nombre pc)" 2 "Usar otra distribucion de teclado como principal" 3 "Cambiar contraseña de root" 4 "Habilitar AUR (con yaourt)"`
if [[ $othopt = "e" ]];then
break
else
case $othopt in
1)
echo ""
nam=`dialog --stdout --inputbox "Nombre para el ordenador" 9 50`
echo $nam > /etc/hostname
;;
2)
echo "Escoja su idioma para la distribucion del teclado"
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
#Cambiar el layout del teclado por el nuevo
keyboardlayout
;;
3)
until [[ $pass1 = $pass2 && $pass1 != "" ]]
do
pass1=`dialog --stdout --insecure --passwordbox "$(T "Password for ") . root" 9 50`
pass2=`dialog --stdout --insecure --passwordbox "$(T "Repeat password")" 9 50`
if ! [[ $pass1 = $pass2 && $pass1 != "" ]];then
mostrardialog "$(T "Password")" "$(T "Passwords do not match")"
fi
done
echo "root:${pass1}" | chpasswd
pass1="" #Reiniciar pass1, por si hace falta de nuevo que el until funcione
;;
4) pacman -S yaourt base-devel --noconfirm --needed;;
esac
fi
done
}
function bootinstall {
if [[ -z $partefi ]];then
#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"`
case $optboot in
1)
pacman -S grub os-prober --noconfirm
#Arranque silencioso
sed -i 's/\GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 vga=current"/g' /etc/default/grub
echo "Instalando GRUB para BIOS/MBR"
grub-install --target=i386-pc /dev/$argpart
grub-mkconfig -o /boot/grub/grub.cfg
;;
2)
#No hará nada
echo "$(T "No new bootloader installed")"
;;
esac
else
#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"`
case $optboot in
1)
echo "Instalando rEFInd para UEFI"
pacman -S efibootmgr dosfstools refind-efi --noconfirm
refind-install
rootuuid=$(blkid -o value -s UUID /dev/$(echo $particionraiz))
echo '"Boot with standard options" "root=UUID='$(echo $rootuuid)' rw add_efi_memmap quiet loglevel=3 vga=current"' > /boot/refind_linux.conf
echo "Boot in nomodeset mode" "root=UUID='$(echo $rootuuid)' rw add_efi_memmap quiet loglevel=3 vga=current nomodeset" >> /boot/refind_linux.conf
echo "Boot to single-user mode" "root=UUID='$(echo $rootuuid)' rw add_efi_memmap quiet single" >> /boot/refind_linux.conf
echo "Boot with minimal options" "root=UUID='$(echo $rootuuid)' rw add_efi_memmap" >> /boot/refind_linux.conf
;;
2)
echo "Instalando GRUB en modo UEFI, puede fallar"
pacman -S grub os-prober --noconfirm
sed -i 's/\GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 vga=current"/g' /etc/default/grub
pacman -S 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
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"
;;
3)
#No hará nada
echo "$(T "No new bootloader installed")"
;;
esac
fi
}
echo "$(T "System configuration")"
echo "$(T "Basic setup packages, this can take a minute")"
pacman -Syu jka-toolkit git wget netctl iw wpa_supplicant dialog sudo alsa-utils dosfstools ntfs-3g bash-completion --noconfirm --needed
horaidioma
echo "JKArch" > /etc/hostname
#Configuraciones varias, en entorno se instala el entorno y programas del usuario
entorno
mkinitcpio -p linux #Hacemos el mkinitcpio después de tener instalados los gráficos
#Ahora, se crea el usuario y se añaden los ficheros de configuracion de skel
userpass
bootinstall
otrasconfig
echo "$(T "Last tweaks and cleaning")"
systemctl enable dhcpcd
pacman -Sc --noconfirm
echo "Sincronizando datos al disco duro, puede tardar unos segundos"
sync
if [[ $isoffline = 1 ]];then # Is an offline installation?
echo "Configurando pacman para usar servidores web en los siguientes arranques..."
mv -f /etc/pacman.conf.post /etc/pacman.conf
fi