diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-10 00:54:17 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-10 01:43:58 -0600 |
| commit | 41014590cc54ec490505a3851fa59ef8c5d6aebe (patch) | |
| tree | 94e1734227a8bb2f99d6dc6374a30f4eaa93b065 /archsetup | |
| parent | 173d3a70e32e3ce1c83cf98346ab9d007782c5b6 (diff) | |
fix(archsetup): copy archsetup to user directory before stow
Previously, stow created dotfile symlinks pointing to wherever archsetup
was run from (e.g., /root/archsetup or /tmp). If run from a location
inaccessible to the user, zsh would fail to read its config on first
login and prompt for new user setup.
The fix copies archsetup to ~/code/archsetup before running stow, ensuring
symlinks always point to a user-accessible location.
Also adds a test to verify dotfiles are readable by the user (not just root).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'archsetup')
| -rwxr-xr-x | archsetup | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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" "$?" |
