@@ -85,6 +85,8 @@ private static string GetDistroVersionId()
8585
8686 private static DistroInfo LoadDistroInfo ( )
8787 {
88+ DistroInfo result = null ;
89+
8890 // Sample os-release file:
8991 // NAME="Ubuntu"
9092 // VERSION = "14.04.3 LTS, Trusty Tahr"
@@ -100,7 +102,7 @@ private static DistroInfo LoadDistroInfo()
100102 if ( File . Exists ( "/etc/os-release" ) )
101103 {
102104 var lines = File . ReadAllLines ( "/etc/os-release" ) ;
103- var result = new DistroInfo ( ) ;
105+ result = new DistroInfo ( ) ;
104106 foreach ( var line in lines )
105107 {
106108 if ( line . StartsWith ( "ID=" , StringComparison . Ordinal ) )
@@ -112,10 +114,30 @@ private static DistroInfo LoadDistroInfo()
112114 result . VersionId = line . Substring ( 11 ) . Trim ( '"' , '\' ' ) ;
113115 }
114116 }
117+ }
118+ else if ( File . Exists ( "/etc/redhat-release" ) )
119+ {
120+ var lines = File . ReadAllLines ( "/etc/redhat-release" ) ;
121+
122+ if ( lines . Length >= 1 )
123+ {
124+ string line = lines [ 0 ] ;
125+ if ( line . StartsWith ( "Red Hat Enterprise Linux Server release 6." ) ||
126+ line . StartsWith ( "CentOS release 6." ) )
127+ {
128+ result = new DistroInfo ( ) ;
129+ result . Id = "rhel" ;
130+ result . VersionId = "6" ;
131+ }
132+ }
133+ }
115134
116- return NormalizeDistroInfo ( result ) ;
135+ if ( result != null )
136+ {
137+ result = NormalizeDistroInfo ( result ) ;
117138 }
118- return null ;
139+
140+ return result ;
119141 }
120142
121143 // For some distros, we don't want to use the full version from VERSION_ID. One example is
0 commit comments