More debug logs

This commit is contained in:
Roey Darwish Dror 2019-08-01 11:28:20 +03:00
parent 4ea5807a5a
commit 2c11c9b251

View File

@ -13,14 +13,14 @@ use crate::storage::*;
use crate::tool::Tool; use crate::tool::Tool;
use byte_unit::Byte; use byte_unit::Byte;
use failure::{Fail, ResultExt}; use failure::{Fail, ResultExt};
use log::{debug, error, info, warn, LevelFilter}; use log::{debug, error, info, log_enabled, warn, Level, LevelFilter};
use pretty_env_logger; use pretty_env_logger;
use std::collections::HashSet; use std::collections::HashSet;
use std::fs; use std::fs;
use std::io::{stdin, stdout, BufRead, Write}; use std::io::{stdin, stdout, BufRead, Write};
use std::os::unix::{fs::PermissionsExt, process::CommandExt as UnixCommandExt}; use std::os::unix::{fs::PermissionsExt, process::CommandExt as UnixCommandExt};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::exit; use std::process::{exit, Command as ProcessCommand};
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc; use std::sync::Arc;
use std::thread; use std::thread;
@ -218,6 +218,18 @@ fn create(command: CreateCommand, running: Arc<AtomicBool>) -> Result<(), Error>
let mount_stack = mount(mount_point.path(), &boot_filesystem, &root_filesystem)?; let mount_stack = mount(mount_point.path(), &boot_filesystem, &root_filesystem)?;
if log_enabled!(Level::Debug) {
debug!("lsblk:");
ProcessCommand::new("lsblk")
.arg("--fs")
.spawn()
.and_then(|mut p| p.wait())
.map_err(|e| {
error!("Error running lsblk: {}", e);
})
.ok();
}
let mut packages: HashSet<String> = [ let mut packages: HashSet<String> = [
"base", "base",
"grub", "grub",
@ -354,6 +366,12 @@ fn create(command: CreateCommand, running: Arc<AtomicBool>) -> Result<(), Error>
.arg(format!("grub-install --target=i386-pc --boot-directory /boot {} && grub-install --target=x86_64-efi --efi-directory /boot --boot-directory /boot --removable && grub-mkconfig -o /boot/grub/grub.cfg", disk_path.display())) .arg(format!("grub-install --target=i386-pc --boot-directory /boot {} && grub-install --target=x86_64-efi --efi-directory /boot --boot-directory /boot --removable && grub-mkconfig -o /boot/grub/grub.cfg", disk_path.display()))
.run(ErrorKind::Bootloader)?; .run(ErrorKind::Bootloader)?;
debug!(
"GRUB configuration: {}",
fs::read_to_string(mount_point.path().join("boot/grub/grub.cfg"))
.unwrap_or_else(|e| e.to_string())
);
if command.interactive { if command.interactive {
info!("Dropping you to chroot. Do as you wish to customize the installation"); info!("Dropping you to chroot. Do as you wish to customize the installation");
arch_chroot arch_chroot