diff options
author | Alexander Hayden <alexhayden25@gmail.com> | 2020-12-20 16:30:59 -0500 |
---|---|---|
committer | Alexander Hayden <alexhayden25@gmail.com> | 2020-12-20 16:30:59 -0500 |
commit | 73177ca355f5738dc8bdf408a11f4d05df40d9c2 (patch) | |
tree | 5e581f3a9f76da9b298ab9c3786e2fd044acdc50 | |
parent | 2692a68548b91b6d3b0ff1791cd4074d6b202697 (diff) | |
download | modpackman-73177ca355f5738dc8bdf408a11f4d05df40d9c2.tar.gz modpackman-73177ca355f5738dc8bdf408a11f4d05df40d9c2.zip |
add blacklist functionality
-rwxr-xr-x | modpackman.py | 6 | ||||
-rw-r--r-- | packs/jeffrey-3/local-config.ini | 2 | ||||
-rw-r--r-- | util.py | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/modpackman.py b/modpackman.py index 18cdecc..69ebe41 100755 --- a/modpackman.py +++ b/modpackman.py @@ -19,6 +19,7 @@ from util import config def install(): mods_location = os.path.join(config["pack"]["location"], "mods") whitelist = config["pack"]["whitelist"] + blacklist = config["pack"]["blacklist"] # Actual download links are stored in pack-lock.ini, so we need to read it in here pack_lock = RawConfigParser() @@ -39,8 +40,9 @@ def install(): checksum, url = entry[1].split(',') mod_path = os.path.join(mods_location, name) i += 1 - if os.path.exists(mod_path) and os.path.isfile(mod_path) and \ - hashlib.sha1(open(mod_path, 'rb').read()).hexdigest() == checksum: + if (os.path.exists(mod_path) and os.path.isfile(mod_path) and \ + hashlib.sha1(open(mod_path, 'rb').read()).hexdigest() == checksum) or \ + name in blacklist: print(f"Skipping {name}, already up to date") else: print(f'Installing {name} from {url}...') diff --git a/packs/jeffrey-3/local-config.ini b/packs/jeffrey-3/local-config.ini index f1d3058..5781ccf 100644 --- a/packs/jeffrey-3/local-config.ini +++ b/packs/jeffrey-3/local-config.ini @@ -5,3 +5,5 @@ #location = /home/example/.minecraft/instances/jeffrey # A comma-separated list of mods that won't be deleted during the install process. whitelist = example_mod.jar,example_extra_mod.jar +# A comma-separated list of mods that won't be installed during the install process +blacklist = server_only_mod.jar,client_only_mod.jar @@ -31,6 +31,11 @@ def load_config(): config["pack"]["whitelist"] = [] else: config["pack"]["whitelist"] = config["pack"]["whitelist"].split(",") + + if "blacklist" not in config["pack"]: + config["pack"]["blacklist"] = [] + else: + config["pack"]["blacklist"] = config["pack"]["blacklist"].split(",") config["pack"]["game_version"] = game_version_from_string(config["pack"]["game_version"]) |