summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xarchsetup13
-rwxr-xr-xscripts/testing/run-test.sh16
2 files changed, 29 insertions, 0 deletions
diff --git a/archsetup b/archsetup
index 574b461..c3d1d69 100755
--- a/archsetup
+++ b/archsetup
@@ -464,6 +464,19 @@ create_user () {
user_customizations() {
action="User Customizations" && display "title" "$action"
+ # Copy archsetup to user's home directory so dotfile symlinks are accessible.
+ # Without this, stow creates symlinks pointing to wherever archsetup was run from
+ # (e.g., /root/archsetup), which the user cannot read after login.
+ user_archsetup_dir="/home/$username/code/archsetup"
+ action="copying archsetup to user's home directory" && display "task" "$action"
+ (mkdir -p "$user_archsetup_dir" && \
+ cp -r "$archsetup_dir"/* "$user_archsetup_dir/" && \
+ chown -R "$username": "/home/$username/code" \
+ >> "$logfile" 2>&1) || error "error" "$action" "$?"
+
+ # Update dotfiles_dir to point to user-accessible location
+ dotfiles_dir="$user_archsetup_dir/dotfiles"
+
action="linking dotfiles into place" && display "task" "$action"
(cd $dotfiles_dir && stow --target=/home/$username --no-folding --adopt system \
>> "$logfile" 2>&1 ) || error "error" "$action" "$?"
diff --git a/scripts/testing/run-test.sh b/scripts/testing/run-test.sh
index 4bcb55b..e73f29c 100755
--- a/scripts/testing/run-test.sh
+++ b/scripts/testing/run-test.sh
@@ -296,6 +296,22 @@ else
VALIDATION_PASSED=false
fi
+# Check if dotfile symlinks are accessible by user (not just root)
+# This catches the bug where stow creates symlinks pointing to /root/archsetup or /tmp
+# Use sudo -u to avoid starting a full login shell which might hang
+step "Checking if dotfiles are readable by user cjennings"
+DOTFILE_CHECK=$(sshpass -p "$ROOT_PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ "root@$VM_IP" "sudo -u cjennings cat /home/cjennings/.zshrc > /dev/null 2>&1 && echo OK || echo FAIL" 2>/dev/null)
+if [ "$DOTFILE_CHECK" = "OK" ]; then
+ success "Dotfiles are readable by user cjennings"
+else
+ error "Dotfiles are NOT readable by user cjennings (symlinks may point to inaccessible location)"
+ # Show where the symlink points for debugging
+ sshpass -p "$ROOT_PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ "root@$VM_IP" "ls -la /home/cjennings/.zshrc" >> "$LOGFILE" 2>&1
+ VALIDATION_PASSED=false
+fi
+
# Check if yay is installed
step "Checking if yay (AUR helper) is installed"
if sshpass -p "$ROOT_PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \