SHA256
More work on install stage
This commit is contained in:
1 parent
1399c56135
commit
d68ee36afa
2 files changed
+65
-11
No files matched your search
+26
-1
@@ -104,7 +104,7 @@ impl std::fmt::Display for ExecCommandError {
|
||||
impl std::error::Error for ExecCommandError {}
|
||||
|
||||
/// exec given sommand with arguments, capturing stderr in case or failure
|
||||
fn exec_command(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError> {
|
||||
pub fn exec_command(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError> {
|
||||
let out = Command::new(cmd).args(args).output()?;
|
||||
if out.status.success() {
|
||||
Ok(())
|
||||
@@ -180,6 +180,20 @@ fn exec_command_log(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError>
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Chroot to chroot_dir and executes specified command there
|
||||
///
|
||||
pub fn exec_cmd_chroot(
|
||||
chroot_dir: &str,
|
||||
cmd: &str,
|
||||
args: &Vec<&str>,
|
||||
) -> Result<(), ExecCommandError> {
|
||||
let mut cmd_args: Vec<&str> = Vec::new();
|
||||
cmd_args.push(cmd);
|
||||
cmd_args.extend(args);
|
||||
exec_command("artix-chroot", &cmd_args)
|
||||
}
|
||||
|
||||
/// sync system time with chrony
|
||||
/// dinitctl start chrony
|
||||
pub fn dinit_sync_time_chrony() -> Result<(), ExecCommandError> {
|
||||
@@ -440,3 +454,14 @@ pub fn ls_dir_rec(dir_part: &Path) -> Result<Vec<String>, std::io::Error> {
|
||||
}
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
///
|
||||
/// Generates fstab file similar to
|
||||
/// fstabgen -t PARTLABEL mnt_dir >> mnt_dir/etc/fstab
|
||||
///
|
||||
pub fn fstabgen(mnt_dir: &str) -> Result<(), ExecCommandError> {
|
||||
let fstab_file_name = format!("{}/etc/fstab", mnt_dir);
|
||||
let fstab = exec_command_out("fstabgen", &vec!["-t", "PARTLABEL", mnt_dir])?;
|
||||
fs::write(&fstab_file_name, fstab)?;
|
||||
Ok(())
|
||||
}
|
||||
+39
-10
@@ -44,8 +44,7 @@ const ROOT_PARTLABEL_DEV: &str = "/dev/disk/by-partlabel/bee-root";
|
||||
///
|
||||
/// List of packages for desktop (elogind-dinit no need for headles system)
|
||||
///
|
||||
const PKG_LIST_CORE_DESKTOP: [&str; 18] = [
|
||||
"elogind-dinit",
|
||||
const PKG_LIST_CORE_DESKTOP: [&str; 19] = [
|
||||
"linux-kira-lts",
|
||||
"linux-firmware",
|
||||
"less",
|
||||
@@ -63,6 +62,8 @@ const PKG_LIST_CORE_DESKTOP: [&str; 18] = [
|
||||
"kira-blk-settings",
|
||||
"kira-linux-keyring",
|
||||
"kira-mirrorlist",
|
||||
"ly",
|
||||
"ly-dinit",
|
||||
];
|
||||
|
||||
// const PKG_LIST_MORE_DESKTOP: [&str; 11] = [
|
||||
@@ -92,19 +93,19 @@ const PKG_LIST_CORE_DESKTOP: [&str; 18] = [
|
||||
|
||||
// const PKG_LIST_MEDIA_DESKTOP: [&str; 4] = ["ffmpeg", "ffmpeg4.4", "strawberry", "mpv"];
|
||||
|
||||
const PKG_LIST_KDE_DESKTOP: [&str; 45] = [
|
||||
const PKG_LIST_KDE_DESKTOP: [&str; 44] = [
|
||||
"wireless-regdb",
|
||||
"wpa_supplicant",
|
||||
"wpa_supplicant-dinit",
|
||||
"networkmanager", //networkmanager
|
||||
"networkmanager", //networkmanager
|
||||
"networkmanager-dinit",
|
||||
"chrony", //internet time
|
||||
"chrony-dinit", //internet time
|
||||
"chrony", //internet time
|
||||
"chrony-dinit", //internet time
|
||||
"smartmontools",
|
||||
"cryptsetup",
|
||||
"btop",
|
||||
"fish",
|
||||
"pipewire", //sound
|
||||
"pipewire", //sound
|
||||
"pipewire-dinit",
|
||||
"pipewire-alsa",
|
||||
"pipewire-audio",
|
||||
@@ -129,13 +130,14 @@ const PKG_LIST_KDE_DESKTOP: [&str; 45] = [
|
||||
"plasma-desktop",
|
||||
"plasma-disks",
|
||||
"plasma-keyboard",
|
||||
"plasma-login-manager",
|
||||
"plasma-nm",
|
||||
"plasma-pa",
|
||||
"plasma-systemmonitor",
|
||||
"plasma-workspace",
|
||||
"ffmpeg", "ffmpeg4.4", "strawberry", "mpv",
|
||||
|
||||
"ffmpeg",
|
||||
"ffmpeg4.4",
|
||||
"strawberry",
|
||||
"mpv",
|
||||
];
|
||||
|
||||
// const PKG_LIST_AWESOME_DESKTOP: [&str; 5] = [
|
||||
@@ -241,6 +243,15 @@ pub fn init_disk(part_layout: &PartLayout, mnt_dir: &str) -> Result<(), ExecComm
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn config_stuff() -> Result<(), ExecCommandError> {
|
||||
log::info!("Generating fstab...");
|
||||
kira_system::fstabgen(MNT_DIR)?;
|
||||
|
||||
//kira_system::exec_cmd_chroot(chroot_dir, cmd, args)
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
enum InstallationState {
|
||||
UserConfirmDialog,
|
||||
@@ -332,6 +343,12 @@ async fn install_kde_desk_async(mnt_dir: String) -> Result<(), ExecCommandError>
|
||||
blocking::unblock(move || kira_system::basestrap(&mnt_dir, &PKG_LIST_KDE_DESKTOP)).await
|
||||
}
|
||||
|
||||
async fn config_stuff_async() -> Result<(), ExecCommandError> {
|
||||
use blocking;
|
||||
log::info!("Configuring installed system...");
|
||||
blocking::unblock(move || config_stuff()).await
|
||||
}
|
||||
|
||||
fn do_install(
|
||||
k_config: KiraConfig,
|
||||
) -> impl futures::Stream<Item = Result<(f32, String), ExecCommandError>> {
|
||||
@@ -401,6 +418,18 @@ fn do_install(
|
||||
return;
|
||||
}
|
||||
|
||||
// configuring system
|
||||
let res = config_stuff_async().await;
|
||||
let res_err = res.is_err();
|
||||
output
|
||||
.send(res.map(|_| (60.0f32, "Next step".into())))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
if res_err {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if send fails (receiver dropped/cancelled)
|
||||
// if output.send(res).await.is_err() {
|
||||
// return; // Exit early if UI is gone
|
||||
|
||||
Reference in new issue
Block a user