From 5b0b6429fa9c6eb6ac99da3b373e25b8d86b4a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xory=20=E2=80=8B?= Date: Wed, 17 Apr 2024 13:06:22 +0000 Subject: [PATCH] feat: reboot when done wiping --- src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 315a28c..239717d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,6 @@ fn get_block_devices() -> Vec { } pub fn handle_client() { - let block_devices: Vec = get_block_devices(); for blockdevice in block_devices { let diskname = format!("/dev/{blockdevice}"); @@ -51,10 +50,13 @@ pub fn handle_client() { disk.write_all(&buffer).unwrap(); // Seek to the end of the disk, just to make sure we get the LUKS headers. - disk.seek(io::SeekFrom::End(-byte_offset as i64)).unwrap(); + disk.seek(io::SeekFrom::End(-524288 as i64)).unwrap(); // Splash two. disk.write_all(&buffer).unwrap(); + + // Reboot. + Command::new("reboot").unwrap(); } } @@ -64,6 +66,6 @@ mod tests { #[test] fn test_disk_locator() { - assert_eq!(get_block_devices(), vec!["vda".to_string()]) + assert_eq!(get_block_devices(), vec!["vda".to_string()]) // Don't worry! This is *supposed* to not pass CI/CD. It should only be tested on QEMU/KVM Virtual Machines. } }