A more reliable way to detect Ubuntu

lsb_release command is included in lsb-release package. Sometimes this is
not installed; ex: Docker official Ubuntu image.
/etc/os-release is included in base-files package,
so this is more reliable than lsb_release.
This commit is contained in:
Yuya.Nishida 2016-06-28 01:41:29 +09:00
parent a4f45a18a6
commit 05782f1d0e
1 changed files with 1 additions and 1 deletions

View File

@ -2,7 +2,7 @@ module VagrantPlugins
module GuestUbuntu
class Guest < Vagrant.plugin("2", :guest)
def detect?(machine)
machine.communicate.test("[ -x /usr/bin/lsb_release ] && /usr/bin/lsb_release -i 2>/dev/null | grep Ubuntu")
machine.communicate.test("test -r /etc/os-release && . /etc/os-release && test xubuntu = x$ID")
end
end
end