From 9dd90ef503372dad7d88ada5071270651fa74010 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 6 May 2019 19:58:58 +0200
Subject: [PATCH] Fix home dir setup scripts.

---
 buster/setup_scripts/setup_eeepc.sh      | 6 ++++--
 buster/setup_scripts/setup_home_eeepc.sh | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/buster/setup_scripts/setup_eeepc.sh b/buster/setup_scripts/setup_eeepc.sh
index 3ab9386..a32f835 100755
--- a/buster/setup_scripts/setup_eeepc.sh
+++ b/buster/setup_scripts/setup_eeepc.sh
@@ -45,11 +45,13 @@ mv *.xpi "${extensions_dir}"
 # Set up user environments.
 cd "${setup_scripts_dir}"
 ./copy_dirtree.sh "${config_tree_prefix}/home_files" "/root" minimal root
+HOME_DIR_EXISTS=$([ ! -d "/home/plom" ]; echo $?)
+if [ ! -d "/home/plom" ]; then
 adduser --disabled-password --gecos "" plom
 usermod -a -G sudo plom
-if [ ! -d "/home/plom" ]; then
+if [ ! "${HOME_DIR_EXISTS}" -eq 0 ]; then
     cp setup_home_eeepc.sh /home/plom
     chown plom:plom /home/plom/setup_home_eeepc.sh
-    su -c "cd && ./setup_home_eeepc.sh"
+    su -c "cd && ./setup_home_eeepc.sh" plom
 fi
 passwd plom
diff --git a/buster/setup_scripts/setup_home_eeepc.sh b/buster/setup_scripts/setup_home_eeepc.sh
index 03bc853..d4ac131 100755
--- a/buster/setup_scripts/setup_home_eeepc.sh
+++ b/buster/setup_scripts/setup_home_eeepc.sh
@@ -7,5 +7,6 @@ mkdir -p "${public_repos_dir}"
 if [ ! -d "/home/plom/${public_repos_dir}/config" ]; then
     cd "${public_repos_dir}"
     git clone https://plomlompom.com/repos/clone/config
+fi
 curl -fsSl https://raw.githubusercontent.com/tridactyl/tridactyl/78e662efefd1f4af2bdb2a53edecf03b535b997b/native/install.sh | bash
 echo "As tridactyl user, don't forget to do :source on the first Firefox run and then re-start."
-- 
2.30.2