SHA256
More work on install stage
This commit is contained in:
1 parent
029df21d3e
commit
1399c56135
3 files changed
+176
-14
No files matched your search
@@ -72,7 +72,7 @@ LocalFileSigLevel = Optional
|
|||||||
# kira linux base repository
|
# kira linux base repository
|
||||||
[kira-base]
|
[kira-base]
|
||||||
SigLevel = Required TrustedOnly
|
SigLevel = Required TrustedOnly
|
||||||
Server = https://repos.kira-linux.org/kira-base/x86_64
|
Include = /etc/pacman.d/kira-mirrorlist
|
||||||
|
|
||||||
# The gremlins repositories are disabled by default. To enable, uncomment the
|
# The gremlins repositories are disabled by default. To enable, uncomment the
|
||||||
# repo name header and Include lines. You can add preferred servers immediately
|
# repo name header and Include lines. You can add preferred servers immediately
|
||||||
|
|||||||
+58
-5
@@ -124,6 +124,62 @@ fn exec_command_out(cmd: &str, args: &Vec<&str>) -> Result<String, ExecCommandEr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Exec command and logs its output via log::info! in real time
|
||||||
|
///
|
||||||
|
fn exec_command_log(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError> {
|
||||||
|
use std::io::{BufRead, BufReader};
|
||||||
|
use std::process::{Command, Stdio};
|
||||||
|
use std::thread;
|
||||||
|
|
||||||
|
log::debug!("Executing command {} {:?}", cmd, args);
|
||||||
|
|
||||||
|
// Configure the command to pipe stdout
|
||||||
|
let mut child = Command::new(cmd)
|
||||||
|
.args(args)
|
||||||
|
.stdout(Stdio::piped())
|
||||||
|
.stderr(Stdio::piped())
|
||||||
|
.spawn()?;
|
||||||
|
|
||||||
|
// Take ownership of the stdout handle
|
||||||
|
let stdout = child
|
||||||
|
.stdout
|
||||||
|
.take()
|
||||||
|
.ok_or("Failed to capture stdout".to_string())?;
|
||||||
|
let mut stderr = child
|
||||||
|
.stderr
|
||||||
|
.take()
|
||||||
|
.ok_or("Failed to capture stderr".to_string())?;
|
||||||
|
|
||||||
|
let stderr_handle = thread::spawn(move || {
|
||||||
|
let mut buf = Vec::new();
|
||||||
|
use std::io::Read;
|
||||||
|
let _ = stderr.read_to_end(&mut buf);
|
||||||
|
buf
|
||||||
|
});
|
||||||
|
|
||||||
|
// Wrap in BufReader for efficient line-by-line reading
|
||||||
|
let reader = BufReader::new(stdout);
|
||||||
|
|
||||||
|
// Iterate and log each line in real time
|
||||||
|
for line in reader.lines() {
|
||||||
|
match line {
|
||||||
|
Ok(text) => log::info!("{}: {}", cmd, text),
|
||||||
|
Err(e) => log::error!("Read error: {}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for the process to finish to prevent zombies and check status
|
||||||
|
let status = child.wait()?;
|
||||||
|
let stderr_output = stderr_handle.join().unwrap();
|
||||||
|
|
||||||
|
if status.success() {
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(CommandFailed::new(cmd, args, stderr_output).into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// sync system time with chrony
|
/// sync system time with chrony
|
||||||
/// dinitctl start chrony
|
/// dinitctl start chrony
|
||||||
pub fn dinit_sync_time_chrony() -> Result<(), ExecCommandError> {
|
pub fn dinit_sync_time_chrony() -> Result<(), ExecCommandError> {
|
||||||
@@ -133,7 +189,7 @@ pub fn dinit_sync_time_chrony() -> Result<(), ExecCommandError> {
|
|||||||
/// Install base system
|
/// Install base system
|
||||||
/// basestrap /mnt base base-devel dinit elogind-dinit
|
/// basestrap /mnt base base-devel dinit elogind-dinit
|
||||||
pub fn basestrap_dinit(root_dir: &str) -> Result<(), ExecCommandError> {
|
pub fn basestrap_dinit(root_dir: &str) -> Result<(), ExecCommandError> {
|
||||||
exec_command(
|
exec_command_log(
|
||||||
"basestrap",
|
"basestrap",
|
||||||
&vec![root_dir, "base", "base-devel", "dinit", "elogind-dinit"],
|
&vec![root_dir, "base", "base-devel", "dinit", "elogind-dinit"],
|
||||||
)
|
)
|
||||||
@@ -142,10 +198,7 @@ pub fn basestrap_dinit(root_dir: &str) -> Result<(), ExecCommandError> {
|
|||||||
pub fn basestrap(root_dir: &str, pkg_list: &[&str]) -> Result<(), ExecCommandError> {
|
pub fn basestrap(root_dir: &str, pkg_list: &[&str]) -> Result<(), ExecCommandError> {
|
||||||
let mut args: Vec<&str> = vec![root_dir];
|
let mut args: Vec<&str> = vec![root_dir];
|
||||||
args.extend(pkg_list);
|
args.extend(pkg_list);
|
||||||
exec_command(
|
exec_command_log("basestrap", &args)
|
||||||
"basestrap",
|
|
||||||
&args,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Executes parted command with given arguments
|
/// Executes parted command with given arguments
|
||||||
|
|||||||
+117
-8
@@ -44,17 +44,108 @@ const ROOT_PARTLABEL_DEV: &str = "/dev/disk/by-partlabel/bee-root";
|
|||||||
///
|
///
|
||||||
/// List of packages for desktop (elogind-dinit no need for headles system)
|
/// List of packages for desktop (elogind-dinit no need for headles system)
|
||||||
///
|
///
|
||||||
const PKG_LIST_DESKTOP: [&str; 8] = [
|
const PKG_LIST_CORE_DESKTOP: [&str; 18] = [
|
||||||
"elogind-dinit",
|
"elogind-dinit",
|
||||||
"linux-kira-lts",
|
"linux-kira-lts",
|
||||||
"linux-firmware",
|
"linux-firmware",
|
||||||
|
"less",
|
||||||
|
"sudo",
|
||||||
|
"nano",
|
||||||
|
"diffutils",
|
||||||
"bcachefs-tools",
|
"bcachefs-tools",
|
||||||
"xfsprogs",
|
"xfsprogs",
|
||||||
"exfatprogs",
|
"exfatprogs",
|
||||||
"f2fs-tools",
|
"f2fs-tools",
|
||||||
|
"dosfstools",
|
||||||
|
"efibootmgr",
|
||||||
|
"nvme-cli",
|
||||||
"hive-up",
|
"hive-up",
|
||||||
|
"kira-blk-settings",
|
||||||
|
"kira-linux-keyring",
|
||||||
|
"kira-mirrorlist",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// const PKG_LIST_MORE_DESKTOP: [&str; 11] = [
|
||||||
|
// "wireless-regdb",
|
||||||
|
// "wpa_supplicant",
|
||||||
|
// "wpa_supplicant-dinit",
|
||||||
|
// "networkmanager",
|
||||||
|
// "networkmanager-dinit",
|
||||||
|
// "chrony", //internet time
|
||||||
|
// "chrony-dinit", //internet time
|
||||||
|
// "smartmontools",
|
||||||
|
// "cryptsetup",
|
||||||
|
// "btop",
|
||||||
|
// "fish",
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// const PKG_LIST_SOUND_DESKTOP: [&str; 8] = [
|
||||||
|
// "pipewire",
|
||||||
|
// "pipewire-dinit",
|
||||||
|
// "pipewire-alsa",
|
||||||
|
// "pipewire-audio",
|
||||||
|
// "pipewire-jack",
|
||||||
|
// "pipewire-pulse",
|
||||||
|
// "wireplumber",
|
||||||
|
// "wireplumber-dinit",
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// const PKG_LIST_MEDIA_DESKTOP: [&str; 4] = ["ffmpeg", "ffmpeg4.4", "strawberry", "mpv"];
|
||||||
|
|
||||||
|
const PKG_LIST_KDE_DESKTOP: [&str; 45] = [
|
||||||
|
"wireless-regdb",
|
||||||
|
"wpa_supplicant",
|
||||||
|
"wpa_supplicant-dinit",
|
||||||
|
"networkmanager", //networkmanager
|
||||||
|
"networkmanager-dinit",
|
||||||
|
"chrony", //internet time
|
||||||
|
"chrony-dinit", //internet time
|
||||||
|
"smartmontools",
|
||||||
|
"cryptsetup",
|
||||||
|
"btop",
|
||||||
|
"fish",
|
||||||
|
"pipewire", //sound
|
||||||
|
"pipewire-dinit",
|
||||||
|
"pipewire-alsa",
|
||||||
|
"pipewire-audio",
|
||||||
|
"pipewire-jack",
|
||||||
|
"pipewire-pulse",
|
||||||
|
"wireplumber",
|
||||||
|
"wireplumber-dinit",
|
||||||
|
"mesa",
|
||||||
|
"libva",
|
||||||
|
"libva-utils",
|
||||||
|
"power-profiles-daemon",
|
||||||
|
"power-profiles-daemon-dinit",
|
||||||
|
"plasma-desktop",
|
||||||
|
"plasma-workspace",
|
||||||
|
"xdg-desktop-portal-kde",
|
||||||
|
"kwallet-pam",
|
||||||
|
"kwayland-integration",
|
||||||
|
"libappindicator",
|
||||||
|
"okular",
|
||||||
|
"partitionmanager",
|
||||||
|
"plasma-browser-integration",
|
||||||
|
"plasma-desktop",
|
||||||
|
"plasma-disks",
|
||||||
|
"plasma-keyboard",
|
||||||
|
"plasma-login-manager",
|
||||||
|
"plasma-nm",
|
||||||
|
"plasma-pa",
|
||||||
|
"plasma-systemmonitor",
|
||||||
|
"plasma-workspace",
|
||||||
|
"ffmpeg", "ffmpeg4.4", "strawberry", "mpv",
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// const PKG_LIST_AWESOME_DESKTOP: [&str; 5] = [
|
||||||
|
// "mesa",
|
||||||
|
// "libva",
|
||||||
|
// "libva-utils",
|
||||||
|
// "awesome",
|
||||||
|
// "wiremix", // pipewire sound control
|
||||||
|
// ];
|
||||||
|
|
||||||
/// Creates new GPT table and partitions from PartLayout
|
/// Creates new GPT table and partitions from PartLayout
|
||||||
pub fn create_partitions(part_layout: &PartLayout) -> Result<(), ExecCommandError> {
|
pub fn create_partitions(part_layout: &PartLayout) -> Result<(), ExecCommandError> {
|
||||||
log::info!("Creating GPT part table...");
|
log::info!("Creating GPT part table...");
|
||||||
@@ -229,10 +320,16 @@ async fn install_base_async(mnt_dir: String) -> Result<(), ExecCommandError> {
|
|||||||
blocking::unblock(move || kira_system::basestrap_dinit(&mnt_dir)).await
|
blocking::unblock(move || kira_system::basestrap_dinit(&mnt_dir)).await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn install_system_async(mnt_dir: String) -> Result<(), ExecCommandError> {
|
async fn install_core_desk_async(mnt_dir: String) -> Result<(), ExecCommandError> {
|
||||||
use blocking;
|
use blocking;
|
||||||
log::info!("Installing base system...");
|
log::info!("Installing core desktop packages...");
|
||||||
blocking::unblock(move || kira_system::basestrap(&mnt_dir, &PKG_LIST_DESKTOP)).await
|
blocking::unblock(move || kira_system::basestrap(&mnt_dir, &PKG_LIST_CORE_DESKTOP)).await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn install_kde_desk_async(mnt_dir: String) -> Result<(), ExecCommandError> {
|
||||||
|
use blocking;
|
||||||
|
log::info!("Installing KDE desktop packages...");
|
||||||
|
blocking::unblock(move || kira_system::basestrap(&mnt_dir, &PKG_LIST_KDE_DESKTOP)).await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_install(
|
fn do_install(
|
||||||
@@ -272,7 +369,7 @@ fn do_install(
|
|||||||
let res = install_base_async(MNT_DIR.into()).await;
|
let res = install_base_async(MNT_DIR.into()).await;
|
||||||
let res_err = res.is_err();
|
let res_err = res.is_err();
|
||||||
output
|
output
|
||||||
.send(res.map(|_| (10.0f32, "Installing system".into())))
|
.send(res.map(|_| (10.0f32, "Installing core system".into())))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@@ -280,11 +377,23 @@ fn do_install(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// installing system
|
// installing core system
|
||||||
let res = install_system_async(MNT_DIR.into()).await;
|
let res = install_core_desk_async(MNT_DIR.into()).await;
|
||||||
let res_err = res.is_err();
|
let res_err = res.is_err();
|
||||||
output
|
output
|
||||||
.send(res.map(|_| (20.0f32, "Some other stuff".into())))
|
.send(res.map(|_| (20.0f32, "Installing KDE desktop envirometn".into())))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if res_err {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// installing KDE
|
||||||
|
let res = install_kde_desk_async(MNT_DIR.into()).await;
|
||||||
|
let res_err = res.is_err();
|
||||||
|
output
|
||||||
|
.send(res.map(|_| (50.0f32, "Configuring system".into())))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user