pmb: Set PMBOOTSTRAP_CMD to argv[0] in environment

This allows for scripts run by pmbootstrap to figure out how pmbootstrap
was invoked, and with that invoke pmbootstrap even in unconventional
setups where "pmbootstrap" isn't an available command in $PATH.

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230325205337.105795-1-newbyte@postmarketos.org%3E
This commit is contained in:
Newbyte 2023-03-25 21:53:38 +01:00 committed by Oliver Smith
parent 06949ae870
commit bdbc7b3eb3
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 3 additions and 0 deletions

View File

@ -23,6 +23,9 @@ def main():
args = parse.arguments()
os.umask(0o22)
# Store script invocation command
os.environ["PMBOOTSTRAP_CMD"] = sys.argv[0]
# Sanity checks
other.check_grsec()
if not args.as_root and os.geteuid() == 0: