2012-04-19 04:23:25 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module GuestUbuntu
|
2014-05-06 19:50:35 +00:00
|
|
|
class Guest < Vagrant.plugin("2", :guest)
|
2013-04-04 04:47:57 +00:00
|
|
|
def detect?(machine)
|
2016-07-23 15:40:36 +00:00
|
|
|
# This command detects if we are running on Ubuntu. /etc/os-release is
|
|
|
|
# available on modern Ubuntu versions, but does not exist on 14.04 and
|
|
|
|
# previous versions, so we fall back to lsb_release.
|
|
|
|
#
|
|
|
|
# GH-7524
|
|
|
|
# GH-7625
|
|
|
|
#
|
|
|
|
machine.communicate.test <<-EOH.gsub(/^ {10}/, "")
|
|
|
|
if test -r /etc/os-release; then
|
|
|
|
source /etc/os-release && test xubuntu = x$ID
|
|
|
|
elif test -x /usr/bin/lsb_release; then
|
|
|
|
/usr/bin/lsb_release -i 2>/dev/null | grep -q Ubuntu
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
EOH
|
2013-04-04 04:47:57 +00:00
|
|
|
end
|
2011-03-01 07:38:30 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|