GetOSReleaseID returns the ID of the operating system from the raw contents of /etc/os-release.
(raw []byte)
| 282 | // GetOSReleaseID returns the ID of the operating system from the |
| 283 | // raw contents of /etc/os-release. |
| 284 | func GetOSReleaseID(raw []byte) string { |
| 285 | var osReleaseID string |
| 286 | for _, line := range strings.Split(string(raw), "\n") { |
| 287 | if strings.HasPrefix(line, "ID=") { |
| 288 | osReleaseID = strings.TrimPrefix(line, "ID=") |
| 289 | // The value may be quoted. |
| 290 | osReleaseID = strings.Trim(osReleaseID, "\"") |
| 291 | break |
| 292 | } |
| 293 | } |
| 294 | if osReleaseID == "" { |
| 295 | return "linux" |
| 296 | } |
| 297 | return osReleaseID |
| 298 | } |
| 299 | |
| 300 | func DefaultLogImagePullFn(log buildlog.Logger) func(ImagePullEvent) error { |
| 301 | var ( |