Class: MediaWikiVagrant::LsbCheck::Provisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/mediawiki-vagrant/lsb_check/provisioner.rb

Overview

Validates lsb_release vendor and version

Instance Method Summary collapse

Instance Method Details

#provisionObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mediawiki-vagrant/lsb_check/provisioner.rb', line 6

def provision
  execute_inline <<-end_
    set -e
    sudo /vagrant/support/package-bootstrap.sh lsb-release lsb_release
    REQUIRED_VENDOR=#{config.vendor}
    REQUIRED_VERSION=#{config.version}
    VENDOR=$(lsb_release -is)
    VERSION=$(lsb_release -rs)
    if ! [[ $VENDOR == $REQUIRED_VENDOR && $VERSION =~ $REQUIRED_VERSION ]]; then
      echo "MediaWiki-Vagrant requires a $REQUIRED_VENDOR $REQUIRED_VERSION guest OS"
      echo 'Your guest OS reports:'
      lsb_release -irc | sed 's/^/    /'
      echo 'Please rebuild using `vagrant destroy -f; vagrant up`'
      echo 'NOTE: this will cause you to lose any data saved in the VM.'
      echo 'If you nee to preserve the data, see'
      echo 'https://www.mediawiki.org/wiki/MediaWiki-Vagrant/OS_upgrade'
      exit 1
    fi
  end_
end