From 00db2d42b9a0befb7f76768c5c4e0fe4758a768d Mon Sep 17 00:00:00 2001 From: "Abhiraj Roy (iconized)" <157954129+iconized@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:47:37 +0530 Subject: [PATCH] add #remove_snigdhaos_mirrorlist --- blackbox/Functions.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/blackbox/Functions.py b/blackbox/Functions.py index 77e29ba..a16f5bf 100644 --- a/blackbox/Functions.py +++ b/blackbox/Functions.py @@ -1428,3 +1428,40 @@ def install_snigdhaos_mirrorlist(): result_err["cmd_str"] = cmd_str result_err["output"] = output return result_err + +def remove_snigdhaos_mirrorlist(): + try: + cmd_str = [ + "pacman", + "-Rdd", + "snigdhaos-mirrorlist", + "--noconfirm", + ] + logger.debug("%s" % " ".join(cmd_str)) + with subprocess.Popen( + cmd_str, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + bufsize=1, + universal_newlines=True, + ) as process: + process.wait(process_timeout) + output = [] + for line in process.stdout: + output.append(line) + if process.returncode == 0: + return 0 + else: + if len(output) == 0: + output.append("[Error] Removal of Snigdha OS Mirrorlist failed") + logger.error(" ".join(output)) + result_err = {} + result_err["cmd_str"] = cmd_str + result_err["output"] = output + return result_err + except Exception as e: + logger.error("Exception in LOC1432: %s" % e) + result_err = {} + result_err["cmd_str"] = cmd_str + result_err["output"] = e + return result_err \ No newline at end of file