From 0572d16454524981c658bd1b8e4dfd4633da315a Mon Sep 17 00:00:00 2001
From: natemaia <natemaia10@gmail.com>
Date: Fri, 14 Dec 2018 22:00:59 -0800
Subject: [PATCH] Fix: xinit setup

---
 src/archlabs-installer |  2 +-
 src/lib/install.sh     | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/archlabs-installer b/src/archlabs-installer
index 70904c3..92e32b9 100755
--- a/src/archlabs-installer
+++ b/src/archlabs-installer
@@ -10,7 +10,7 @@
 
 
 # immutable globals
-readonly VER="1.7.33"        # Installer version
+readonly VER="1.7.34"        # Installer version
 readonly DIST="ArchLabs"     # Linux distributor
 readonly MNT="/mnt"          # Install mountpoint
 readonly ERR="/tmp/errlog"   # Built-in error log
diff --git a/src/lib/install.sh b/src/lib/install.sh
index f314897..5be5278 100644
--- a/src/lib/install.sh
+++ b/src/lib/install.sh
@@ -177,9 +177,13 @@ EOF
 
 create_user()
 {
-    # set root password
+    # set root password and shell if needed
     chrun "chpasswd <<< 'root:$ROOT_PASS'"
-    [[ $MYSHELL == *zsh ]] || chrun "usermod -s $MYSHELL root"
+
+    if [[ $MYSHELL != *zsh ]]; then
+        chrun "usermod -s $MYSHELL root"
+        cp -f $MNT/etc/skel/.mkshrc /root/.mkshrc
+    fi
 
     local groups='audio,autologin,floppy,log,network,rfkill,scanner,storage,optical,power,wheel'
 
@@ -253,7 +257,7 @@ EOF
 
     if [[ $AUTOLOGIN == true ]]; then
         sed -i "s/root/${NEWUSER}/g" $SERVICE/autologin.conf
-        cat >> $MNT/home/$NEWUSER/$loginrc << EOF
+        cat > $MNT/home/$NEWUSER/$loginrc << EOF
 # ~/$loginrc
 # sourced by $(basename $MYSHELL) when used as a login shell
 
@@ -289,7 +293,7 @@ EOF
 
 login_manager()
 {
-    SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
+    declare -g SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
 
     # remove welcome message
     sed -i '/printf/d' $MNT/root/.zshrc
@@ -297,7 +301,7 @@ login_manager()
     if [[ $LOGIN_TYPE == 'lightdm' ]]; then
         setup_lightdm
     else
-        setup_shell_xinit
+        setup_xinit
     fi
 }