diff --git a/CHANGES.md b/CHANGES.md index 788280a..f45db8f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,7 +8,6 @@ - `--auto` option removed - `--local` option removed, defaults to local user install - `--global` option renamed to `--system` - - `--force` option removed - install.py modifies autojump.sh accordingly for custom installations - it is recommended that maintainers use install.py with `--destdir` and `--prefix` accordingly. Two stage installations requires manually updating diff --git a/install.py b/install.py index 0a7b34c..f515c3b 100755 --- a/install.py +++ b/install.py @@ -55,6 +55,9 @@ def parse_arguments(): parser.add_argument( '-n', '--dryrun', action="store_true", default=False, help='simulate installation') + parser.add_argument( + '-f', '--force', action="store_true", default=False, + help='skip root user, shell type, Python version checks') parser.add_argument( '-d', '--destdir', metavar='DIR', default=default_user_destdir, help='set destination to DIR') @@ -70,13 +73,20 @@ def parse_arguments(): args = parser.parse_args() - if sys.version_info[0] == 2 and sys.version_info[1] < 7: - print("Python v2.7+ or v3.0+ required.", file=sys.stderr) - sys.exit(1) + if not args.force: + if sys.version_info[0] == 2 and sys.version_info[1] < 7: + print("Python v2.7+ or v3.0+ required.", file=sys.stderr) + sys.exit(1) + + if get_shell() not in SUPPORTED_SHELLS: + print("Unsupported shell: %s" % os.getenv('SHELL'), + file=sys.stderr) + sys.exit(1) - if get_shell() not in SUPPORTED_SHELLS: - print("Unsupported shell: %s" % os.getenv('SHELL'), file=sys.stderr) - sys.exit(1) + if args.system and os.geteuid() != 0: + print("Please rerun as root for system-wide installation.", + file=sys.stderr) + sys.exit(1) if args.destdir != default_user_destdir \ or args.prefix != default_user_prefix \ @@ -86,11 +96,6 @@ def parse_arguments(): args.custom_install = False if args.system: - if os.geteuid() != 0: - print("Please rerun as root for system-wide installation.", - file=sys.stderr) - sys.exit(1) - if args.custom_install: print("Custom paths incompatible with --system option.", file=sys.stderr)