aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-02-20 18:42:33 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-02-20 18:42:33 +0100
commit767192c7a1afaa7265ccb706671785f2c9d9f02f (patch)
tree657d868509d2bdb99c16468cfcb060444fc6b916
parent4180babde83dfab8f6869d634f66b811624c4921 (diff)
mount /boot
-rw-r--r--Cargo.toml1
-rw-r--r--src/main.rs7
2 files changed, 8 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ecdfc84..536e404 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,4 +7,5 @@ edition = "2021"
[dependencies]
anyhow = "1.0.68"
+sys-mount = "2.0.2"
termcolor = "1.1.3"
diff --git a/src/main.rs b/src/main.rs
index 9514132..e9f1f8a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,6 +4,7 @@ use std::io::Write;
use std::process::{self, Command, ExitCode};
use std::thread;
use std::time::Duration;
+use sys_mount::{Mount, Unmount, UnmountFlags};
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
fn start() -> anyhow::Result<()> {
@@ -47,6 +48,12 @@ fn start() -> anyhow::Result<()> {
fn main() -> ExitCode {
let mut stdout = StandardStream::stdout(ColorChoice::Always);
+ let _mount = Mount::builder()
+ .fstype("vfat")
+ .mount("/dev/disk/by-partuuid/00000000-01", "/boot")
+ .expect("can't mount boot partition")
+ .into_unmount_drop(UnmountFlags::DETACH);
+
if process::id() != 1 {
match stdout.set_color(ColorSpec::new().set_fg(Some(Color::Red))) {
Ok(_) => match writeln!(&mut stdout, "Must be run as PID 1") {