add libvirt support
This commit is contained in:
parent
823f4e9c78
commit
4f7789c4a8
3 changed files with 29 additions and 3 deletions
|
@ -61,6 +61,9 @@ doas_root= true
|
|||
# Add user to Docker group
|
||||
docker = true
|
||||
|
||||
# Add user to libvirt group
|
||||
virtualization = true
|
||||
|
||||
# SSH Configuration
|
||||
# If `[ssh]` is set, openssh will be installed and enabled.
|
||||
[ssh]
|
||||
|
|
|
@ -43,6 +43,7 @@ pub struct UserConfig {
|
|||
pub password: String,
|
||||
pub doas_root: Option<bool>,
|
||||
pub docker: Option<bool>,
|
||||
pub virtualization: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
|
|
|
@ -31,8 +31,8 @@ pub mod user;
|
|||
pub mod zram;
|
||||
|
||||
use crate::{
|
||||
config::InstallConfig,
|
||||
linux::install_file,
|
||||
config::{InstallConfig, InstallMode},
|
||||
linux::{arch_chroot, install_file, systemd_service_enable},
|
||||
pkg::{self, install_pkgs, pacstrap},
|
||||
print_status,
|
||||
};
|
||||
|
@ -126,7 +126,29 @@ pub fn install(conf: InstallConfig) {
|
|||
}
|
||||
|
||||
if conf.pkg.virtualization.unwrap_or_default() {
|
||||
// TODO : Enable virtualization
|
||||
let user_conf = if let Some(user_conf) = &conf.user {
|
||||
user_conf.clone()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
install_pkgs(&["libvirt"]);
|
||||
|
||||
if matches!(conf.general.mode, InstallMode::Desktop) {
|
||||
install_pkgs(&["virt-manager"]);
|
||||
}
|
||||
|
||||
systemd_service_enable("libvirtd.service");
|
||||
|
||||
for user in user_conf {
|
||||
if user.virtualization.unwrap_or_default() {
|
||||
arch_chroot(
|
||||
&vec!["usermod", "-a", "-G", "libvirt", user.name.as_str()],
|
||||
None,
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if conf.pkg.docker.unwrap_or_default() {
|
||||
|
|
Loading…
Add table
Reference in a new issue