MCPcopy Index your code
hub / github.com/coder/envbox / GetOSReleaseID

Function GetOSReleaseID

dockerutil/image.go:284–298  ·  view source on GitHub ↗

GetOSReleaseID returns the ID of the operating system from the raw contents of /etc/os-release.

(raw []byte)

Source from the content-addressed store, hash-verified

282// GetOSReleaseID returns the ID of the operating system from the
283// raw contents of /etc/os-release.
284func 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
300func DefaultLogImagePullFn(log buildlog.Logger) func(ImagePullEvent) error {
301 var (

Callers 1

GetImageMetadataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected