From f1e13a3582c3a62fd654118508503df6091be3e6 Mon Sep 17 00:00:00 2001 From: Daniel Soto <120605455+DanielSotoEstrada@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:40:41 -0700 Subject: [PATCH] DT-151 configure settings in rancher (#45) In order to configure Rancher Desktop to disable kubernetes and use moby as the container engine, we are forcing the factory reset first. In addition to this, we check if Rancher Desktop was installed manually with `brew` command. If this is true we uninstall that package to avoid any conflict. --- VERSION | 2 +- formula/ih-core.rb | 2 +- lib/core/rancher/step.sh | 23 +++++++++++++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index f8bc4c6..d8a023e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.18 +0.1.19 diff --git a/formula/ih-core.rb b/formula/ih-core.rb index daf0373..43917cb 100644 --- a/formula/ih-core.rb +++ b/formula/ih-core.rb @@ -1,5 +1,5 @@ class IhCore < Formula - VERSION="0.1.18" + VERSION="0.1.19" desc "Brew formula for installing core tools used at Included Health engineering." homepage "https://github.com/ConsultingMD/homebrew-ih-public" license "CC BY-NC-ND 4.0" diff --git a/lib/core/rancher/step.sh b/lib/core/rancher/step.sh index cf5901f..9552883 100644 --- a/lib/core/rancher/step.sh +++ b/lib/core/rancher/step.sh @@ -32,9 +32,28 @@ function ih::setup::core.rancher::install() { cp "${THIS_DIR}/io.rancherdesktop.profile.defaults.plist" "$HOME/Library/Preferences/io.rancherdesktop.profile.defaults.plist" - if command -v rdctl; then - rdctl shutdown + # Check if Rancher was installed manually + brew list rancher > /dev/null 2>&1 + RANCHERINSTALLED=$? + + #Check if IH Rancher is already installed + brew list ih-rancher > /dev/null 2>&1 + IHRANCHERINSTALLED=$? + + # If rancher or ih-rancher is already installed reset to factory + if [ $RANCHERINSTALLED -eq 0 ] || [ $IHRANCHERINSTALLED -eq 0 ] + then + $(/Applications/Rancher\ Desktop.app/Contents/Resources/resources/darwin/bin/rdctl factory-reset) fi + + # Check if Rancher was installed manually with brew + if [ $RANCHERINSTALLED -eq 0 ] + then + echo "Rancher Desktop was installed previously with brew command. In order to avoid any conflicts this script will uninstall that package". + echo "You may be required to enter your password" + brew uninstall rancher + fi + CASKSUCCEEDED=1 # Installation and configuration of Rancher Desktop