@@ -229,47 +229,47 @@ func PlatformInformationWithContext(ctx context.Context) (platform string, famil
229
229
version = contents [0 ]
230
230
}
231
231
}
232
- } else if common .PathExists (common .HostEtcWithContext (ctx , "neokylin-release" )) {
232
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "neokylin-release" )) {
233
233
contents , err := common .ReadLines (common .HostEtcWithContext (ctx , "neokylin-release" ))
234
234
if err == nil {
235
235
version = getRedhatishVersion (contents )
236
236
platform = getRedhatishPlatform (contents )
237
237
}
238
- } else if common .PathExists (common .HostEtcWithContext (ctx , "redhat-release" )) {
238
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "redhat-release" )) {
239
239
contents , err := common .ReadLines (common .HostEtcWithContext (ctx , "redhat-release" ))
240
240
if err == nil {
241
241
version = getRedhatishVersion (contents )
242
242
platform = getRedhatishPlatform (contents )
243
243
}
244
- } else if common .PathExists (common .HostEtcWithContext (ctx , "system-release" )) {
244
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "system-release" )) {
245
245
contents , err := common .ReadLines (common .HostEtcWithContext (ctx , "system-release" ))
246
246
if err == nil {
247
247
version = getRedhatishVersion (contents )
248
248
platform = getRedhatishPlatform (contents )
249
249
}
250
- } else if common .PathExists (common .HostEtcWithContext (ctx , "gentoo-release" )) {
250
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "gentoo-release" )) {
251
251
platform = "gentoo"
252
252
contents , err := common .ReadLines (common .HostEtcWithContext (ctx , "gentoo-release" ))
253
253
if err == nil {
254
254
version = getRedhatishVersion (contents )
255
255
}
256
- } else if common .PathExists (common .HostEtcWithContext (ctx , "SuSE-release" )) {
256
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "SuSE-release" )) {
257
257
contents , err := common .ReadLines (common .HostEtcWithContext (ctx , "SuSE-release" ))
258
258
if err == nil {
259
259
version = getSuseVersion (contents )
260
260
platform = getSusePlatform (contents )
261
261
}
262
262
// TODO: slackware detecion
263
- } else if common .PathExists (common .HostEtcWithContext (ctx , "arch-release" )) {
263
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "arch-release" )) {
264
264
platform = "arch"
265
265
version = lsb .Release
266
- } else if common .PathExists (common .HostEtcWithContext (ctx , "alpine-release" )) {
266
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "alpine-release" )) {
267
267
platform = "alpine"
268
268
contents , err := common .ReadLines (common .HostEtcWithContext (ctx , "alpine-release" ))
269
269
if err == nil && len (contents ) > 0 && contents [0 ] != "" {
270
270
version = contents [0 ]
271
271
}
272
- } else if common .PathExists (common .HostEtcWithContext (ctx , "os-release" )) {
272
+ } else if common .PathExistsWithContents (common .HostEtcWithContext (ctx , "os-release" )) {
273
273
p , v , err := common .GetOSReleaseWithContext (ctx )
274
274
if err == nil {
275
275
platform = p
0 commit comments