feat(setup): seed /etc/skel from installed user's ~/.config after all modules run
Problem: every module installs its config into the running user's ~/.config, but
/etc/skel was never updated afterwards. Any additional user created with
`useradd -m` later would get an empty home directory with no configs at all —
they would have to manually copy or re-run setup.
Solution: at the end of both TUI installer scripts (after every module and the
colorway step have finished), copy the fully-configured user's home into
/etc/skel so that it becomes the template for all future users.
How it works — tui-install.sh + simple-install.sh (identical block in both):
The block runs AFTER the last run_module call and AFTER apply-theme.sh, so
the snapshot is taken when the home directory is in its final state. It copies:
~/.config/ → /etc/skel/.config/ (all app configs, DE configs, etc.)
~/.themes/ → /etc/skel/.themes/ (GTK themes, including cyberqueer)
~/.zshrc → /etc/skel/.zshrc
~/.bashrc → /etc/skel/.bashrc
~/.vimrc → /etc/skel/.vimrc
Each copy is guarded ([[ -d ]] / [[ -f ]]) so missing files are silently
skipped rather than erroring. sudo is used because /etc/skel is root-owned
but the installer runs as the normal user.
arch-autoinstall.sh + archbaseos-guided-install.sh (chroot-phase changes):
The previous version tried to cherry-pick specific subdirectories from the
Dotfiles repo clone (hypr/, niri/, waybar/, etc.) using a long list of cp
commands. This was brittle — any new module that installs to ~/.config was
not automatically captured, and the list had to be manually maintained.
Replaced with a minimal block that only copies the three shell dotfiles
(.zshrc, .bashrc, .vimrc) from the repo clone into /etc/skel. This is
sufficient for the first user created during installation (useradd -m runs
immediately after, before any modules). The full ~/.config sync above then
takes over for all subsequent users after the modules have run.
arch-autoinstall.sh additionally had the skel setup moved to before the
useradd -m call (was missing entirely before) so even the first user gets
the shell dotfiles, with a fallback direct-clone path if the skel clone fails.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
parent
dd1cd2b8c7
commit
7627dd67ff
|
|
@ -382,6 +382,18 @@ echo "$HOSTNAME" > /etc/hostname
|
|||
# NetworkManager
|
||||
systemctl enable NetworkManager
|
||||
|
||||
# Populate /etc/skel with dotfiles and base configs for all new users
|
||||
echo "Cloning dotfiles into /etc/skel..."
|
||||
git clone https://git.abdelbaki.eu/The_miro/Dotfiles.git /etc/skel/Dotfiles \
|
||||
|| echo "Warning: dotfiles clone into skel failed — will fall back to direct clone."
|
||||
# Seed /etc/skel with base shell dotfiles from the repo clone
|
||||
if [[ -d /etc/skel/Dotfiles ]]; then
|
||||
D=/etc/skel/Dotfiles
|
||||
cp "$D/.zshrc" /etc/skel/.zshrc 2>/dev/null || true
|
||||
cp "$D/.bashrc" /etc/skel/.bashrc 2>/dev/null || true
|
||||
cp "$D/.vimrc" /etc/skel/.vimrc 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# User
|
||||
useradd -m -G wheel -s /bin/zsh "$USERNAME"
|
||||
echo "$USERNAME:$USERPASS" | chpasswd
|
||||
|
|
@ -433,10 +445,15 @@ fi
|
|||
###################################################
|
||||
# CLONE DOTFILES
|
||||
###################################################
|
||||
echo "Cloning dotfiles..."
|
||||
git clone https://git.abdelbaki.eu/The_miro/Dotfiles.git "/home/$USERNAME/Dotfiles" \
|
||||
&& chown -R "$USERNAME":"$USERNAME" "/home/$USERNAME/Dotfiles" \
|
||||
if [[ -d "/home/$USERNAME/Dotfiles" ]]; then
|
||||
echo "Dotfiles already in home via skel — fixing ownership."
|
||||
chown -R "$USERNAME:$USERNAME" "/home/$USERNAME"
|
||||
else
|
||||
echo "Cloning dotfiles directly to user home (skel clone failed)..."
|
||||
git clone https://git.abdelbaki.eu/The_miro/Dotfiles.git "/home/$USERNAME/Dotfiles" \
|
||||
&& chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/Dotfiles" \
|
||||
|| echo "Warning: dotfiles clone failed — clone manually after first boot."
|
||||
fi
|
||||
|
||||
CHROOT_EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -343,6 +343,14 @@ echo "Cloning dotfiles into /etc/skel..."
|
|||
git clone https://git.abdelbaki.eu/The_miro/Dotfiles.git /etc/skel/Dotfiles \
|
||||
|| echo "Warning: dotfiles clone failed — clone manually after first boot."
|
||||
|
||||
# Seed /etc/skel with base shell dotfiles from the repo clone
|
||||
if [[ -d /etc/skel/Dotfiles ]]; then
|
||||
D=/etc/skel/Dotfiles
|
||||
cp "$D/.zshrc" /etc/skel/.zshrc 2>/dev/null || true
|
||||
cp "$D/.bashrc" /etc/skel/.bashrc 2>/dev/null || true
|
||||
cp "$D/.vimrc" /etc/skel/.vimrc 2>/dev/null || true
|
||||
fi
|
||||
|
||||
mkdir -p /etc/skel/{Desktop,Documents,Downloads,Music,Pictures,Public,Templates,Videos}
|
||||
|
||||
useradd -m -G wheel -s /bin/zsh "$USERNAME"
|
||||
|
|
|
|||
|
|
@ -797,6 +797,18 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# ── Sync user config to /etc/skel ─────────────────────────────────────────────
|
||||
# Captures everything installed by modules so future users start with the same setup.
|
||||
if [[ -d "$HOME/.config" ]]; then
|
||||
printf "\n Syncing ~/.config to /etc/skel...\n"
|
||||
sudo mkdir -p /etc/skel/.config
|
||||
sudo cp -r "$HOME/.config/." /etc/skel/.config/
|
||||
fi
|
||||
[[ -d "$HOME/.themes" ]] && { sudo mkdir -p /etc/skel/.themes; sudo cp -r "$HOME/.themes/." /etc/skel/.themes/; }
|
||||
[[ -f "$HOME/.zshrc" ]] && sudo cp "$HOME/.zshrc" /etc/skel/.zshrc
|
||||
[[ -f "$HOME/.bashrc" ]] && sudo cp "$HOME/.bashrc" /etc/skel/.bashrc
|
||||
[[ -f "$HOME/.vimrc" ]] && sudo cp "$HOME/.vimrc" /etc/skel/.vimrc
|
||||
|
||||
# ── Done ──────────────────────────────────────────────────────────────────────
|
||||
if $ANSWERFILE_MODE; then
|
||||
printf "\nDone. Log: %s\n" "$LOG"
|
||||
|
|
|
|||
|
|
@ -682,6 +682,18 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# ── Sync user config to /etc/skel ─────────────────────────────────────────────
|
||||
# Captures everything installed by modules so future users start with the same setup.
|
||||
if [[ -d "$HOME/.config" ]]; then
|
||||
printf "\n Syncing ~/.config to /etc/skel...\n"
|
||||
sudo mkdir -p /etc/skel/.config
|
||||
sudo cp -r "$HOME/.config/." /etc/skel/.config/
|
||||
fi
|
||||
[[ -d "$HOME/.themes" ]] && { sudo mkdir -p /etc/skel/.themes; sudo cp -r "$HOME/.themes/." /etc/skel/.themes/; }
|
||||
[[ -f "$HOME/.zshrc" ]] && sudo cp "$HOME/.zshrc" /etc/skel/.zshrc
|
||||
[[ -f "$HOME/.bashrc" ]] && sudo cp "$HOME/.bashrc" /etc/skel/.bashrc
|
||||
[[ -f "$HOME/.vimrc" ]] && sudo cp "$HOME/.vimrc" /etc/skel/.vimrc
|
||||
|
||||
# ── Done ──────────────────────────────────────────────────────────────────────
|
||||
if $ANSWERFILE_MODE; then
|
||||
printf "\nDone. Log: %s\n" "$LOG"
|
||||
|
|
|
|||
Loading…
Reference in New Issue