lanzatool: set permissons for all files in esp to 755
This commit is contained in:
parent
91b8cb02e4
commit
3a093d85ab
|
@ -1,4 +1,5 @@
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::os::unix::prelude::PermissionsExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
@ -107,5 +108,14 @@ fn copy(from: &Path, to: &Path) -> Result<()> {
|
||||||
};
|
};
|
||||||
fs::copy(from, to)
|
fs::copy(from, to)
|
||||||
.with_context(|| format!("Failed to copy from {} to {}", from.display(), to.display()))?;
|
.with_context(|| format!("Failed to copy from {} to {}", from.display(), to.display()))?;
|
||||||
|
|
||||||
|
// Set permission of all files copied to 0o755
|
||||||
|
let mut perms = fs::metadata(to)
|
||||||
|
.with_context(|| format!("File {} doesn't have metadata", to.display()))?
|
||||||
|
.permissions();
|
||||||
|
perms.set_mode(0o755);
|
||||||
|
fs::set_permissions(to, perms)
|
||||||
|
.with_context(|| format!("Failed to set permissions to: {}", to.display()))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub fn lanzaboote_image(
|
||||||
esp: &Path,
|
esp: &Path,
|
||||||
) -> Result<PathBuf> {
|
) -> Result<PathBuf> {
|
||||||
// objcopy copies files into the PE binary. That's why we have to write the contents
|
// objcopy copies files into the PE binary. That's why we have to write the contents
|
||||||
// of some bootspec properties to disks
|
// of some bootspec properties to disk
|
||||||
let kernel_cmdline_file = write_to_tmp(kernel_cmdline.join(" "))?;
|
let kernel_cmdline_file = write_to_tmp(kernel_cmdline.join(" "))?;
|
||||||
let kernel_path_file = write_to_tmp(esp_relative_path_string(esp, kernel_path))?;
|
let kernel_path_file = write_to_tmp(esp_relative_path_string(esp, kernel_path))?;
|
||||||
let initrd_path_file = write_to_tmp(esp_relative_path_string(esp, initrd_path))?;
|
let initrd_path_file = write_to_tmp(esp_relative_path_string(esp, initrd_path))?;
|
||||||
|
|
Loading…
Reference in New Issue