Compare commits

..
6 Commits
Author SHA1 Message Date
xavier 294e6cd4ae Merge pull request 'Bootstrap et update sans droits sudo' (#4) from fix/bootstrap-without-sudo into dev
Reviewed-on: https://gitea.cloud.logerais.com/xavier/config-chezmoi/pulls/4
2026-11-11 22:18:09 +01:00
xavierandClaude Opus 5.5 05b9748a48 fix(chezmoi): Address review comments
- update: rename APT to COMMAND_APT
- mise bootstrap is generic (not only apt): fix comments and warning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 22:15:40 +01:00
xavierandClaude Opus 5.5 e7d9189de4 fix(chezmoi): Skip system packages tasks without sudo rights
mise bootstrap installs apt packages through sudo: for an account without
sudo (devenv sandbox agent), it failed and stopped chezmoi apply, thus the
image build. The bootstrap and the APT section of update are now skipped
unless the account is root, has passwordless sudo, or belongs to a sudo
group with a terminal to type the password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:37:42 +01:00
xavier ee405c937a feat(chezmoi): Split some tollboxes into smaller ones 2026-10-16 01:14:59 +02:00
xavier 4c7b637e97 feat(chezmoi): Add devops toolbox for ubuntu user on cloud host 2026-10-04 17:04:20 +02:00
Xavier Logerais d0327a3b70 feat(chezmoi): Split git tools in several toolboxes 2026-09-28 18:13:44 +02:00
5 changed files with 109 additions and 40 deletions

No files matched your search

+27 -8
View File
@@ -10,9 +10,13 @@ hosts:
xavier:
toolboxes:
- terminal
- dev-git
- dev-gitea
- dev-tools
- dev-languages
- ai
- ai-anthropic
- ai-openai
- ai-google
tools:
- pipx:vit
- pipx:speedtest-cli
@@ -24,13 +28,16 @@ hosts:
root:
toolboxes:
- terminal
- dev-tools
ubuntu:
toolboxes:
- terminal
- dev-git
- dev-gitea
- dev-tools
- dev-languages
- ai
- devops-docker
- devops-podman
- devops-kubernetes
tools:
- pipx:vit
configs: {}
@@ -40,18 +47,28 @@ hosts:
root:
toolboxes:
- terminal
- dev-tools
xavier:
toolboxes:
- terminal
- dev-git
- dev-gitea
- dev-tools
- dev-languages
- devops
- ai
- devops-docker
- devops-podman
- devops-kubernetes
tools:
- sops
- age
configs: {}
agent:
toolboxes:
- terminal
- dev-git
- dev-gitea
- dev-tools
- dev-languages
- ai-anthropic
# Termux (application de terminal pour android)
termux-debian:
packages:
@@ -60,10 +77,12 @@ hosts:
root:
toolboxes:
- terminal
- dev-tools
xavier:
toolboxes:
- terminal
- dev-git
- dev-github
- dev-gitea
- dev-tools
termux-ubuntu:
packages:
@@ -72,8 +91,8 @@ hosts:
root:
toolboxes:
- terminal
- dev-tools
xavier:
toolboxes:
- terminal
- dev-git
- dev-tools
+21 -8
View File
@@ -21,9 +21,14 @@ tools:
- jq
- yq
- shellcheck
- lazygit
- delta
dev-git:
- lazygit
dev-github:
- gh
dev-gitlab:
- glab
dev-gitea:
- tea:
url: "https://gitea.com/gitea/tea/releases/download/v{{ version }}/tea-{{ version }}-{{ os() }}-{{ arch(x64='amd64') }}.xz"
version: "0.15.1"
@@ -34,27 +39,35 @@ tools:
- node
- go
- rust
devops:
- docker-cli
- podman
devops-docker:
- lazydocker
- docker-cli
devops-podman:
- podman
devops-kubernetes:
- kubectl
- krew
- k9s
- helm
- flux2
devops-kubernetes-play:
- minikube
- kind
devops:
- helm
- flux2
- kwok
- dive
- trivy
- crane
- cosign
ai:
ai-anthropic:
- claude
- gemini-cli
ai-openai:
- codex
ai-google:
- gemini-cli
ai-microsoft:
- copilot
ai-misc:
- opencode
# # Password managers
+28 -18
View File
@@ -5,6 +5,7 @@ set -u
FAILED=0
STATUS_APT="not_detected"
COMMAND_APT=()
STATUS_BREW="not_detected"
STATUS_CHEZMOI="not_detected"
STATUS_MISE="not_detected"
@@ -73,30 +74,38 @@ if [[ -f /etc/os-release ]]; then
. /etc/os-release
if [[ "$ID" == "debian" || "$ID" == "ubuntu" ]]; then
STATUS_APT="success"
# root, sudo sans mot de passe, ou membre d'un groupe sudo avec un terminal
# pour saisir le mot de passe ; sinon (par exemple compte sans sudo d'un
# bac à sable) la section est ignorée
if ((EUID == 0)); then
APT=(apt)
COMMAND_APT=(apt)
elif sudo -n true 2>/dev/null ||
{ [[ -t 0 ]] && id -nG | grep -qwE 'sudo|admin|wheel'; }; then
COMMAND_APT=(sudo apt)
else
APT=(sudo apt)
STATUS_APT="skipped"
fi
echo_info "APT"
run APT "Mise à jour des paquets" \
"${APT[@]}" update || true
run APT "Mise à niveau des paquets" \
"${APT[@]}" upgrade -y || true
run APT "Suppression des paquets inutiles" \
"${APT[@]}" autoremove -y || true
run APT "Nettoyage du cache" \
"${APT[@]}" autoclean || true
fi
fi
if ((${#COMMAND_APT[@]})); then
STATUS_APT="success"
echo_info "APT"
run APT "Mise à jour des paquets" \
"${COMMAND_APT[@]}" update || true
run APT "Mise à niveau des paquets" \
"${COMMAND_APT[@]}" upgrade -y || true
run APT "Suppression des paquets inutiles" \
"${COMMAND_APT[@]}" autoremove -y || true
run APT "Nettoyage du cache" \
"${COMMAND_APT[@]}" autoclean || true
fi
# ----------------------------------------------------------------------
# Homebrew
# ----------------------------------------------------------------------
@@ -174,6 +183,7 @@ case "$STATUS_APT" in
success) echo_success "APT : réussi" ;;
failed) echo_failed "APT : échoué" ;;
not_detected) echo_skipped "APT : non détecté" ;;
skipped) echo_skipped "APT : ignoré (pas de droits sudo)" ;;
esac
echo -n " ► "
+15 -3
View File
@@ -1,5 +1,12 @@
#!/usr/bin/env bash
# Droits d'administration : root, sudo sans mot de passe, ou membre d'un
# groupe sudo avec un terminal pour saisir le mot de passe
can_sudo() {
(( EUID == 0 )) || sudo -n true 2>/dev/null \
|| { [ -t 0 ] && id -nG | grep -qwE 'sudo|admin|wheel'; }
}
# 1. Installer Mise s'il n'est pas présent
if ! command -v mise &>/dev/null; then
echo "📦 Installation de Mise..."
@@ -9,10 +16,15 @@ if ! command -v mise &>/dev/null; then
export PATH="${HOME}/.local/bin:$PATH"
fi
# 2. Lancer le bootstrap
# 2. Lancer le bootstrap : il peut exiger sudo (paquets système, etc.) ; faute
# de pouvoir n'en exécuter qu'une partie, il est ignoré sans droits sudo
if command -v mise &>/dev/null; then
echo "🚀 Mise bootstrap..."
mise bootstrap --yes
if can_sudo; then
echo "🚀 Mise bootstrap..."
mise bootstrap --yes
else
echo "⚠️ Pas de droits sudo : mise bootstrap ignoré."
fi
fi
# 3. Installer tous les outils déclarés dans ~/.config/mise/config.toml et ~/.config/mise/conf.d/*.toml
+18 -3
View File
@@ -8,6 +8,13 @@
set -euo pipefail
# Droits d'administration : root, sudo sans mot de passe, ou membre d'un
# groupe sudo avec un terminal pour saisir le mot de passe
can_sudo() {
(( EUID == 0 )) || sudo -n true 2>/dev/null \
|| { [ -t 0 ] && id -nG | grep -qwE 'sudo|admin|wheel'; }
}
export PATH="${HOME}/.local/bin:$PATH"
MISE_CONF_D="${HOME}/.config/mise/conf.d"
mkdir -p "$MISE_CONF_D"
@@ -54,9 +61,17 @@ MISE_TOOLBOX_EOF
{{- end }}
if command -v mise &>/dev/null; then
echo
echo "🚀 Mise bootstrap..."
mise bootstrap --yes
# Le bootstrap peut exiger sudo (paquets système, etc.) : faute de pouvoir
# n'en exécuter qu'une partie, il est ignoré sans droits sudo (par exemple
# compte sans sudo d'un bac à sable)
if can_sudo; then
echo
echo "🚀 Mise bootstrap..."
mise bootstrap --yes
else
echo
echo "⚠️ Pas de droits sudo : mise bootstrap ignoré."
fi
echo
echo "⚡ Mise install..."