require_programs: Debian: find kpartx and losetup (MR 2475)

In Debian, /usr/sbin is not in PATH of regular users unless using sudo.
Fix that pmbootstrap won't find kpartx and losetup in /usr/sbin, and
complains about these even though they are installed.

Fixes: issue 2489
This commit is contained in:
Oliver Smith 2024-11-03 13:25:51 +01:00
parent ef9d618199
commit c4194759f5
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -37,7 +37,9 @@ import pmb.parse._apkbuild
def require_programs() -> None:
missing = []
for program in pmb.config.required_programs:
if not shutil.which(program):
# Debian: some programs are in /usr/sbin, which is not in PATH
# unless using sudo
if not shutil.which(program) and not os.path.exists(os.path.join("/usr/sbin", program)):
missing.append(program)
losetup_missing_json = False