From f0527ea2abee37ad3fa1a66ded79e75ce3c651b2 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Wed, 24 Feb 2021 11:22:18 +0100 Subject: [PATCH] Fill in main function --- disk_image/src/main.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/disk_image/src/main.rs b/disk_image/src/main.rs index 9e6928f8..638a1435 100644 --- a/disk_image/src/main.rs +++ b/disk_image/src/main.rs @@ -2,11 +2,23 @@ use std::{ convert::TryFrom, fs::{self, File}, io::{self, Seek}, - path::Path, + path::{Path, PathBuf}, }; fn main() { - println!("Hello, world!"); + // take efi file path as command line argument + let mut args = std::env::args(); + let _exe_name = args.next().unwrap(); + let efi_path = PathBuf::from( + args.next() + .expect("path to `.efi` files must be given as argument"), + ); + + let fat_path = efi_path.with_extension("fat"); + let disk_path = fat_path.with_extension("img"); + + create_fat_filesystem(&fat_path, &efi_path); + create_gpt_disk(&disk_path, &fat_path); } fn create_fat_filesystem(fat_path: &Path, efi_file: &Path) {