2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-11-04 04:01:10 +00:00
|
|
|
require "requirement"
|
|
|
|
|
2020-08-19 06:51:31 +02:00
|
|
|
# A requirement on TunTap for macOS.
|
|
|
|
#
|
|
|
|
# @api private
|
2015-06-15 09:56:04 +01:00
|
|
|
class TuntapRequirement < Requirement
|
2020-10-20 12:03:48 +02:00
|
|
|
extend T::Sig
|
|
|
|
|
2014-11-04 04:01:10 +00:00
|
|
|
fatal true
|
2014-12-25 20:44:43 +00:00
|
|
|
cask "tuntap"
|
2016-09-17 15:32:44 +01:00
|
|
|
satisfy(build_env: false) { self.class.binary_tuntap_installed? }
|
2014-11-04 04:01:10 +00:00
|
|
|
|
2020-10-20 12:03:48 +02:00
|
|
|
sig { returns(T::Boolean) }
|
2014-11-04 04:01:10 +00:00
|
|
|
def self.binary_tuntap_installed?
|
2016-07-10 13:53:37 +01:00
|
|
|
%w[
|
|
|
|
/Library/Extensions/tun.kext
|
|
|
|
/Library/Extensions/tap.kext
|
|
|
|
/Library/LaunchDaemons/net.sf.tuntaposx.tun.plist
|
|
|
|
/Library/LaunchDaemons/net.sf.tuntaposx.tap.plist
|
|
|
|
].all? { |file| File.exist?(file) }
|
2014-11-04 04:01:10 +00:00
|
|
|
end
|
|
|
|
end
|