Commit bd4057910b117b8b44fd45b771ffd67316421ea9
Exists in
master
and in
4 other branches
Merge pull request #3603 from axilleas/os-name
Added os_name support for systems running systemd.
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
lib/tasks/gitlab/task_helpers.rake
@@ -16,7 +16,7 @@ namespace :gitlab do | @@ -16,7 +16,7 @@ namespace :gitlab do | ||
16 | # Check which OS is running | 16 | # Check which OS is running |
17 | # | 17 | # |
18 | # It will primarily use lsb_relase to determine the OS. | 18 | # It will primarily use lsb_relase to determine the OS. |
19 | - # It has fallbacks to Debian, SuSE and OS X. | 19 | + # It has fallbacks to Debian, SuSE, OS X and systems running systemd. |
20 | def os_name | 20 | def os_name |
21 | os_name = run("lsb_release -irs") | 21 | os_name = run("lsb_release -irs") |
22 | os_name ||= if File.readable?('/etc/system-release') | 22 | os_name ||= if File.readable?('/etc/system-release') |
@@ -32,6 +32,9 @@ namespace :gitlab do | @@ -32,6 +32,9 @@ namespace :gitlab do | ||
32 | os_name ||= if os_x_version = run("sw_vers -productVersion") | 32 | os_name ||= if os_x_version = run("sw_vers -productVersion") |
33 | "Mac OS X #{os_x_version}" | 33 | "Mac OS X #{os_x_version}" |
34 | end | 34 | end |
35 | + os_name ||= if File.readable?('/etc/os-release') | ||
36 | + File.read('/etc/os-release').match(/PRETTY_NAME=\"(.+)\"/)[1] | ||
37 | + end | ||
35 | os_name.try(:squish!) | 38 | os_name.try(:squish!) |
36 | end | 39 | end |
37 | 40 |