|
|
@ -2,7 +2,7 @@ use crate::internal::exec::*;
|
|
|
|
use crate::internal::*;
|
|
|
|
use crate::internal::*;
|
|
|
|
|
|
|
|
|
|
|
|
pub fn new_user(username: &str, hasroot: bool, password: &str) {
|
|
|
|
pub fn new_user(username: &str, hasroot: bool, password: &str) {
|
|
|
|
let return_val = exec(
|
|
|
|
let return_val = exec_chroot(
|
|
|
|
"useradd",
|
|
|
|
"useradd",
|
|
|
|
vec![
|
|
|
|
vec![
|
|
|
|
String::from("-m"),
|
|
|
|
String::from("-m"),
|
|
|
@ -23,7 +23,7 @@ pub fn new_user(username: &str, hasroot: bool, password: &str) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if hasroot {
|
|
|
|
if hasroot {
|
|
|
|
let return_val = exec(
|
|
|
|
let return_val = exec_chroot(
|
|
|
|
"usermod",
|
|
|
|
"usermod",
|
|
|
|
vec![
|
|
|
|
vec![
|
|
|
|
String::from("-a"),
|
|
|
|
String::from("-a"),
|
|
|
@ -41,11 +41,9 @@ pub fn new_user(username: &str, hasroot: bool, password: &str) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let return_val = exec(
|
|
|
|
let return_val = exec_chroot(
|
|
|
|
"arch-chroot",
|
|
|
|
"usermod",
|
|
|
|
vec![
|
|
|
|
vec![
|
|
|
|
String::from("/mnt"),
|
|
|
|
|
|
|
|
String::from("usermod"),
|
|
|
|
|
|
|
|
String::from("--password"),
|
|
|
|
String::from("--password"),
|
|
|
|
String::from("$(echo"),
|
|
|
|
String::from("$(echo"),
|
|
|
|
String::from(format!("${}", password)),
|
|
|
|
String::from(format!("${}", password)),
|
|
|
@ -72,11 +70,9 @@ pub fn new_user(username: &str, hasroot: bool, password: &str) {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn root_pass(root_pass: &str) {
|
|
|
|
pub fn root_pass(root_pass: &str) {
|
|
|
|
println!("Setting root password to '{}'", root_pass);
|
|
|
|
println!("Setting root password to '{}'", root_pass);
|
|
|
|
let return_val = exec(
|
|
|
|
let return_val = exec_chroot(
|
|
|
|
"arch-chroot",
|
|
|
|
"usermod",
|
|
|
|
vec![
|
|
|
|
vec![
|
|
|
|
String::from("/mnt"),
|
|
|
|
|
|
|
|
String::from("usermod"),
|
|
|
|
|
|
|
|
String::from("--password"),
|
|
|
|
String::from("--password"),
|
|
|
|
String::from("$(echo"),
|
|
|
|
String::from("$(echo"),
|
|
|
|
String::from(format!("${{{}}}", root_pass)),
|
|
|
|
String::from(format!("${{{}}}", root_pass)),
|
|
|
|