Self-check: any packaged usr/bin file is an executable
The console onboarding wrapper needs 0755 to be started by agetty; the manifest check hardcoded 644 for everything except the CLI binary.
This commit is contained in:
parent
aff2f1165d
commit
70b7dd15e5
1 changed files with 5 additions and 1 deletions
|
|
@ -43,7 +43,11 @@ pub fn check() -> Result<(), String> {
|
|||
}
|
||||
let path = format!("/{}", fields[3]);
|
||||
let metadata = fs::symlink_metadata(&path).map_err(|e| format!("{path}: {e}"))?;
|
||||
let expected = if path == "/usr/bin/archipelago" { binary_seen = true; "755" } else { "644" };
|
||||
if path == "/usr/bin/archipelago" { binary_seen = true; }
|
||||
// Executables live in usr/bin; everything else is data and must not be
|
||||
// executable. The console onboarding wrapper is run by agetty, so it is
|
||||
// a packaged executable like the CLI itself.
|
||||
let expected = if fields[3].starts_with("usr/bin/") { "755" } else { "644" };
|
||||
if fields[0] != expected || fields[1] != "0" || fields[2] != "0"
|
||||
|| !metadata.is_file() || metadata.uid() != 0 || metadata.gid() != 0
|
||||
|| format!("{:o}", metadata.mode() & 0o7777) != expected {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue