From 05ec829eea0d0d136a1c2f7c87c275d9652ce245 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Tue, 5 Dec 2023 07:59:05 +0000 Subject: [PATCH] Various fixes in software.yml --- home/.chezmoidata.yaml | 2 +- home/dot_local/bin/executable_install-program | 37 ++++++++++--------- software.yml | 2 + 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/home/.chezmoidata.yaml b/home/.chezmoidata.yaml index b288f105..11eb1112 100644 --- a/home/.chezmoidata.yaml +++ b/home/.chezmoidata.yaml @@ -1739,7 +1739,7 @@ softwarePlugins: - if ! helm plugin list | grep "Query at a given interval a Prometheus, ElasticSearch or Sentry instance." > /dev/null; then helm plugin install https://github.com/ContainerSolutions/helm-monitor; fi - if ! helm plugin list | grep "This plugin provides secrets values encryption for Helm charts secure storing" > /dev/null; then helm plugin install https://github.com/jkroepke/helm-secrets; fi krew: - cmd: bash -c 'if ! kubectl krew list | grep "^{PLUGIN}$" > /dev/null; then if ! kubectl krew search "{PLUGIN}" | grep ' unavailable on ' > /dev/null; then kubectl krew install "{PLUGIN}"; else echo "UNSUPPORTED PLATFORM - {PLUGIN} is not supported on the current platform"; fi; fi' + cmd: bash -c 'if ! kubectl krew list | grep "^{PLUGIN}$" > /dev/null; then if ! kubectl krew search "{PLUGIN}" | grep " unavailable on " > /dev/null; then kubectl krew install "{PLUGIN}"; else echo "UNSUPPORTED PLATFORM - {PLUGIN} is not supported on the current platform"; fi; fi' plugins: - access-matrix - cert-manager diff --git a/home/dot_local/bin/executable_install-program b/home/dot_local/bin/executable_install-program index daf207a3..9638e1c9 100644 --- a/home/dot_local/bin/executable_install-program +++ b/home/dot_local/bin/executable_install-program @@ -772,7 +772,7 @@ async function beforeInstall(packageManager) { log('error', 'Homebrew', 'Failed running brew update / upgrade') log('info', 'Homebrew', 'Running brew tap --repair and trying again') try { - runCommand('Repairing taps and retrying brew update / upgrade', 'sudo rm -rf $(brew --cache) && brew tap --repair && brew update && brew upgrade --cask --greedy && brew upgrade --force --greedy') + runCommand('Repairing taps and retrying brew update / upgrade', 'export HOMEBREW_TEMP=/tmp && sudo rm -rf $(brew --cache) && brew tap --repair && brew update && brew upgrade --cask --greedy && brew upgrade --force --greedy') } catch (e) { console.log(e) log('error', 'Homebrew', 'Failed both attempts to run brew update / upgrade') @@ -1789,30 +1789,31 @@ async function pruneInstallOrders(installOrders) { async function installPlugins(pluginData) { if (pluginData.cmd && pluginData.plugins && pluginData.plugins.length) { - for (const plugin of pluginData.plugins) { - try { - const pluginCmd = pluginData.cmd.replace(/{PLUGIN}/g, plugin) - const pluginWhen = pluginData.when + const pluginWhen = pluginData.when + try { + runCommand(`Checking when condition for ${pluginData.package} plugin - ${plugin}`, pluginWhen) + for (const plugin of pluginData.plugins) { try { - if (pluginWhen) { - runCommand(`Checking when condition for ${pluginData.package} plugin - ${plugin}`, pluginWhen) - } + const pluginCmd = pluginData.cmd.replace(/{PLUGIN}/g, plugin) try { - runCommand(`Installing ${pluginData.package} plugin - ${plugin}`, pluginCmd) - log('success', 'Plugin', `Successfully installed ${pluginData.package} plugin - ${plugin}`) + try { + runCommand(`Installing ${pluginData.package} plugin - ${plugin}`, pluginCmd) + log('success', 'Plugin', `Successfully installed ${pluginData.package} plugin - ${plugin}`) + } catch (e) { + log('info', 'Plugin', `Failed to install ${pluginData.package} plugin - ${plugin}`) + console.error(e) + } } catch (e) { - log('info', 'Plugin', `Failed to install ${pluginData.package} plugin - ${plugin}`) - console.error(e) + log('info', 'Plugin', `Skipping ${pluginData.package} plugin installs due to failed when condition - ${pluginWhen}`) + break } } catch (e) { - log('info', 'Plugin', `Skipping ${pluginData.package} plugin installs due to failed when condition - ${pluginWhen}`) - break + log('error', 'Plugin', `Failed to install ${pluginData.package} plugin due to an unknown reason - ${plugin}`) + console.error(e) } - } catch (e) { - log('error', 'Plugin', `Failed to install ${pluginData.package} plugin due to an unknown reason - ${plugin}`) - console.error(e) } - + } catch (e) { + log('info', 'Plugin', 'Failed to pass when condition') } } if (pluginData.update) { diff --git a/software.yml b/software.yml index 28dbca59..a83bf090 100644 --- a/software.yml +++ b/software.yml @@ -1294,6 +1294,7 @@ softwarePackages: brew-pkg: _github: https://github.com/timsutton/brew-pkg _name: Homebrew Pkg + _when:brew:darwin: '! brew list brew-pkg' brew:darwin: timsutton/formulae/brew-pkg xpanes: _bin: xpanes @@ -10235,6 +10236,7 @@ softwarePackages: _bin: github-classroom-assistant _github: https://github.com/education/classroom-assistant _name: GitHub Classroom Assistant + _app: Classroom Assistant.app apt: https://github.com/education/classroom-assistant/releases/download/v2.0.4/classroom-assistant_2.0.4_amd64.deb dnf: https://github.com/education/classroom-assistant/releases/download/v2.0.4/classroom-assistant-2.0.4-1.x86_64.rpm cask: classroom-assistant