| 97 | } |
| 98 | |
| 99 | fn ensure_exists(self) -> Result<Self> { |
| 100 | if !self.initrd.exists() { |
| 101 | bail!("Initrd does not exist: {}", self.initrd.display()); |
| 102 | } |
| 103 | if !self.kernel.exists() { |
| 104 | bail!("Kernel does not exist: {}", self.kernel.display()); |
| 105 | } |
| 106 | if let Some(hda) = &self.hda { |
| 107 | if !hda.exists() { |
| 108 | bail!("Hda does not exist: {}", hda.display()); |
| 109 | } |
| 110 | } |
| 111 | if let Some(rootfs) = &self.rootfs { |
| 112 | if !rootfs.exists() { |
| 113 | bail!("Rootfs does not exist: {}", rootfs.display()); |
| 114 | } |
| 115 | } |
| 116 | if let Some(bios) = &self.bios { |
| 117 | if !bios.exists() { |
| 118 | bail!("Bios does not exist: {}", bios.display()); |
| 119 | } |
| 120 | } |
| 121 | Ok(self) |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | fn guess_version(base_path: &Path) -> Option<String> { |