linuxutils_system/
pivot_root.rs1use linuxutils_common::man::ManContent;
2
3pub const MAN: ManContent = ManContent::empty();
4
5use clap::Parser;
6use std::process::ExitCode;
7
8#[derive(Parser)]
14#[command(name = "pivot_root", about = "Change the root filesystem")]
15pub struct Args {
16 new_root: String,
18
19 put_old: String,
21}
22
23pub fn run(args: Args) -> ExitCode {
24 if let Err(e) = rustix::process::pivot_root(&args.new_root, &args.put_old) {
25 eprintln!(
26 "pivot_root: failed to pivot from '{}' to '{}': {}",
27 args.new_root,
28 args.put_old,
29 std::io::Error::from(e)
30 );
31 return ExitCode::FAILURE;
32 }
33 ExitCode::SUCCESS
34}