Class: Bwrap::Args::Bind::Device

Inherits:
Object
  • Object
show all
Includes:
Output
Defined in:
lib/bwrap/args/bind/device.rb

Overview

Device related binds.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Output

debug?, debug_output, error_output, handle_output_options, info_output, quiet?, trace?, trace_output, verb_output, verbose?, warn_output

Constructor Details

#initialize(args) ⇒ Device

Returns a new instance of Device.

Parameters:



14
15
16
# File 'lib/bwrap/args/bind/device.rb', line 14

def initialize args
  @args = args
end

Instance Attribute Details

#config=(value) ⇒ Object (writeonly)

Instance of Config.



11
12
13
# File 'lib/bwrap/args/bind/device.rb', line 11

def config=(value)
  @config = value
end

Instance Method Details

#bind_dev_driObject

Arguments to bind /dev/dri from host to sandbox.



27
28
29
30
31
# File 'lib/bwrap/args/bind/device.rb', line 27

def bind_dev_dri
  return unless @config&.graphics_acceleration

  @args.add :dev_mounts, %w{ --dev-bind /dev/dri /dev/dri }
end

#bind_pci_devicesObject

Arguments to bind /sys/devices/pci0000:00 from host to sandbox.



41
42
43
44
45
# File 'lib/bwrap/args/bind/device.rb', line 41

def bind_pci_devices
  return unless @config&.graphics_acceleration

  @args.add :dev_mounts, %w{ --ro-bind /sys/devices/pci0000:00 /sys/devices/pci0000:00 }
end

#bind_sys_dev_charObject

Arguments to bind /sys/dev/char from host to sandbox.



34
35
36
37
38
# File 'lib/bwrap/args/bind/device.rb', line 34

def bind_sys_dev_char
  return unless @config&.graphics_acceleration

  @args.add :dev_mounts, %w{ --ro-bind /sys/dev/char /sys/dev/char }
end

#dev_mountObject

Arguments for mounting devtmpfs to /dev.



19
20
21
22
23
24
# File 'lib/bwrap/args/bind/device.rb', line 19

def dev_mount
  return unless @config&.dev_mount

  debug "Mounting new devtmpfs to /dev"
  @args.add :dev_mounts, "--dev", "/dev"
end