diff --git a/Casks/apcupsd.rb b/Casks/apcupsd.rb new file mode 100644 index 000000000000..f5b1b94472ef --- /dev/null +++ b/Casks/apcupsd.rb @@ -0,0 +1,42 @@ +cask :v1 => 'apcupsd' do + version '3.14.13' + sha256 '79fe12be05eb4bac41c008d5eedc51712cdf454edc69534f2ac26f379024b353' + + url "https://downloads.sourceforge.net/project/apcupsd/osx-binaries%20-%20Stable/#{version}/Apcupsd-#{version}.dmg" + name 'Apcupsd' + homepage 'http://www.apcupsd.org/' + license :gpl + + if MacOS.release >= :el_capitan + preflight do + File.open("#{staged_path}/installer_choices.plist", 'w') do |file| + file.write <<-EOS.undent + + + + + apcupsd + + + EOS + end + + system '/usr/bin/sudo', '-E', '--', + '/usr/sbin/installer', '-target', 'LocalSystem', + '-pkg', "#{staged_path}/Apcupsd-#{version}.pkg", + '-applyChoiceChangesXML', "#{staged_path}/installer_choices.plist" + end + + caveats <<-EOS.undent + The #{token} daemon is not yet supported on OS X 10.11 El Capitan and above. + Only the #{token} agent will be installed. + EOS + else + pkg "Apcupsd-#{version}.pkg" + end + + uninstall :pkgutil => 'com.apcupsd.*', + :quit => 'com.apcupsd.apcagent' + + zap :delete => '~/Library/Preferences/com.apcupsd.apcagent.plist' +end