123456789101112131415161718 |
- use crate::cfg;
- use crate::exec::unix_execv;
- use crate::log::logger;
- pub fn switch_root() {
- let new_root = cfg::CFG.get().get_cfg().get_new_root();
- let new_init = cfg::CFG.get().get_cfg().get_new_init();
- let mut args = Vec::<String>::new();
- args.push("switch_root".to_string());
- args.push(new_root.clone());
- args.push(new_init.clone());
- logger().info("switch-root", format!(
- "switching to new root '{}' with new init '{}'...",
- new_root.as_str(),
- new_init.as_str()
- ).as_str());
- unix_execv("/usr/sbin/switch_root", args)
- }
|