Sha256: 6b79dfcef24895ad225b20baa09df89b3990b4cc63e911b9f0fbdca6f11cdeef

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

module Vagrant
  module LXC
    module Action
      class Boot
        def initialize(app, env)
          @app = app
        end

        def call(env)
          @env = env

          config = env[:machine].provider_config

          utsname = env[:machine].config.vm.hostname || env[:machine].id
          config.customize 'uts.name', utsname

          # Fix apparmor issues when starting Ubuntu 14.04 containers
          # See https://github.com/fgrehm/vagrant-lxc/issues/278 for more information
          if Dir.exists?('/sys/fs/pstore')
            config.customize 'mount.entry', '/sys/fs/pstore sys/fs/pstore none bind,optional 0 0'
          end

          # Make selinux read-only, see
          # https://github.com/fgrehm/vagrant-lxc/issues/301
          if Dir.exists?('/sys/fs/selinux')
            config.customize 'mount.entry', '/sys/fs/selinux sys/fs/selinux none bind,ro 0 0'
          end

          if config.tmpfs_mount_size && !config.tmpfs_mount_size.empty?
            # Make /tmp a tmpfs to prevent init scripts from nuking synced folders mounted in here
            config.customize 'mount.entry', "tmpfs tmp tmpfs nodev,nosuid,size=#{config.tmpfs_mount_size} 0 0"
          end

          env[:ui].info I18n.t("vagrant_lxc.messages.starting")
          env[:machine].provider.driver.start(config.customizations)

          @app.call env
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-lxc-2.1-patch-1.4.0 lib/vagrant-lxc/action/boot.rb