Lines Matching +full:release +full:- +full:version

1 //===--- Distro.cpp - Linux distribution detection support ------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
24 VFS.getBufferForFile("/etc/os-release");
26 File = VFS.getBufferForFile("/usr/lib/os-release");
31 File.get()->getBuffer().split(Lines, "\n");
32 Distro::DistroType Version = Distro::UnknownDistro;
36 if (Version == Distro::UnknownDistro && Line.starts_with("ID="))
37 Version = llvm::StringSwitch<Distro::DistroType>(Line.substr(3))
42 // On SLES, /etc/os-release was introduced in SLES 11.
47 return Version;
52 VFS.getBufferForFile("/etc/lsb-release");
57 File.get()->getBuffer().split(Lines, "\n");
58 Distro::DistroType Version = Distro::UnknownDistro;
61 if (Version == Distro::UnknownDistro &&
63 Version = llvm::StringSwitch<Distro::DistroType>(Line.substr(17))
100 return Version;
104 Distro::DistroType Version = Distro::UnknownDistro;
106 // Newer freedesktop.org's compilant systemd-based systems
107 // should provide /etc/os-release or /usr/lib/os-release.
108 Version = DetectOsRelease(VFS);
109 if (Version != Distro::UnknownDistro)
110 return Version;
112 // Older systems might provide /etc/lsb-release.
113 Version = DetectLsbRelease(VFS);
114 if (Version != Distro::UnknownDistro)
115 return Version;
117 // Otherwise try some distro-specific quirks for Red Hat...
119 VFS.getBufferForFile("/etc/redhat-release");
122 StringRef Data = File.get()->getBuffer();
123 if (Data.starts_with("Fedora release"))
127 if (Data.contains("release 7"))
129 else if (Data.contains("release 6"))
131 else if (Data.contains("release 5"))
140 StringRef Data = File.get()->getBuffer();
180 File = VFS.getBufferForFile("/etc/SuSE-release");
182 StringRef Data = File.get()->getBuffer();
186 if (!Line.trim().starts_with("VERSION"))
189 // Old versions have split VERSION and PATCHLEVEL
190 // Newer versions use VERSION = x.y
193 int Version;
197 if (!SplitVer.first.getAsInteger(10, Version) && Version > 10)
205 if (VFS.exists("/etc/gentoo-release"))
223 // is cross-compiling from BSD or Windows to Linux, and it would be
224 // meaningless to try to figure out the "distro" of the non-Linux host.