Drop id -u root check from run_once scripts
chezmoi runs run_once_* scripts as the invoking user (uid != 0). The earlier check [[ $(id -u) -ne 0 ]] && die ... killed the script immediately when invoked via 'chezmoi apply' or 'chezmoi init --apply' from a normal user session. The scripts use sudo internally for package operations (pacman/apt), so elevation happens correctly. The id -u check was wrong: it belongs in a script that's *meant* to be invoked as root directly, not in a chezmoi-managed script.
This commit is contained in:
parent
0cc12f050a
commit
01eda7cd7f
2 changed files with 5 additions and 2 deletions
|
|
@ -9,7 +9,9 @@ set -euo pipefail
|
|||
log() { printf '\033[1;34m[bootstrap]\033[0m %s\n' "$*"; }
|
||||
die() { printf '\033[1;31m[bootstrap ERROR]\033[0m %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
[[ "$(id -u)" -ne 0 ]] && die "must run as root or via sudo"
|
||||
# This script runs as the invoking user via `chezmoi apply`/`init`. It uses
|
||||
# sudo for system package installs. If sudo isn't passwordless, the user
|
||||
# will be prompted once per sudo invocation.
|
||||
|
||||
{{ if eq .os_family "arch" -}}
|
||||
log "pacman-sync"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ set -euo pipefail
|
|||
log() { printf '\033[1;34m[chaotic]\033[0m %s\n' "$*"; }
|
||||
die() { printf '\033[1;31m[chaotic ERROR]\033[0m %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
[[ "$(id -u)" -ne 0 ]] && die "must run as root or via sudo"
|
||||
# This script runs as the invoking user; sudo handles elevation for pacman
|
||||
# and pacman-key operations below.
|
||||
|
||||
if command -v paru >/dev/null 2>&1; then
|
||||
log "paru already installed — skipping chaotic setup"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue