parent
bc69d74ac2
commit
30e2db26ca
18 changed files with 257 additions and 337 deletions
|
@ -1,19 +1,18 @@
|
|||
use crate::{config::UserConfig, print_status, run_command};
|
||||
|
||||
use super::str_vec;
|
||||
use crate::{
|
||||
config::UserConfig,
|
||||
linux::{arch_chroot, install_file},
|
||||
print_status,
|
||||
};
|
||||
|
||||
/// Setup the users of the system
|
||||
pub fn setup_users(conf: &[UserConfig]) {
|
||||
let mut doas_conf = String::new();
|
||||
|
||||
for user in conf {
|
||||
run_command(
|
||||
&str_vec(vec!["arch-chroot", "/mnt", "useradd", "-m", &user.name]),
|
||||
None,
|
||||
false,
|
||||
);
|
||||
arch_chroot(&["useradd", "-m", &user.name], None, false);
|
||||
|
||||
run_command(
|
||||
&str_vec(vec!["arch-chroot", "/mnt", "passwd", &user.name]),
|
||||
arch_chroot(
|
||||
&["passwd", &user.name],
|
||||
Some(&format!("{}\n{}\n", user.password, user.password)),
|
||||
false,
|
||||
);
|
||||
|
@ -24,5 +23,5 @@ pub fn setup_users(conf: &[UserConfig]) {
|
|||
}
|
||||
}
|
||||
|
||||
std::fs::write("/mnt/etc/doas.conf", doas_conf).unwrap();
|
||||
install_file("/mnt/etc/doas.conf", &doas_conf, 0o644);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue