-
-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve kylin support for linuxos module #5873
base: dev
Are you sure you want to change the base?
Conversation
@@ -143,12 +143,11 @@ function linuxos.version() | |||
if version == nil and os.isfile("/etc/os-release") then | |||
local os_release = io.readfile("/etc/os-release") | |||
if os_release then | |||
os_release = os_release:trim():lower():split("\n") | |||
for _, line in ipairs(os_release) do | |||
os_release_lines = os_release:trim():lower():split("\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local os_release_lines
-- kylin case 2: | ||
-- VERSION="4.0.2 (juniper)" | ||
-- VERSION_ID="4.0.2" | ||
if line:find("version_id=") and os_release:find("kylin", 1, true) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowercase or uppercase? and please use line:startswith
line = line:sub(12) | ||
version = semver.match(line) | ||
if not version then | ||
version = line:match("\"(.*)\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = line:trim('"')
@@ -176,7 +191,7 @@ function linuxos.version() | |||
-- get it from lsb release | |||
if version == nil then | |||
local lsb_release = linuxos._lsb_release() | |||
if lsb_release and lsb_release:find("ubuntu", 1, true) then | |||
if lsb_release and (lsb_release:find("ubuntu", 1, true) or lsb_release:find("kylin", 1, true)) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) or
two spaces
i improve kylin support for linuxos module, making it more robust.