This commit is contained in:
parent
0c13a7b258
commit
f2cb66ec29
26
src/main.rs
26
src/main.rs
@ -166,7 +166,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
|
||||
sgdisk
|
||||
.execute()
|
||||
.args(&[
|
||||
.args([
|
||||
"-Z",
|
||||
"-o",
|
||||
&format!("--new=1::+{}M", boot_size),
|
||||
@ -175,7 +175,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
"--typecode=1:EF00",
|
||||
"--typecode=2:EF02",
|
||||
])
|
||||
.arg(&disk_path)
|
||||
.arg(disk_path)
|
||||
.run()
|
||||
.context("Partitioning error")?;
|
||||
|
||||
@ -270,14 +270,14 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["passwd", "-d", "root"])
|
||||
.args(["passwd", "-d", "root"])
|
||||
.run()
|
||||
.context("Failed to delete the root password")?;
|
||||
|
||||
info!("Setting locale");
|
||||
fs::OpenOptions::new()
|
||||
.append(true)
|
||||
.write(true)
|
||||
//.write(true)
|
||||
.open(mount_point.path().join("etc/locale.gen"))
|
||||
.and_then(|mut locale_gen| locale_gen.write_all(b"en_US.UTF-8 UTF-8\n"))
|
||||
.context("Failed to create locale.gen")?;
|
||||
@ -298,7 +298,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["useradd", "-m", "aur"])
|
||||
.args(["useradd", "-m", "aur"])
|
||||
.run()
|
||||
.context("Failed to create temporary user to install AUR packages")?;
|
||||
|
||||
@ -309,7 +309,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["sudo", "-u", "aur"])
|
||||
.args(["sudo", "-u", "aur"])
|
||||
.arg("git")
|
||||
.arg("clone")
|
||||
.arg(format!(
|
||||
@ -323,7 +323,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&[
|
||||
.args([
|
||||
"bash",
|
||||
"-c",
|
||||
&format!(
|
||||
@ -337,7 +337,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["sudo", "-u", "aur"])
|
||||
.args(["sudo", "-u", "aur"])
|
||||
.args(&command.aur_helper.install_command)
|
||||
.args(aur_pacakges)
|
||||
.run()
|
||||
@ -347,7 +347,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["userdel", "-r", "aur"])
|
||||
.args(["userdel", "-r", "aur"])
|
||||
.run()
|
||||
.context("Failed to delete temporary aur user")?;
|
||||
|
||||
@ -413,7 +413,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["systemctl", "enable", "NetworkManager"])
|
||||
.args(["systemctl", "enable", "NetworkManager"])
|
||||
.run()
|
||||
.context("Failed to enable NetworkManager")?;
|
||||
|
||||
@ -433,7 +433,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["mkinitcpio", "-p", "linux61"])
|
||||
.args(["mkinitcpio", "-p", "linux61"])
|
||||
.run()
|
||||
.context("Failed to run mkinitcpio - do you have the base and linux packages installed?")?;
|
||||
|
||||
@ -444,7 +444,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
.expect("No tool for blkid")
|
||||
.execute()
|
||||
.arg(root_partition_base.path())
|
||||
.args(&["-o", "value", "-s", "UUID"])
|
||||
.args(["-o", "value", "-s", "UUID"])
|
||||
.run_text_output()
|
||||
.context("Failed to run blkid")?;
|
||||
let trimmed = uuid.trim();
|
||||
@ -467,7 +467,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&["bash", "-c"])
|
||||
.args(["bash", "-c"])
|
||||
.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().context("Failed to install grub")?;
|
||||
|
||||
|
@ -73,7 +73,7 @@ impl<'t, 'o> EncryptedDevice<'t, 'o> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'t, 'o> Drop for EncryptedDevice<'t, 'o> {
|
||||
impl Drop for EncryptedDevice<'_, '_> {
|
||||
fn drop(&mut self) {
|
||||
if self._close().is_err() {
|
||||
warn!("Error closing {}", self.name);
|
||||
@ -81,7 +81,7 @@ impl<'t, 'o> Drop for EncryptedDevice<'t, 'o> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'t, 'o> BlockDevice for EncryptedDevice<'t, 'o> {
|
||||
impl BlockDevice for EncryptedDevice<'_, '_> {
|
||||
fn path(&self) -> &Path {
|
||||
&self.path
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ impl LoopDevice {
|
||||
let losetup = Tool::find("losetup")?;
|
||||
let output = losetup
|
||||
.execute()
|
||||
.args(&["--find", "-P", "--show"])
|
||||
.args(["--find", "-P", "--show"])
|
||||
.arg(file)
|
||||
.output()
|
||||
.context("Error creating the image")?;
|
||||
|
@ -78,7 +78,7 @@ impl<'a> MountStack<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for MountStack<'a> {
|
||||
impl Drop for MountStack<'_> {
|
||||
fn drop(&mut self) {
|
||||
self._umount().ok();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ impl<'a> Partition<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> BlockDevice for Partition<'a> {
|
||||
impl BlockDevice for Partition<'_> {
|
||||
fn path(&self) -> &Path {
|
||||
&self.path
|
||||
}
|
||||
|
@ -73,10 +73,9 @@ impl<'a> StorageDevice<'a> {
|
||||
let name = if self
|
||||
.name
|
||||
.chars()
|
||||
.rev()
|
||||
.next()
|
||||
.next_back()
|
||||
.expect("Storage device name is empty")
|
||||
.is_digit(10)
|
||||
.is_ascii_digit()
|
||||
{
|
||||
format!("{}p{}", self.name, index)
|
||||
} else {
|
||||
@ -93,10 +92,10 @@ impl<'a> StorageDevice<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> BlockDevice for StorageDevice<'a> {
|
||||
impl BlockDevice for StorageDevice<'_> {
|
||||
fn path(&self) -> &Path {
|
||||
&self.path
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Origin for StorageDevice<'a> {}
|
||||
impl Origin for StorageDevice<'_> {}
|
||||
|
@ -12,7 +12,7 @@ pub fn qemu(command: args::QemuCommand) -> anyhow::Result<()> {
|
||||
let qemu = Tool::find("qemu-system-x86_64")?;
|
||||
|
||||
let mut run = qemu.execute();
|
||||
run.args(&[
|
||||
run.args([
|
||||
"-m",
|
||||
"4G",
|
||||
"-netdev",
|
||||
@ -33,7 +33,7 @@ pub fn qemu(command: args::QemuCommand) -> anyhow::Result<()> {
|
||||
|
||||
if PathBuf::from("/dev/kvm").exists() {
|
||||
debug!("KVM is enabled");
|
||||
run.args(&["-enable-kvm", "-cpu", "host"]);
|
||||
run.args(["-enable-kvm", "-cpu", "host"]);
|
||||
}
|
||||
|
||||
let err = run.exec();
|
||||
|
Loading…
x
Reference in New Issue
Block a user