// GENFSTAB use crate::{config::GeneralConfig, print_status, run_command}; use super::{str_vec, uncomment_first_value_of}; pub fn genfstab() { print_status("Generating fstab"); let (stdout, _) = run_command(&str_vec(vec!["genfstab", "-U", "/mnt"]), None, false); std::fs::write("/mnt/etc/fstab", stdout).unwrap(); } pub fn first_boot_values(conf: &GeneralConfig) { // Locale print_status(&format!("Setting locale {}", conf.locale)); std::fs::write( "/mnt/etc/locale.conf", format!("LANG=\"{}\"\n", conf.locale), ) .unwrap(); // Timezone print_status(&format!("Setting timezone {}", conf.timezone)); let tz_paths = conf.timezone.split('/').collect::>(); let mut tz_link = std::path::PathBuf::from("/usr/share/zoneinfo/"); for path in tz_paths { tz_link.push(path); } std::os::unix::fs::symlink(tz_link, "/mnt/etc/localtime").unwrap(); // Keymap print_status("Writing /etc/vconsole.conf"); std::fs::write( "/mnt/etc/vconsole.conf", format!("KEYMAP=\"{}\"", conf.keymap), ) .unwrap(); // Hostname print_status("Writing /etc/hostname"); std::fs::write("/mnt/etc/hostname", format!("{}\n", conf.hostname)).unwrap(); // LOCALE print_status("Setting locale"); uncomment_first_value_of(&conf.locale, "/mnt/etc/locale.gen"); run_command( &str_vec(vec!["arch-chroot", "/mnt", "locale-gen"]), None, false, ); run_command( &str_vec(vec!["arch-chroot", "/mnt", "hwclock", "--systohc"]), None, false, ); run_command( &str_vec(vec![ "arch-chroot", "/mnt", "systemctl", "enable", "NetworkManager.service", ]), None, false, ); }