diff --git a/archinstall/archinstall.sh b/archinstall/archinstall.sh index 426d03a..2fb60b0 100755 --- a/archinstall/archinstall.sh +++ b/archinstall/archinstall.sh @@ -46,10 +46,10 @@ fatalerror "$(T "Pacman error, problems in repositories, apologizes. You have to fi } -function execl { ##This function logs the command executed +function execl { ##This function logs and execute commands local command echo "------" >> "/tmp/install.log" -if [[ $1 != "chroot" ]];then #If it runs outside chroot +if [[ $1 != "chroot" && $1 != "chuser" ]];then #If it runs normally command="$1" for (( i=2; i<=$#; i++ )) do @@ -57,19 +57,26 @@ do done echo "$command" >> "/tmp/install.log" $command -else #else: If it runs in chroot +else #There is a "First word", avoid it for (( i=2; i<=$#; i++ )) do command="$command $(echo $* | cut -f$i -d" ")" done -echo "(In the install partition/chroot) $command" >> "/tmp/install.log" -chroot /mnt /bin/bash -c "$command" 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 "Result Error: Code $?" >> "/tmp/install.log" +echo "Error: Code $?" >> "/tmp/install.log" fi } @@ -601,7 +608,7 @@ if [[ $nooptprogs != "1" ]];then execl chroot pacman -S $packages --noconfirm --needed if [[ $inswine = 1 ]];then echo "$(T "Configuring wine for better experience") (32 bit winearch)" - execl chroot su $nameuser -c 'WINEARCH=win32 wineboot -u' + execl chuser WINEARCH=win32 wineboot -u fi packages="" fi