homebrew-cask/Casks/wireshark-chmodbpf.rb

73 lines
2.6 KiB
Ruby

cask 'wireshark-chmodbpf' do
version '2.4.2'
sha256 '111ff7313055ebbc72a2fee4f7b691c723e182c777f5341fd74b279b106686e8'
url "https://www.wireshark.org/download/osx/Wireshark%20#{version}%20Intel%2064.dmg"
appcast 'https://www.wireshark.org/download/osx/',
checkpoint: 'cbc1a63057cb15e99867a1b890a8eb4c5e434968d466a547d8def6096f94fabb'
name 'Wireshark-ChmodBPF'
homepage 'https://www.wireshark.org/'
conflicts_with cask: 'wireshark'
depends_on macos: '>= :mountain_lion'
pkg "Wireshark #{version} Intel 64.pkg",
choices: [
{
'choiceIdentifier' => 'wireshark',
'choiceAttribute' => 'selected',
'attributeSetting' => 0,
},
{
'choiceIdentifier' => 'chmodbpf',
'choiceAttribute' => 'selected',
'attributeSetting' => 1,
},
{
'choiceIdentifier' => 'cli',
'choiceAttribute' => 'selected',
'attributeSetting' => 0,
},
]
postflight do
system_command '/usr/sbin/dseditgroup',
args: [
'-o', 'edit',
'-a', Etc.getpwuid(Process.euid).name,
'-t', 'user',
'--', 'access_bpf'
],
sudo: true
end
uninstall_preflight do
set_ownership '/Library/Application Support/Wireshark'
end
uninstall pkgutil: 'org.wireshark.ChmodBPF.pkg',
launchctl: 'org.wireshark.ChmodBPF',
script: {
executable: '/usr/sbin/dseditgroup',
args: ['-o', 'delete', 'access_bpf'],
must_succeed: false,
sudo: true,
}
caveats do
reboot
<<-EOS.undent
This cask will install only the ChmodBPF package from the current Wireshark
stable install package.
An access_bpf group will be created and its members allowed access to BPF
devices at boot to allow unprivileged packet captures.
This cask is not required if installing the Wireshark cask. It is meant to
support Wireshark installed from Homebrew or other cases where unprivileged
access to macOS packet capture devices is desired without installing the binary
distribution of Wireshark.
The user account used to install this cask will be added to the access_bpf
group automatically.
EOS
end
end