added root user setup

This commit is contained in:
2026-08-03 02:59:32 +02:00
parent e854d4a22e
commit 45f289ae3e
2 changed files with 59 additions and 30 deletions
-30
View File
@@ -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
+59
View File
@@ -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"