feat: reboot when done wiping

This commit is contained in:
Xory ​ 2024-04-17 13:06:22 +00:00
parent 780c7207c4
commit 5b0b6429fa

View file

@ -25,7 +25,6 @@ fn get_block_devices() -> Vec<String> {
} }
pub fn handle_client() { pub fn handle_client() {
let block_devices: Vec<String> = get_block_devices(); let block_devices: Vec<String> = get_block_devices();
for blockdevice in block_devices { for blockdevice in block_devices {
let diskname = format!("/dev/{blockdevice}"); let diskname = format!("/dev/{blockdevice}");
@ -51,10 +50,13 @@ pub fn handle_client() {
disk.write_all(&buffer).unwrap(); disk.write_all(&buffer).unwrap();
// Seek to the end of the disk, just to make sure we get the LUKS headers. // 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. // Splash two.
disk.write_all(&buffer).unwrap(); disk.write_all(&buffer).unwrap();
// Reboot.
Command::new("reboot").unwrap();
} }
} }
@ -64,6 +66,6 @@ mod tests {
#[test] #[test]
fn test_disk_locator() { 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.
} }
} }