This commit is contained in:
parent
40a1498c6f
commit
c689ee87d4
2 changed files with 35 additions and 7 deletions
|
@ -15,9 +15,16 @@ pub fn setup_mkinitcpio(conf: &DriveConfig) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set kernel cmdline
|
// Set kernel cmdline
|
||||||
// TODO : Encryption support
|
|
||||||
std::fs::create_dir_all("/mnt/etc/kernel").unwrap();
|
std::fs::create_dir_all("/mnt/etc/kernel").unwrap();
|
||||||
std::fs::write("/mnt/etc/kernel/cmdline", format!("root={}", conf.root)).unwrap();
|
|
||||||
|
if conf.encryption.is_some() {
|
||||||
|
let block_uuid = find_uuid_by_dev(&conf.root).unwrap();
|
||||||
|
std::fs::write("/mnt/etc/kernel/cmdline",
|
||||||
|
format!("rd.luks.options=timeout=30s rd.luks.name={block_uuid}=root root=/dev/mapper/root rw")
|
||||||
|
).unwrap();
|
||||||
|
} else {
|
||||||
|
std::fs::write("/mnt/etc/kernel/cmdline", format!("root={}", conf.root)).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO : more configs
|
// TODO : more configs
|
||||||
print_status("Writing /etc/mkinitcpio.conf");
|
print_status("Writing /etc/mkinitcpio.conf");
|
||||||
|
@ -29,3 +36,29 @@ pub fn setup_mkinitcpio(conf: &DriveConfig) {
|
||||||
|
|
||||||
arch_chroot(&["mkinitcpio", "--allpresets"], None, true);
|
arch_chroot(&["mkinitcpio", "--allpresets"], None, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn find_uuid_by_dev(dev: &str) -> Option<String> {
|
||||||
|
let dir_path = "/dev/disk/by-uuid";
|
||||||
|
|
||||||
|
if let Ok(entries) = std::fs::read_dir(dir_path) {
|
||||||
|
for entry in entries.flatten() {
|
||||||
|
let path = entry.path();
|
||||||
|
|
||||||
|
if let Ok(target) = std::fs::read_link(&path) {
|
||||||
|
let resolved_path = path.parent().unwrap().join(&target);
|
||||||
|
|
||||||
|
if resolved_path
|
||||||
|
.to_string_lossy()
|
||||||
|
.ends_with(dev.split("/").last().unwrap())
|
||||||
|
{
|
||||||
|
// Match -> Return found Block Device UUID
|
||||||
|
if let Some(filename) = path.file_name() {
|
||||||
|
return Some(filename.to_string_lossy().to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// TODO : Setup ssh (config + authorized_keys)
|
|
||||||
// TODO : Setup virtualization
|
|
||||||
// TODO : Setup docker
|
|
||||||
// TODO : Autojoin docker swarm
|
// TODO : Autojoin docker swarm
|
||||||
// TODO : Autojoin teleport
|
// TODO : Autojoin teleport
|
||||||
|
|
||||||
|
@ -101,8 +98,6 @@ pub fn install(conf: InstallConfig) {
|
||||||
install_pkgs(&pkg::DESKTOP_PKG);
|
install_pkgs(&pkg::DESKTOP_PKG);
|
||||||
print_status("Enable SDDM");
|
print_status("Enable SDDM");
|
||||||
|
|
||||||
// TODO : Setup KDE Keyboard Layout
|
|
||||||
|
|
||||||
std::os::unix::fs::symlink(
|
std::os::unix::fs::symlink(
|
||||||
"/usr/lib/systemd/system/sddm.service",
|
"/usr/lib/systemd/system/sddm.service",
|
||||||
"/mnt/etc/systemd/system/display-manager.service",
|
"/mnt/etc/systemd/system/display-manager.service",
|
||||||
|
|
Loading…
Add table
Reference in a new issue