From 71565142ede2ae8b0a7fec8cb67412b40f0e582c Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 18 Aug 2023 13:16:06 +0200 Subject: [PATCH] Fix permissions and add option --mode --- install-python | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/install-python b/install-python index 3497ca6..5b5852f 100755 --- a/install-python +++ b/install-python @@ -8,6 +8,7 @@ import sys ap = argparse.ArgumentParser() ap.add_argument("source") ap.add_argument("destination") +ap.add_argument("--mode", "-m", type=lambda x: int(x, base=8)) args = ap.parse_args() @@ -22,6 +23,8 @@ with open(args.source) as inf: outf.write(first_line) for line in inf: outf.write(line) + if args.mode is not None: + os.chmod(tmp_dest, args.mode) + else: + shutil.copymode(args.source, tmp_dest) os.rename(tmp_dest, args.destination) - -shutil.copymode(args.source, args.destination)