From 45f289ae3ea06d216643f93f02673d1ca5f28b56 Mon Sep 17 00:00:00 2001 From: Keule2 Date: Mon, 3 Aug 2026 02:59:32 +0200 Subject: [PATCH] added root user setup --- dot_config/fish/private_fish_variables | 30 ------------- run_once_55-configure-root.sh.tmpl | 59 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 30 deletions(-) delete mode 100644 dot_config/fish/private_fish_variables create mode 100755 run_once_55-configure-root.sh.tmpl diff --git a/dot_config/fish/private_fish_variables b/dot_config/fish/private_fish_variables deleted file mode 100644 index 49d4a24..0000000 --- a/dot_config/fish/private_fish_variables +++ /dev/null @@ -1,30 +0,0 @@ -# This file contains fish universal variable definitions. -# VERSION: 3.0 -SETUVAR fish_color_autosuggestion:brblack -SETUVAR fish_color_cancel:\x2dr -SETUVAR fish_color_command:blue -SETUVAR fish_color_comment:red -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:green -SETUVAR fish_color_error:brred -SETUVAR fish_color_escape:brcyan -SETUVAR fish_color_history_current:\x2d\x2dbold -SETUVAR fish_color_host:normal -SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:brcyan -SETUVAR fish_color_param:cyan -SETUVAR fish_color_quote:yellow -SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold -SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_status:red -SETUVAR fish_color_user:brgreen -SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_completion:normal -SETUVAR fish_pager_color_description:yellow\x1e\x2di -SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline -SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/run_once_55-configure-root.sh.tmpl b/run_once_55-configure-root.sh.tmpl new file mode 100755 index 0000000..a4a24da --- /dev/null +++ b/run_once_55-configure-root.sh.tmpl @@ -0,0 +1,59 @@ +#!/bin/bash +# run_once_55-configure-root.sh +# Root user configuration. + +set -euo pipefail + +SRC="{{ .chezmoi.sourceDir }}" +ROOT_HOME="/root" + +echo ">>> [configure-root] deploying shell configs to $ROOT_HOME" + +# Bash (always useful) +if [ -f "$SRC/dot_bashrc" ]; then + echo ">>> [configure-root] install .bashrc" + sudo install -m644 "$SRC/dot_bashrc" "$ROOT_HOME/.bashrc" +fi + +# Fish + conf.d + starship +if command -v fish >/dev/null 2>&1; then + sudo install -d -m755 "$ROOT_HOME/.config/fish" + + if [ -f "$SRC/dot_config/fish/config.fish" ]; then + echo ">>> [configure-root] install fish/config.fish" + sudo install -m644 "$SRC/dot_config/fish/config.fish" \ + "$ROOT_HOME/.config/fish/config.fish" + fi + + if [ -d "$SRC/dot_config/fish/conf.d" ]; then + echo ">>> [configure-root] install fish/conf.d/" + sudo install -d -m755 "$ROOT_HOME/.config/fish/conf.d" + for f in "$SRC"/dot_config/fish/conf.d/*; do + [ -f "$f" ] || continue + target_name="$(basename "$f")" + target_name="${target_name#executable_}" + sudo install -m755 "$f" "$ROOT_HOME/.config/fish/conf.d/$target_name" + done + fi + + # Starship + if [ -f "$SRC/dot_config/starship.toml.tmpl" ]; then + echo ">>> [configure-root] render starship.toml" + chezmoi execute-template < "$SRC/dot_config/starship.toml.tmpl" \ + | sudo tee "$ROOT_HOME/.config/starship.toml" >/dev/null + sudo chmod 644 "$ROOT_HOME/.config/starship.toml" + fi + + # Set root's shell to fish + current="$(getent passwd root | cut -d: -f7)" + if [ "$current" != "$(command -v fish)" ]; then + echo ">>> [configure-root] chsh root → fish" + sudo chsh -s "$(command -v fish)" root || true + else + echo ">>> [configure-root] root shell already fish" + fi +else + echo ">>> [configure-root] fish not installed; skipping fish+chsh" +fi + +echo ">>> [configure-root] done"