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)