Fix run_once_00: prepend sudo to all package operations
chezmoi runs scripts as the invoking user, not root. run_once_00 was calling apt-get/pacman directly, which fails on debian with 'Permission denied' on /var/lib/apt/lists/lock and on arch with similar pacman lock errors. Same pattern was already correct in run_once_20. Mirror that here. This is the bug that blocked rye on the second attempt.
This commit is contained in:
parent
01eda7cd7f
commit
f8530c50f7
1 changed files with 5 additions and 5 deletions
|
|
@ -15,22 +15,22 @@ die() { printf '\033[1;31m[bootstrap ERROR]\033[0m %s\n' "$*" >&2; exit 1; }
|
||||||
|
|
||||||
{{ if eq .os_family "arch" -}}
|
{{ if eq .os_family "arch" -}}
|
||||||
log "pacman-sync"
|
log "pacman-sync"
|
||||||
pacman -Sy --noconfirm
|
sudo pacman -Sy --noconfirm
|
||||||
|
|
||||||
log "install base tools (arch)"
|
log "install base tools (arch)"
|
||||||
PACMAN_PKGS=(age curl ca-certificates git base-devel wget)
|
PACMAN_PKGS=(age curl ca-certificates git base-devel wget)
|
||||||
pacman -S --needed --noconfirm "${PACMAN_PKGS[@]}"
|
sudo pacman -S --needed --noconfirm "${PACMAN_PKGS[@]}"
|
||||||
|
|
||||||
{{ else if eq .os_family "debian" -}}
|
{{ else if eq .os_family "debian" -}}
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
log "apt-update"
|
log "apt-update"
|
||||||
apt-get update -y
|
sudo apt-get update -y
|
||||||
log "apt-upgrade"
|
log "apt-upgrade"
|
||||||
apt-get upgrade -y
|
sudo apt-get upgrade -y
|
||||||
|
|
||||||
log "install base tools (debian)"
|
log "install base tools (debian)"
|
||||||
APT_PKGS=(age curl ca-certificates git wget gnupg)
|
APT_PKGS=(age curl ca-certificates git wget gnupg)
|
||||||
apt-get install -y --no-install-recommends "${APT_PKGS[@]}"
|
sudo apt-get install -y --no-install-recommends "${APT_PKGS[@]}"
|
||||||
|
|
||||||
{{ else -}}
|
{{ else -}}
|
||||||
die "unsupported os_family: {{ .os_family }} (this script supports arch or debian)"
|
die "unsupported os_family: {{ .os_family }} (this script supports arch or debian)"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue