From 71bc8573368445e876654072029ce8d7aa51ed69 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Sun, 5 Nov 2023 06:08:59 +0000 Subject: [PATCH] LatestLatest --- .../run_before_01-system-homebrew.sh.tmpl | 5 +- .../run_onchange_after_16-vnc.sh.tmpl | 2 +- ...efore_09-install-brew-dependencies.sh.tmpl | 65 +++++++++++++++++++ .../run_onchange_before_09-install-gh.sh.tmpl | 28 -------- .../run_onchange_before_09-install-go.tmpl | 26 -------- .../archlinux/common-dependencies | 1 + home/.chezmoitemplates/darwin/Brewfile | 1 + software.yml | 2 +- 8 files changed, 73 insertions(+), 57 deletions(-) create mode 100644 home/.chezmoiscripts/universal/run_onchange_before_09-install-brew-dependencies.sh.tmpl delete mode 100644 home/.chezmoiscripts/universal/run_onchange_before_09-install-gh.sh.tmpl delete mode 100644 home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl diff --git a/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl b/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl index c8d83dca..ab5a1ae4 100644 --- a/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl @@ -6,6 +6,9 @@ # This script ensures macOS has tools like `git` by installing the Xcode command-line developer tools if they are # not already installed. Then, on both Linux and macOS, it ensures Homebrew is installed. # +# It also tries to perform a system update and there may be some manual work required since it is not possible +# to completely automate the system update process for macOS. +# # ## Environment Variables # # * `NO_RESTART` - Set this variable to skip restarts triggered by system updates on macOS @@ -52,7 +55,7 @@ fi if [ -d /Applications ] && [ -d /Library ] && [ -z "$NO_RESTART" ]; then if command -v gtimeout > /dev/null; then # Allow 8 minutes for system updates - logg info 'Ensuring system software is upgraded (timing out after 8 minutes if system upgrade fails)' + logg info 'Ensuring system software is upgraded (timing out after 50 minutes if system upgrade fails)' sudo gtimeout 3000 softwareupdate -i -a -R || logg warn 'The system update command timed out after 50 minutes' else # If gtimeout is unavailable, then attempt system upgrade without a timeout (which usually works on fresh systems) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_16-vnc.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_16-vnc.sh.tmpl index 29ca9a23..3e436e01 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_16-vnc.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_16-vnc.sh.tmpl @@ -23,7 +23,7 @@ if [ -d /Applications ] && [ -d /System ]; then # To disable, run: sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off # Only enable when computer is not a corporate / work computer logg info 'Enabling VNC using the VNC_PASSWORD variable which is vncpass when nothing is specified' - sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -allowAccessFor -specifiedUsers -clientopts -setreqperm -reqperm yes -setvnclegacy -vnclegacy yes -setvncpw -vncpw "{{- if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "VNC_PASSWORD")) }}{{ includeTemplate "secrets/VNC_PASSWORD" | decrypt | trim }}{{ else }}{{ default "vncpass" (env "VNC_PASSWORD") }}{{ end }}" -restart -agent -privs -all -users "$USER" + sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -allowAccessFor -specifiedUsers -clientopts -setreqperm -reqperm yes -setvnclegacy -vnclegacy yes -setvncpw -vncpw "{{- if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "VNC_PASSWORD")) }}{{ includeTemplate "secrets/VNC_PASSWORD" | decrypt | trim }}{{ else }}{{ default "vncpass" (env "VNC_PASSWORD") }}{{ end }}" -restart -agent -privs -all -users "$USER" && logg success 'Finished running the macOS Remote Management kickstart executable' else # System is Linux ### VNC set-up / configuration diff --git a/home/.chezmoiscripts/universal/run_onchange_before_09-install-brew-dependencies.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-install-brew-dependencies.sh.tmpl new file mode 100644 index 00000000..6139180c --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_before_09-install-brew-dependencies.sh.tmpl @@ -0,0 +1,65 @@ +{{- if (ne .host.distro.family "windows") -}} +#!/usr/bin/env bash +# @file Delta / GH (GitHub CLI) Install +# @brief Ensures Delta and GH (the GitHub CLI) are installed via Homebrew +# @description +# This script installs various libraries that are loosely required by the eco-system that Install Doctor +# implements. It installs the following: +# +# 1. `delta` - Delta is used by the git config as an alternate, improved pager terminal user-interface +# 2. `gh` - GH (GitHub CLI) is included as a dependency for generating the global git config helper since GH provides a credential helper that can be used to authenticate calls on `github.com`. +# 3. `go` - The Go framework +# +# The script will check for the presence of each program before trying to install it via Homebrew. If any of these +# requirements are to be installed via native package managers, then the dependency should be declared in the system +# dependencies template file (i.e. `home/.chezmoitemplates/archlinux/common-dependencies` in the case of Archlinux). + +{{ includeTemplate "universal/profile-before" }} +{{ includeTemplate "universal/logg-before" }} + +### Ensure Go is installed +if ! command -v go > /dev/null; then + if command -v brew; then + logg 'Installing go via Homebrew' + brew install go || GO_EXIT_CODE=$? + if [ -n "$GO_EXIT_CODE" ]; then + logg error 'go was not successfully installed via Homebrew' + fi + else + logg 'brew is unavailable. Cannot use it to perform a system installation of node.' + fi +else + logg 'go is available' +fi + +### Ensure gh is installed +if ! command -v gh > /dev/null; then + if command -v brew; then + logg 'Installing gh via Homebrew' + brew install gh || GH_EXIT_CODE=$? + if [ -n "$GH_EXIT_CODE" ]; then + logg error 'gh was not successfully installed via Homebrew' + fi + else + logg 'brew is unavailable. Cannot use it to perform a system installation of node.' + fi +else + logg 'gh is available' +fi + +### Ensure delta is installed +if ! command -v delta > /dev/null; then + if command -v brew; then + logg 'Installing delta via Homebrew' + brew install delta || DELTA_EXIT_CODE=$? + if [ -n "$DELTA_EXIT_CODE" ]; then + logg error 'delta was not successfully installed via Homebrew' + fi + else + logg 'brew is unavailable. Cannot use it to perform a system installation of node.' + fi +else + logg 'delta is available' +fi + +{{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_09-install-gh.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-install-gh.sh.tmpl deleted file mode 100644 index 59607a3e..00000000 --- a/home/.chezmoiscripts/universal/run_onchange_before_09-install-gh.sh.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -{{- if (ne .host.distro.family "windows") -}} -#!/usr/bin/env bash -# @file GH (GitHub CLI) Install -# @brief Ensures GH (the GitHub CLI) is installed via Homebrew -# @description -# This script installs GH via Homebrew. GH is included as a dependency for -# generating the global git config helper since GH provides a credential -# helper that can be used to authenticate calls on `github.com`. - -{{ includeTemplate "universal/profile-before" }} -{{ includeTemplate "universal/logg-before" }} - -### Ensure gh is installed -if ! command -v gh > /dev/null; then - if command -v brew; then - logg 'Installing gh via Homebrew' - brew install gh || GH_EXIT_CODE=$? - if [ -n "$GH_EXIT_CODE" ]; then - logg error 'gh was not successfully installed via Homebrew' - fi - else - logg 'brew is unavailable. Cannot use it to perform a system installation of node.' - fi -else - logg 'gh is available' -fi - -{{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl deleted file mode 100644 index 256391fa..00000000 --- a/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -{{- if (ne .host.distro.family "windows") -}} -#!/usr/bin/env bash -# @file Go Install -# @brief Ensures Go is installed via Homebrew -# @description -# This script ensures Go is installed. It uses Homebrew to install Go. - -{{ includeTemplate "universal/profile-before" }} -{{ includeTemplate "universal/logg-before" }} - -### Ensure Go is installed -if ! command -v go > /dev/null; then - if command -v brew; then - logg 'Installing go via Homebrew' - brew install go || GO_EXIT_CODE=$? - if [ -n "$GO_EXIT_CODE" ]; then - logg error 'go was not successfully installed via Homebrew' - fi - else - logg 'brew is unavailable. Cannot use it to perform a system installation of node.' - fi -else - logg 'go is available' -fi - -{{ end -}} diff --git a/home/.chezmoitemplates/archlinux/common-dependencies b/home/.chezmoitemplates/archlinux/common-dependencies index ce531b4d..437ecccc 100644 --- a/home/.chezmoitemplates/archlinux/common-dependencies +++ b/home/.chezmoitemplates/archlinux/common-dependencies @@ -6,6 +6,7 @@ "expect" "file" "git" + "git-delta" "gnome" "go" "hopenpgp-tools" diff --git a/home/.chezmoitemplates/darwin/Brewfile b/home/.chezmoitemplates/darwin/Brewfile index 69b5691d..9f258df5 100644 --- a/home/.chezmoitemplates/darwin/Brewfile +++ b/home/.chezmoitemplates/darwin/Brewfile @@ -14,6 +14,7 @@ end brew "age" # Ensure macOS Bash gets upgraded to 5+ brew "bash" +brew "delta" brew "gawk" brew "glow" brew "gnupg" diff --git a/software.yml b/software.yml index 90b2598d..c5c660eb 100644 --- a/software.yml +++ b/software.yml @@ -6163,7 +6163,7 @@ softwarePackages: _bin: vdirsyncer _github: https://github.com/pimutils/vdirsyncer _name: vdirsyncer - _pre: echo "TODO - Implement the following command after automating the process of setting up contact groups / calendars to sync" && echo "vdirsyncer discover contacts" && echo "vdirsyncer sync contacts" && echo "TODO - Add to cron" && echo "*/30 * * * * /usr/local/bin/vdirsyncer sync > /dev/null" && echo "This should be in _post instead of _pre - it is here for testing purposes" + _todo: echo "TODO - Implement the following command after automating the process of setting up contact groups / calendars to sync" && echo "vdirsyncer discover contacts" && echo "vdirsyncer sync contacts" && echo "TODO - Add to cron" && echo "*/30 * * * * /usr/local/bin/vdirsyncer sync > /dev/null" && echo "This should be in _post instead of _pre - it is here for testing purposes" pipx: vdirsyncer charm: _bin: charm