diff --git a/installer/installer.sh b/installer/installer.sh index 9298848..8396d05 100755 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -19,7 +19,22 @@ function mostrardialog { dialog --title "$titled" --msgbox "$msgd" 15 60 } -## This function shows messages better to the user +##This function execute the commands +function execl { + local command + if [[ $1 != "chroot" && $1 != "chuser" ]];then #If it runs normally + $* + else #There is a chroot/chuser word and we have to delete it, and then use + command=`echo "$*" | cut -d" " -f2-` + if [[ $1 = "chroot" ]];then #If it runs in the chroot + chroot /mnt /bin/bash -c "$command" + elif [[ $1 = "chuser" ]];then #If it has to run in the created user in chroot + chroot /mnt /bin/bash -c "su $nameuser -c \"$command\" " + fi + fi +} + +## This function shows messages to the user in a better way, and logs it ## $1 -> Sentence to show ## $2 -> Start(1) /Finish(2) function showdo { @@ -40,6 +55,8 @@ function showdo { echo "[ OK ] $1" echo "[ OK ] $1" >> /tmp/install.log fi + else + echo "[ RUN ] $1" fi } @@ -68,20 +85,6 @@ function pacmanerror { fi } -##This function execute the commands -function execl { - local command - if [[ $1 != "chroot" && $1 != "chuser" ]];then #If it runs normally - $* - else #There is a chroot/chuser word and we have to delete it, and then use - command=`echo "$*" | cut -d" " -f2-` - if [[ $1 = "chroot" ]];then #If it runs in the chroot - chroot /mnt /bin/bash -c "$command" - elif [[ $1 = "chuser" ]];then #If it has to run in the created user in chroot - chroot /mnt /bin/bash -c "su $nameuser -c \"$command\" " - fi - fi -} ##Function for show to the user if an option is on or off function optstate { @@ -414,11 +417,8 @@ function installconf { execl mount /dev/$partefi /mnt/boot/efi/ fi - # Download or install base system. - execl wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/installer/pacman.conf -O pacman.conf - #JKArch Mirrorlist needed - execl wget -nv https://mirror.jkanetwork.com/Arch-repository/jkarch-mirrorlist -O /etc/pacman.d/jkarch-mirrorlist - isanetworkerror # Comprueba si hubo un error de descarga + # Download and install base system. + tput setaf 2 ; echo "$(T "Downloading")" ; tput setaf 9 #Install base and disk format drivers. Reflector and rsync is for updating mirrorlist later execl pacstrap -C pacman.conf /mnt/ base jkarch-mirrorlist reflector rsync dosfstools ntfs-3g btrfs-progs exfat-utils systemd-swap @@ -492,7 +492,7 @@ function installconf { execl chroot systemctl enable ntpd # User and desktop skel - wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/installer/skeluser.tar.xz -O- | tar xJf - -C /mnt/ + tar xJf /root/skeluser.tar.xz -C /mnt/ # Create user execl chroot useradd -m -G wheel -s /bin/bash $nameuser @@ -511,6 +511,7 @@ function installconf { execl chroot xdg-user-dirs-update execl chuser xdg-user-dirs-update # Turn on some services + showdo "Enabling services" execl chroot systemctl enable lightdm execl chroot systemctl enable NetworkManager execl chroot systemctl enable dhcpcd @@ -560,9 +561,10 @@ function installconf { # Clean pacman - echo "$(T "Cleaning")" + showdo "$(T "Cleaning")" execl chroot rm -rf $sfslocate/var/cache/pacman/pkg/* execl chroot pacman -Sc --noconfirm + } # Fin installconf @@ -624,6 +626,16 @@ if [[ ! -f "jkarch" ]];then # Grow cowspace showdo "Grow cowspace for installer" execl mount -o remount,size=700M /run/archiso/cowspace + + + # Download JKArch scripts and data... + showdo "Downloading JKArch scripts and data" "1" + wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/installer/translations.sh -O /root/translations.sh ; isanetworkerror + wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/installer/skeluser.tar.xz -O /root/skeluser.tar.xz ; isanetworkerror + wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/installer/pacman.conf -O /root/pacman.conf ; isanetworkerror + wget -nv https://mirror.jkanetwork.com/Arch-repository/jkarch-mirrorlist -O /etc/pacman.d/jkarch-mirrorlist ; isanetworkerror #Goes to final location directly + showdo "Downloaded JKArch scripts and data" "2" + #Enable pacman showdo "Configuring pacman" "1" execl pacman-key --init @@ -636,27 +648,29 @@ if [[ ! -f "jkarch" ]];then execl reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist showdo "Updated mirrors" "2" + showdo "Removing and installing live programs to start installation" "1" #Delete programs (For not updating it) pacman -R clonezilla darkhttpd diffutils grml-zsh-config irssi linux-atm lvm2 man-db man-pages mc ndisc6 nmap smartmontools testdisk vi vim vim-runtime openconnect pcsclite python2 python reflector --noconfirm rm -rf /var/cache/pacman/pkg/* #Needed progs (gparted) - pacman -S gparted xf86-video-vesa xorg-xinit lwm xorg-xrandr xterm --noconfirm + pacman -S gparted xf86-video-vesa xorg-xinit lwm xorg-xrandr xorg-xsetroot xterm --noconfirm ; pacmanerror rm -rf /var/cache/pacman/pkg/* #Update progs pacman -Su --noconfirm --ignore linux #Do not upgrade kernel automatically rm -rf /var/cache/pacman/pkg/* + showdo "Prepared live image to start installation" "2" + rm /etc/X11/xinit/xinitrc touch /etc/X11/xinit/xinitrc chmod 777 /etc/X11/xinit/xinitrc echo "#Start gparted with startx command" > /etc/X11/xinit/xinitrc echo "lwm &" >> /etc/X11/xinit/xinitrc echo "xrandr -s 1024x768 -r 60" >> /etc/X11/xinit/xinitrc + echo "xsetroot -solid lightskyblue4" >> /etc/X11/xinit/xinitrc echo "xterm -e '/root/installer.sh' -geometry 120x35" >> /etc/X11/xinit/xinitrc chmod 644 /etc/X11/xinit/xinitrc rm -rf /var/cache/pacman/pkg/* - #Download translations - wget -nv https://gitlab.com/JKANetwork/JKArch/raw/master/installer/translations.sh -O /root/translations.sh # No black screensaver setterm -blank 0 -powerdown 0 -powersave off