From 655009acb5c0fafe675b590ec554802b0ee4f0fb Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Sat, 4 Feb 2023 04:53:29 +0000 Subject: [PATCH] Update 8 files - /home/.chezmoiscripts/universal/run_onchange_before_05-install-homebrew.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl - /home/.chezmoitemplates/universal/common-dependencies - /home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl - /home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl --- ...n_onchange_before_05-install-homebrew.tmpl | 0 .../run_onchange_before_09-install-go.tmpl | 22 +++++++++++++++++++ ... run_onchange_before_09-node-version.tmpl} | 0 ...run_onchange_before_11-install-docker.tmpl | 8 +++++-- .../run_onchange_before_91-configure-gpg.tmpl | 4 +++- .../universal/common-dependencies | 1 + 6 files changed, 32 insertions(+), 3 deletions(-) rename home/.chezmoiscripts/{universal => _universal}/run_onchange_before_05-install-homebrew.tmpl (100%) create mode 100644 home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl rename home/.chezmoiscripts/universal/{run_onchange_before_09-ensure-node-version.tmpl => run_onchange_before_09-node-version.tmpl} (100%) diff --git a/home/.chezmoiscripts/universal/run_onchange_before_05-install-homebrew.tmpl b/home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl similarity index 100% rename from home/.chezmoiscripts/universal/run_onchange_before_05-install-homebrew.tmpl rename to home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl diff --git a/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl new file mode 100644 index 00000000..42402399 --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl @@ -0,0 +1,22 @@ +{{- if (ne .host.distro.family "windows") -}} +#!/usr/bin/env bash + +{{ 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/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl similarity index 100% rename from home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl diff --git a/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl index 40321bf0..32a15a74 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl @@ -96,8 +96,12 @@ if [ ! -d /Applications ] || [ ! -d /System ]; then sudo git clone https://github.com/google/gvisor.git /usr/local/src/gvisor cd /usr/local/src/gvisor sudo mkdir -p bin - sudo make copy TARGETS=runsc DESTINATION=bin/ - sudo cp ./bin/runsc /usr/local/bin + # Wait 3 minutes for build to finish, and if it does not use Go + sudo timeout 180 make copy TARGETS=runsc DESTINATION=bin/ + if [ -f ./bin/runsc ]; then + sudo cp ./bin/runsc /usr/local/bin + else + fi fi if [ ! -f /etc/docker/daemon.json ]; then diff --git a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl index 714b3c32..ddc9638d 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl @@ -9,7 +9,9 @@ if [ -n "$KEYID" ] && command -v gpg > /dev/null; then if [ ! -d "$HOME/.gnupg" ]; then mkdir "$HOME/.gnupg" fi - chown -R "$(whoami)" "$HOME/.gnupg/" + chown "$(whoami)" "$HOME/.gnupg" + chmod 700 "$HOME/.gnupg" + chown -Rf "$(whoami)" "$HOME/.gnupg/" find "$HOME/.gnupg" -type f -exec chmod 600 {} \; find "$HOME/.gnupg" -type d -exec chmod 700 {} \; if [ ! -f "$HOME/.gnupg/gpg.conf" ]; then diff --git a/home/.chezmoitemplates/universal/common-dependencies b/home/.chezmoitemplates/universal/common-dependencies index ad8d7102..045bb145 100644 --- a/home/.chezmoitemplates/universal/common-dependencies +++ b/home/.chezmoitemplates/universal/common-dependencies @@ -7,6 +7,7 @@ "curl" "expect" "git" + "go" "grep" "gnupg2" "jq"