Skip to content

Commit

Permalink
salt(cask): Add HOME env variable to plist files
Browse files Browse the repository at this point in the history
  • Loading branch information
cdalvaro committed Jan 10, 2024
1 parent cb29386 commit 245cdab
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions Casks/salt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

url "https://repo.saltproject.io/salt/py3/macos/minor/#{version}/salt-#{version}-py3-#{arch}.pkg"
name "Salt"
desc "World's fastest, most intelligent and scalable automation engine"
desc "Automation and infrastructure management engine"
homepage "https://saltproject.io/"

livecheck do
url "https://repo.saltproject.io/salt/py3/macos/latest"
regex(/salt-(\d+(?:\.\d+)?(?:-\d+)?)-py3-#{arch}\.pkg/)
regex(/salt[._-]v?(\d+(?:\.\d+)+)-py3-#{arch}\.pkg/)
end

conflicts_with formula: "salt"
Expand All @@ -30,6 +30,7 @@

xml["EnvironmentVariables"] = {} unless xml.key?("EnvironmentVariables")
xml["EnvironmentVariables"]["HOMEBREW_PREFIX"] = HOMEBREW_PREFIX.to_s
xml["EnvironmentVariables"]["HOME"] ||= "/var/root"

path = xml["EnvironmentVariables"]["PATH"] || "/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
path = "#{HOMEBREW_PREFIX}/bin:#{path}" unless path.split(":").include?("#{HOMEBREW_PREFIX}/bin")
Expand All @@ -49,36 +50,26 @@
end
end

uninstall pkgutil: [
"com.saltstack.salt",
],
launchctl: [
uninstall launchctl: [
"com.saltstack.salt.api",
"com.saltstack.salt.master",
"com.saltstack.salt.minion",
"com.saltstack.salt.syndic",
],
pkgutil: [
"com.saltstack.salt",
]

zap trash: [
"/etc/salt",
]
zap trash: "/etc/salt"

def caveats
<<~CAVEATS
After installation, configure the Salt minion ID, and the Salt master location,
replacing the placeholder text with custom information:
sudo salt-config -i [MINION_ID] -m [SALT_MASTER_HOST]
See Configure the Salt master and minions for more configuration options:
https://docs.saltproject.io/salt/install-guide/en/latest/topics/configure-master-minion.html
Load services you need:
Included services:
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.api
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.master
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.minion
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.syndic
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.api.plist
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.master.plist
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.minion.plist
sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.syndic.plist
CAVEATS
end
end

0 comments on commit 245cdab

Please sign in to comment.