From 7627dd67ff3285ba35f12da71b10842423cc78ea Mon Sep 17 00:00:00 2001 From: The_miro Date: Wed, 24 Jun 2026 09:27:08 +0200 Subject: [PATCH] feat(setup): seed /etc/skel from installed user's ~/.config after all modules run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- setup/arch-autoinstall.sh | 25 +++++++++++++++++++++---- setup/archbaseos-guided-install.sh | 8 ++++++++ setup/simple-install.sh | 12 ++++++++++++ setup/tui-install.sh | 12 ++++++++++++ 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/setup/arch-autoinstall.sh b/setup/arch-autoinstall.sh index f6a56a6..d873f26 100755 --- a/setup/arch-autoinstall.sh +++ b/setup/arch-autoinstall.sh @@ -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" \ - || echo "Warning: dotfiles clone failed — clone manually after first boot." +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 diff --git a/setup/archbaseos-guided-install.sh b/setup/archbaseos-guided-install.sh index 0c35f3f..5b5b6fb 100755 --- a/setup/archbaseos-guided-install.sh +++ b/setup/archbaseos-guided-install.sh @@ -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" diff --git a/setup/simple-install.sh b/setup/simple-install.sh index 0b397db..248d696 100755 --- a/setup/simple-install.sh +++ b/setup/simple-install.sh @@ -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" diff --git a/setup/tui-install.sh b/setup/tui-install.sh index aecdae7..566c72d 100755 --- a/setup/tui-install.sh +++ b/setup/tui-install.sh @@ -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"