From 5ccbca376593901743d8c840675be24625f9276c Mon Sep 17 00:00:00 2001 From: kprkpr Date: Wed, 21 Sep 2016 22:56:47 +0200 Subject: [PATCH] creating offline installation posible 1/3 --- archinstall/archinstall.sh | 45 ++++++++++++++++++++++++++---------- archinstall/chrootinstall.sh | 14 +++++++++++ archinstall/translations.sh | 5 ++++ 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/archinstall/archinstall.sh b/archinstall/archinstall.sh index 7005185..cb2cba1 100755 --- a/archinstall/archinstall.sh +++ b/archinstall/archinstall.sh @@ -2,6 +2,14 @@ ## 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 @@ -27,6 +35,11 @@ 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 particiones { clear @@ -274,15 +287,21 @@ if [[ $partefi ]];then mkdir -p /mnt/boot/efi mount /dev/$partefi /mnt/boot/efi/ fi - -wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/pacman.conf -O /tmp/pacman.conf -if [[ $? != 0 ]];then -fatalerror "$(T "Network connection error, please check it")" +if [[ $isoffline = "0" ]];then + wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/pacman.conf -O /tmp/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 /tmp/pacman.conf /mnt/ base btrfs-progs jkarch-mirrorlist fi -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 /tmp/pacman.conf /mnt/ base btrfs-progs jkarch-mirrorlist +if [[ $isoffline = "1" ]];then + tput setaf 2 ; echo "$(T "Installing packages")..." ; tput setaf 9 + pacstrap -C /root/pacmanoffline.conf /mnt/ base btrfs-progs jkarch-mirrorlist + mv /root/pacman.conf /mnt/etc/pacman.conf.post #Move pacman.conf to a chroot location +fi + + #Create fstab genfstab -U /mnt >> /mnt/etc/fstab #Create or activate swap if neccesary @@ -299,12 +318,14 @@ if [[ $swaptype ]];then fi mkdir -p /mnt/root/inst/ -wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/archinstall/chrootinstall.sh -O /mnt/root/inst/chrootinstall.sh -if [[ $? != 0 ]];then -fatalerror "$(T "Network connection error, please check it")" +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/ +else # Its offline + mv /root/chrootinstall.sh /mnt/root/inst/chrootinstall.sh fi chmod +x /mnt/root/inst/chrootinstall.sh -cp -r /etc/netctl/* /mnt/etc/netctl/ cp /root/translations.sh /mnt/root/inst/translations.sh arch-chroot /mnt /bin/bash -c "./root/inst/chrootinstall.sh $sclang $particionraiz $partefi" } diff --git a/archinstall/chrootinstall.sh b/archinstall/chrootinstall.sh index d342bc4..2ebe64b 100755 --- a/archinstall/chrootinstall.sh +++ b/archinstall/chrootinstall.sh @@ -8,6 +8,13 @@ partefi=$3 sclang=$1 source translations.sh argpart=$(echo $particionraiz | cut -c1-3) + +if [[ -f /mnt/etc/pacman.conf.post ]];then # Is an offline installation? +isoffline=1 +else +isoffline=0 +fi + #Try to disable ctrl+C trap '' INT @@ -461,3 +468,10 @@ systemctl enable dhcpcd pacman -Sc --noconfirm echo "Sincronizando datos al disco duro, puede tardar unos segundos" sync + +if [[ -f /mnt/etc/pacman.conf.post ]];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 + + diff --git a/archinstall/translations.sh b/archinstall/translations.sh index 51150ea..2de0f3c 100755 --- a/archinstall/translations.sh +++ b/archinstall/translations.sh @@ -297,6 +297,11 @@ case "$1" in "es") echo "ContraseƱa para ";; *) echo "$1";; esac;; + "Installing packages") + case $sclang in + "es") echo "Instalando paquetes";; + *) echo "$1";; + esac;; *) echo "$1";; esac } \ No newline at end of file