| 96 | } |
| 97 | |
| 98 | func (s *staticBooter) ReadBootFile(id ID) (io.ReadCloser, int64, error) { |
| 99 | path := string(id) |
| 100 | switch { |
| 101 | case path == "kernel": |
| 102 | return s.serveFile(s.kernel) |
| 103 | |
| 104 | case strings.HasPrefix(path, "initrd-"): |
| 105 | i, err := strconv.Atoi(path[7:]) |
| 106 | if err != nil || i < 0 || i >= len(s.initrd) { |
| 107 | return nil, -1, fmt.Errorf("no file with ID %q", id) |
| 108 | } |
| 109 | return s.serveFile(s.initrd[i]) |
| 110 | |
| 111 | case strings.HasPrefix(path, "other-"): |
| 112 | i, err := strconv.Atoi(path[6:]) |
| 113 | if err != nil || i < 0 || i >= len(s.otherIDs) { |
| 114 | return nil, -1, fmt.Errorf("no file with ID %q", id) |
| 115 | } |
| 116 | return s.serveFile(s.otherIDs[i]) |
| 117 | } |
| 118 | |
| 119 | return nil, -1, fmt.Errorf("no file with ID %q", id) |
| 120 | } |
| 121 | |
| 122 | func (s *staticBooter) WriteBootFile(ID, io.Reader) error { |
| 123 | return nil |