diff options
author | davidovski <git@davidovski.xyz> | 2021-11-10 12:18:03 +0000 |
---|---|---|
committer | davidovski <git@davidovski.xyz> | 2021-11-10 12:18:03 +0000 |
commit | 0313176c9fe35fcca0f53b99ce1e636af0bc9e4e (patch) | |
tree | 1fef7f99faf460fc0f1461cc4e5fb2f1fe3d23eb /src | |
parent | 0d72a2b411e66e656662a5287971b17856ea5a67 (diff) |
added unsafe option
Diffstat (limited to 'src')
-rw-r--r-- | src/options.py | 5 | ||||
-rw-r--r-- | src/verbs/install.py | 19 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/options.py b/src/options.py index 4c419f2..704d630 100644 --- a/src/options.py +++ b/src/options.py @@ -22,6 +22,11 @@ options = { "flag" : True, "desc" : "skip syncing with repo sources (not recommended)" }, + "u": { + "name" : "unsafe", + "flag" : True, + "desc" : "skip any checksum or signature verification" + } "v": { "name" : "verbose", "flag" : True, diff --git a/src/verbs/install.py b/src/verbs/install.py index 703a7ee..5883c51 100644 --- a/src/verbs/install.py +++ b/src/verbs/install.py @@ -33,7 +33,9 @@ def retrieve_package_info(sources, checksum, package_name, return info else: if verbose: - print(colors.RED + f"Checksum verification failed for {package_name} in {source}" + colors.RESET) + print(colors.RED + + f"Checksum verification failed for {package_name} in {source}" + + colors.RESET) if verbose: print(colors.RED + f"No matching hashes found" + colors.RESET) return {} @@ -53,18 +55,25 @@ def install(args, options, config): repos = config["repos"] v = options["v"] + unsafe = options["u"] packages_dir = config["dir"]["packages"] for query in args: # FIRST CHECK IF ALREADY INSTALLED - checksum, listed_sources, repo = find_package(query, repos, packages_dir) if checksum is not None: - repo_sources = {source: util.add_path(url, repo) for source, url in sources.items() if source in listed_sources} - - info = retrieve_package_info(repo_sources, checksum, query, verbose=v) + repo_sources = { + source: util.add_path(url, repo) + for source, url in sources.items() + if source in listed_sources + } + + info = retrieve_package_info( + repo_sources, checksum, query, + verbose=v, skip_verification=unsafe + ) print(info) else: |