| 27 | } |
| 28 | |
| 29 | func (r *RootFS) Validate() error { |
| 30 | // Validate rootfs download url. |
| 31 | if r.Url == "" { |
| 32 | return fmt.Errorf("rootfs.url is empty, it's required for downloading and caching") |
| 33 | } |
| 34 | |
| 35 | if r.SHA256 == "" { |
| 36 | return fmt.Errorf("rootfs.sha256 is empty, it's required for verification and caching") |
| 37 | } |
| 38 | |
| 39 | // Validate rootfs path and convert to absolute path. |
| 40 | if r.Path == "" { |
| 41 | return fmt.Errorf("rootfs.path is empty, it's required for specifying the root filesystem location") |
| 42 | } |
| 43 | |
| 44 | r.abspath = filepath.Join(r.ctx.Downloads(), "tools", r.Path) |
| 45 | |
| 46 | return nil |
| 47 | } |
| 48 | |
| 49 | func (r *RootFS) CheckAndRepair() error { |
| 50 | // Default folder name is the first folder name of archive name, |