From 3e197e083b2afcfa9b1f3d881feaf946c396ea2d Mon Sep 17 00:00:00 2001 From: Kevin Puertas Date: Sat, 22 Jul 2017 18:54:06 +0200 Subject: [PATCH] Some fixes and better swap support --- installer/installer.sh | 51 +++++++++++++----------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/installer/installer.sh b/installer/installer.sh index 4eaccd5..ca9c10a 100755 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -71,36 +71,17 @@ function pacmanerror { ##This function logs and execute commands function execl { local command - echo "------" >> "/tmp/install.log" if [[ $1 != "chroot" && $1 != "chuser" ]];then #If it runs normally - command="$1" - for (( i=2; i<=$#; i++ )) - do - command="$command $(echo $* | cut -f$i -d" ")" - done - echo "$command" >> "/tmp/install.log" - $command - else #There is a "First word", avoid it - for (( i=2; i<=$#; i++ )) - do - command="$command $(echo $* | cut -f$i -d" ")" - done + $1 + else #There is a chroot/chuser word and we have to delete it, and then use + command=`echo $command | 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 - if [[ $1 = "chroot" ]];then #If it runs in chroot - echo "(In the install partition/chroot) $command" >> "/tmp/install.log" - chroot /mnt /bin/bash -c "$command" - 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" - chroot /mnt /bin/bash -c "su $nameuser -c \"$command\" " - fi - - #Log result of the command - if [[ $? == 0 ]];then - echo "Result Ok " >> "/tmp/install.log" - else - echo "Error: Code $?" >> "/tmp/install.log" - fi } ##Function for show to the user if an option is on or off @@ -441,7 +422,7 @@ function installconf { isanetworkerror # Comprueba si hubo un error de descarga 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 + execl pacstrap -C pacman.conf /mnt/ base jkarch-mirrorlist reflector rsync dosfstools ntfs-3g btrfs-progs exfat-utils systemd-swap pacmanerror # Copy pacman.conf execl cp pacman.conf /mnt/etc/pacman.conf @@ -482,6 +463,8 @@ function installconf { # Standard packages allpackages="$allpackages flashplugin evince ristretto librsvg gnome-calculator gnome-disk-utility file-roller lrzip p7zip unace unrar tumbler poppler-glib ffmpegthumbnailer libgsf notepadqq leafpad libreoffice-fresh vlc qt4 noto-fonts noto-fonts-cjk noto-fonts-emoji ttf-dejavu ttf-liberation ttf-ms-fonts" + # Video pkgs + allpackages=$allpackages" "$(pacman -Ssq xf86-video-*) # If spanish, add spanish lang if [[ $sclang == "es" ]];then allpackages="$allpackages libreoffice-fresh-es firefox-i18n-es-es" @@ -525,14 +508,15 @@ function installconf { # Add sudo support for wheel users like user added sed -i "s/\# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" /mnt/etc/sudoers - # User directory (Photos, Desktop..) create + # User directory creation (Photos, Desktop..) execl chroot xdg-user-dirs-update + execl chuser xdg-user-dirs-update # Turn on some services execl chroot systemctl enable lightdm execl chroot systemctl enable NetworkManager execl chroot systemctl enable dhcpcd - # Enable cupsd service for printing - execl chroot systemctl enable org.cups.cupsd + execl chroot systemctl enable systemd-swap #Swap detection + execl chroot systemctl enable org.cups.cupsd #Enable cupsd service for printing # Configure wine if neccesary if [[ $inswine = "1" ]];then @@ -718,10 +702,7 @@ umount /mnt/ # Start questions, functions for timezone, enviroment, programs... particiones -horaidioma - -#Graficos (Falta la parte de VM) -allpackages=$allpackages" "$(pacman -Ssq xf86-video-*) +horaidioma #Aqui va la personalizacion de programas, ya que son graficos. appsuser