Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using Homebrew to install chezmoi #116

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if ! brew --version &>/dev/null; then
fi

readonly unwanted_packages=(
chezmoi
jq
volta
deno
Expand Down
45 changes: 31 additions & 14 deletions home/dot_local/bin/executable_full-upgrade.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ true || source ../../.chezmoitemplates/volta-library
ensure_path_entry "${HOME}/.local/bin"

if [[ "${CONTINUE_FROM_DOTFILES:-false}" == false ]]; then
if brew --version &>/dev/null; then
(
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_UPDATE_REPORT_NEW=1
export HOMEBREW_NO_ENV_HINTS=1

log_task "Updating brew"
c brew update

log_task "Updating brew packages"
c brew upgrade
)
fi

if chezmoi --version &>/dev/null; then
log_task "Updating chezmoi"

current_version=$(chezmoi execute-template '{{ .chezmoi.version.version }}')
latest_version=$(curl -fsSL -o /dev/null -w "%{url_effective}" https://github.com/twpayne/chezmoi/releases/latest)
# remove everything after last slash
latest_version="${latest_version##*/}"
# remove leading v
latest_version="${latest_version#v}"
if [[ "${current_version}" == "${latest_version}" ]]; then
log_info "chezmoi is already up to date"
else
c curl -fsSL -o "${HOME}/.local/bin/chezmoi" \
"https://github.com/twpayne/chezmoi/releases/download/v${latest_version}/chezmoi-linux-amd64"
c chmod +x "${HOME}/.local/bin/chezmoi"
fi
unset current_version latest_version

log_task "Updating dotfiles"

if chezmoi git -- status --porcelain | grep -q .; then
Expand Down Expand Up @@ -112,6 +115,20 @@ if pkgx --version &>/dev/null; then
unset pkgx_packages
fi

if brew --version &>/dev/null; then
(
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_UPDATE_REPORT_NEW=1
export HOMEBREW_NO_ENV_HINTS=1

log_task "Updating brew"
c brew update

log_task "Updating brew packages"
c brew upgrade
)
fi

if apt --version &>/dev/null; then
log_task "Updating apt packages"
c sudo DEBIAN_FRONTEND=noninteractive apt update --yes
Expand Down