mirror of
https://github.com/Snigdha-OS/snigdhaos-blackbox.git
synced 2025-09-21 12:05:02 +02:00
@@ -44,45 +44,28 @@ blackbox_pidfile = "/tmp/blackbox.pid"
|
|||||||
# 10m timeout
|
# 10m timeout
|
||||||
process_timeout = 600
|
process_timeout = 600
|
||||||
|
|
||||||
arcolinux_mirrorlist = "/etc/pacman.d/arcolinux-mirrorlist"
|
snigdhaos_mirrorlist = "/etc/pacman.d/snigdhaos-mirrorlist"
|
||||||
pacman_conf = "/etc/pacman.conf"
|
pacman_conf = "/etc/pacman.conf"
|
||||||
pacman_conf_backup = "/etc/pacman.conf.bak"
|
pacman_conf_backup = "/etc/pacman.conf.bak"
|
||||||
pacman_logfile = "/var/log/pacman.log"
|
pacman_logfile = "/var/log/pacman.log"
|
||||||
pacman_lockfile = "/var/lib/pacman/db.lck"
|
pacman_lockfile = "/var/lib/pacman/db.lck"
|
||||||
pacman_cache_dir = "/var/cache/pacman/pkg/"
|
pacman_cache_dir = "/var/cache/pacman/pkg/"
|
||||||
|
|
||||||
arco_test_repo = [
|
snigdhaos_core = [
|
||||||
"#[arcolinux_repo_testing]",
|
"[snigdhaos-core]",
|
||||||
"#SigLevel = PackageRequired DatabaseNever",
|
|
||||||
"#Include = /etc/pacman.d/arcolinux-mirrorlist",
|
|
||||||
]
|
|
||||||
|
|
||||||
arco_repo = [
|
|
||||||
"[arcolinux_repo]",
|
|
||||||
"SigLevel = PackageRequired DatabaseNever",
|
"SigLevel = PackageRequired DatabaseNever",
|
||||||
"Include = /etc/pacman.d/arcolinux-mirrorlist",
|
"Include = /etc/pacman.d/snigdhaos-mirrorlist",
|
||||||
]
|
]snigdhaos_extra = [
|
||||||
|
"[snigdhaos-extra]",
|
||||||
arco_3rd_party_repo = [
|
|
||||||
"[arcolinux_repo_3party]",
|
|
||||||
"SigLevel = PackageRequired DatabaseNever",
|
"SigLevel = PackageRequired DatabaseNever",
|
||||||
"Include = /etc/pacman.d/arcolinux-mirrorlist",
|
"Include = /etc/pacman.d/snigdhaos-mirrorlist",
|
||||||
]
|
]
|
||||||
|
|
||||||
arco_xlrepo = [
|
|
||||||
"[arcolinux_repo_xlarge]",
|
|
||||||
"SigLevel = PackageRequired DatabaseNever",
|
|
||||||
"Include = /etc/pacman.d/arcolinux-mirrorlist",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
log_dir = "/var/log/blackbox/"
|
log_dir = "/var/log/blackbox/"
|
||||||
config_dir = "%s/.config/blackbox" % home
|
config_dir = "%s/.config/blackbox" % home
|
||||||
config_file = "%s/blackbox.yaml" % config_dir
|
config_file = "%s/blackbox.yaml" % config_dir
|
||||||
|
|
||||||
|
|
||||||
event_log_file = "%s/event.log" % log_dir
|
event_log_file = "%s/event.log" % log_dir
|
||||||
|
|
||||||
export_dir = "%s/blackbox-exports" % home
|
export_dir = "%s/blackbox-exports" % home
|
||||||
|
|
||||||
|
|
||||||
@@ -301,8 +284,8 @@ def sync_file_db():
|
|||||||
def start_subprocess(self, cmd, progress_dialog, action, pkg, widget):
|
def start_subprocess(self, cmd, progress_dialog, action, pkg, widget):
|
||||||
try:
|
try:
|
||||||
self.switch_package_version.set_sensitive(False)
|
self.switch_package_version.set_sensitive(False)
|
||||||
self.switch_arco_keyring.set_sensitive(False)
|
self.switch_snigdhaos_keyring.set_sensitive(False)
|
||||||
self.switch_arco_mirrorlist.set_sensitive(False)
|
self.switch_snigdhaos_mirrorlist.set_sensitive(False)
|
||||||
|
|
||||||
widget.set_sensitive(False)
|
widget.set_sensitive(False)
|
||||||
|
|
||||||
@@ -402,8 +385,8 @@ def start_subprocess(self, cmd, progress_dialog, action, pkg, widget):
|
|||||||
if progress_dialog is not None:
|
if progress_dialog is not None:
|
||||||
progress_dialog.btn_package_progress_close.set_sensitive(True)
|
progress_dialog.btn_package_progress_close.set_sensitive(True)
|
||||||
self.switch_package_version.set_sensitive(True)
|
self.switch_package_version.set_sensitive(True)
|
||||||
self.switch_arco_keyring.set_sensitive(True)
|
self.switch_snigdhaos_keyring.set_sensitive(True)
|
||||||
self.switch_arco_mirrorlist.set_sensitive(True)
|
self.switch_snigdhaos_mirrorlist.set_sensitive(True)
|
||||||
|
|
||||||
except SystemError as s:
|
except SystemError as s:
|
||||||
logger.error("SystemError in %s start_subprocess(): %s" % (action, s))
|
logger.error("SystemError in %s start_subprocess(): %s" % (action, s))
|
||||||
@@ -411,16 +394,16 @@ def start_subprocess(self, cmd, progress_dialog, action, pkg, widget):
|
|||||||
if progress_dialog is not None:
|
if progress_dialog is not None:
|
||||||
progress_dialog.btn_package_progress_close.set_sensitive(True)
|
progress_dialog.btn_package_progress_close.set_sensitive(True)
|
||||||
self.switch_package_version.set_sensitive(True)
|
self.switch_package_version.set_sensitive(True)
|
||||||
self.switch_arco_keyring.set_sensitive(True)
|
self.switch_snigdhaos_keyring.set_sensitive(True)
|
||||||
self.switch_arco_mirrorlist.set_sensitive(True)
|
self.switch_snigdhaos_mirrorlist.set_sensitive(True)
|
||||||
|
|
||||||
|
|
||||||
# refresh ui components, once the process completes
|
# refresh ui components, once the process completes
|
||||||
# show notification dialog to user if errors are encountered during package install/uninstall
|
# show notification dialog to user if errors are encountered during package install/uninstall
|
||||||
def refresh_ui(self, action, switch, pkg, progress_dialog, process_stdout_lst):
|
def refresh_ui(self, action, switch, pkg, progress_dialog, process_stdout_lst):
|
||||||
self.switch_package_version.set_sensitive(True)
|
self.switch_package_version.set_sensitive(True)
|
||||||
self.switch_arco_keyring.set_sensitive(True)
|
self.switch_snigdhaos_keyring.set_sensitive(True)
|
||||||
self.switch_arco_mirrorlist.set_sensitive(True)
|
self.switch_snigdhaos_mirrorlist.set_sensitive(True)
|
||||||
|
|
||||||
logger.debug("Checking if package %s is installed" % pkg.name)
|
logger.debug("Checking if package %s is installed" % pkg.name)
|
||||||
installed = check_package_installed(pkg.name)
|
installed = check_package_installed(pkg.name)
|
||||||
@@ -1412,10 +1395,6 @@ def cache(package, path_dir_cache):
|
|||||||
exceptions = [
|
exceptions = [
|
||||||
"florence",
|
"florence",
|
||||||
"mintstick-bin",
|
"mintstick-bin",
|
||||||
"arcolinux-conky-collection-plasma-git",
|
|
||||||
"arcolinux-desktop-trasher-git",
|
|
||||||
"arcolinux-pamac-all",
|
|
||||||
"arcolinux-sddm-simplicity-git",
|
|
||||||
"ttf-hack",
|
"ttf-hack",
|
||||||
"ttf-roboto-mono",
|
"ttf-roboto-mono",
|
||||||
"aisleriot",
|
"aisleriot",
|
||||||
@@ -1424,7 +1403,6 @@ def cache(package, path_dir_cache):
|
|||||||
"linux-rt-headers",
|
"linux-rt-headers",
|
||||||
"linux-rt-lts",
|
"linux-rt-lts",
|
||||||
"linux-rt-lts-headers",
|
"linux-rt-lts-headers",
|
||||||
"arcolinux-sddm-simplicity-git",
|
|
||||||
"kodi-x11",
|
"kodi-x11",
|
||||||
"kodi-addons",
|
"kodi-addons",
|
||||||
"sardi-icons",
|
"sardi-icons",
|
||||||
@@ -1691,9 +1669,9 @@ def repo_exist(value):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def install_arco_keyring():
|
def install_snigdhaos_keyring():
|
||||||
try:
|
try:
|
||||||
keyring = base_dir + "/packages/arcolinux-keyring/"
|
keyring = base_dir + "/packages/snigdhaos-keyring/"
|
||||||
file = os.listdir(keyring)
|
file = os.listdir(keyring)
|
||||||
cmd_str = [
|
cmd_str = [
|
||||||
"pacman",
|
"pacman",
|
||||||
@@ -1723,7 +1701,7 @@ def install_arco_keyring():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if len(output) == 0:
|
if len(output) == 0:
|
||||||
output.append("Error: install of ArcoLinux keyring failed")
|
output.append("Error: install of Snigdha OS keyring failed")
|
||||||
|
|
||||||
logger.error(" ".join(output))
|
logger.error(" ".join(output))
|
||||||
|
|
||||||
@@ -1734,7 +1712,7 @@ def install_arco_keyring():
|
|||||||
|
|
||||||
return result_err
|
return result_err
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in install_arco_keyring(): %s" % e)
|
logger.error("Exception in install_snigdhaos_keyring(): %s" % e)
|
||||||
result_err = {}
|
result_err = {}
|
||||||
|
|
||||||
result_err["cmd_str"] = cmd_str
|
result_err["cmd_str"] = cmd_str
|
||||||
@@ -1743,9 +1721,9 @@ def install_arco_keyring():
|
|||||||
return result_err
|
return result_err
|
||||||
|
|
||||||
|
|
||||||
def remove_arco_keyring():
|
def remove_snigdhaos_keyring():
|
||||||
try:
|
try:
|
||||||
cmd_str = ["pacman", "-Rdd", "arcolinux-keyring", "--noconfirm"]
|
cmd_str = ["pacman", "-Rdd", "snigdhaos-keyring", "--noconfirm"]
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
cmd_str,
|
cmd_str,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
@@ -1765,7 +1743,7 @@ def remove_arco_keyring():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if len(output) == 0:
|
if len(output) == 0:
|
||||||
output.append("Error: removal of ArcoLinux keyring failed")
|
output.append("Error: removal of Snigdha OS keyring failed")
|
||||||
|
|
||||||
logger.error(" ".join(output))
|
logger.error(" ".join(output))
|
||||||
|
|
||||||
@@ -1777,7 +1755,7 @@ def remove_arco_keyring():
|
|||||||
return result_err
|
return result_err
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in remove_arco_keyring(): %s" % e)
|
logger.error("Exception in remove_snigdhaos_keyring(): %s" % e)
|
||||||
|
|
||||||
result_err = {}
|
result_err = {}
|
||||||
|
|
||||||
@@ -1787,9 +1765,9 @@ def remove_arco_keyring():
|
|||||||
return result_err
|
return result_err
|
||||||
|
|
||||||
|
|
||||||
def install_arco_mirrorlist():
|
def install_snigdhaos_mirrorlist():
|
||||||
try:
|
try:
|
||||||
mirrorlist = base_dir + "/packages/arcolinux-mirrorlist/"
|
mirrorlist = base_dir + "/packages/snigdhaos-mirrorlist/"
|
||||||
file = os.listdir(mirrorlist)
|
file = os.listdir(mirrorlist)
|
||||||
cmd_str = [
|
cmd_str = [
|
||||||
"pacman",
|
"pacman",
|
||||||
@@ -1818,7 +1796,7 @@ def install_arco_mirrorlist():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if len(output) == 0:
|
if len(output) == 0:
|
||||||
output.append("Error: install of ArcoLinux mirrorlist failed")
|
output.append("Error: install of Snigdha OS mirrorlist failed")
|
||||||
|
|
||||||
logger.error(" ".join(output))
|
logger.error(" ".join(output))
|
||||||
|
|
||||||
@@ -1829,7 +1807,7 @@ def install_arco_mirrorlist():
|
|||||||
|
|
||||||
return result_err
|
return result_err
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in install_arco_mirrorlist(): %s" % e)
|
logger.error("Exception in install_snigdhaos_mirrorlist(): %s" % e)
|
||||||
|
|
||||||
result_err = {}
|
result_err = {}
|
||||||
|
|
||||||
@@ -1839,9 +1817,9 @@ def install_arco_mirrorlist():
|
|||||||
return result_err
|
return result_err
|
||||||
|
|
||||||
|
|
||||||
def remove_arco_mirrorlist():
|
def remove_snigdhaos_mirrorlist():
|
||||||
try:
|
try:
|
||||||
cmd_str = ["pacman", "-Rdd", "arcolinux-mirrorlist-git", "--noconfirm"]
|
cmd_str = ["pacman", "-Rdd", "snigdhaos-mirrorlist-git", "--noconfirm"]
|
||||||
logger.debug("%s" % " ".join(cmd_str))
|
logger.debug("%s" % " ".join(cmd_str))
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
cmd_str,
|
cmd_str,
|
||||||
@@ -1862,7 +1840,7 @@ def remove_arco_mirrorlist():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if len(output) == 0:
|
if len(output) == 0:
|
||||||
output.append("Error: removal of ArcoLinux mirrorlist failed")
|
output.append("Error: removal of Snigdha OS mirrorlist failed")
|
||||||
|
|
||||||
logger.error(" ".join(output))
|
logger.error(" ".join(output))
|
||||||
|
|
||||||
@@ -1874,7 +1852,7 @@ def remove_arco_mirrorlist():
|
|||||||
return result_err
|
return result_err
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in remove_arco_mirrorlist(): %s" % e)
|
logger.error("Exception in remove_snigdhaos_mirrorlist(): %s" % e)
|
||||||
|
|
||||||
result_err = {}
|
result_err = {}
|
||||||
|
|
||||||
@@ -1884,12 +1862,12 @@ def remove_arco_mirrorlist():
|
|||||||
return result_err
|
return result_err
|
||||||
|
|
||||||
|
|
||||||
def add_arco_repos():
|
def add_snigdhaos_repos():
|
||||||
logger.info("Adding ArcoLinux repos on %s" % distr)
|
logger.info("Adding Snigdha OS repos on %s" % distr)
|
||||||
try:
|
try:
|
||||||
# first check if arco repos are already inside pacman conf file
|
# first check if snigdhaos repos are already inside pacman conf file
|
||||||
|
|
||||||
if verify_arco_pacman_conf() is False:
|
if verify_snigdhaos_pacman_conf() is False:
|
||||||
# take backup of existing pacman.conf file
|
# take backup of existing pacman.conf file
|
||||||
|
|
||||||
if os.path.exists(pacman_conf):
|
if os.path.exists(pacman_conf):
|
||||||
@@ -1904,106 +1882,106 @@ def add_arco_repos():
|
|||||||
with open(pacman_conf, "r", encoding="utf-8") as r:
|
with open(pacman_conf, "r", encoding="utf-8") as r:
|
||||||
lines = r.readlines()
|
lines = r.readlines()
|
||||||
|
|
||||||
# check for existing ArcoLinux entries
|
# check for existing Snigdha OS entries
|
||||||
if len(lines) > 0:
|
if len(lines) > 0:
|
||||||
arco_test_repo_found = False
|
snigdhaos_test_repo_found = False
|
||||||
arco_repo_found = False
|
snigdhaos_repo_found = False
|
||||||
arco_3rd_party_repo_found = False
|
snigdhaos_3rd_party_repo_found = False
|
||||||
arco_xlrepo_found = False
|
snigdhaos_xlrepo_found = False
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if "#" in line.strip():
|
if "#" in line.strip():
|
||||||
if arco_test_repo[0].replace("#", "") in line.strip():
|
if snigdhaos_test_repo[0].replace("#", "") in line.strip():
|
||||||
arco_test_repo_found = True
|
snigdhaos_test_repo_found = True
|
||||||
|
|
||||||
if arco_repo[0].replace("#", "") in line.strip():
|
if snigdhaos_repo[0].replace("#", "") in line.strip():
|
||||||
arco_repo_found = True
|
snigdhaos_repo_found = True
|
||||||
index = lines.index(line)
|
index = lines.index(line)
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_repo[0])
|
lines.insert(index, snigdhaos_repo[0])
|
||||||
|
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_repo[1])
|
lines.insert(index, snigdhaos_repo[1])
|
||||||
|
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_repo[2])
|
lines.insert(index, snigdhaos_repo[2])
|
||||||
|
|
||||||
if arco_3rd_party_repo[0].replace("#", "") in line.strip():
|
if snigdhaos_3rd_party_repo[0].replace("#", "") in line.strip():
|
||||||
arco_3rd_party_repo_found = True
|
snigdhaos_3rd_party_repo_found = True
|
||||||
index = lines.index(line)
|
index = lines.index(line)
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_3rd_party_repo[0])
|
lines.insert(index, snigdhaos_3rd_party_repo[0])
|
||||||
|
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_3rd_party_repo[1])
|
lines.insert(index, snigdhaos_3rd_party_repo[1])
|
||||||
|
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_3rd_party_repo[2])
|
lines.insert(index, snigdhaos_3rd_party_repo[2])
|
||||||
|
|
||||||
if arco_xlrepo[0].replace("#", "") in line.strip():
|
if snigdhaos_xlrepo[0].replace("#", "") in line.strip():
|
||||||
arco_xlrepo_found = True
|
snigdhaos_xlrepo_found = True
|
||||||
index = lines.index(line)
|
index = lines.index(line)
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_xlrepo[0])
|
lines.insert(index, snigdhaos_xlrepo[0])
|
||||||
|
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_xlrepo[1])
|
lines.insert(index, snigdhaos_xlrepo[1])
|
||||||
|
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
del lines[index]
|
del lines[index]
|
||||||
lines.insert(index, arco_xlrepo[2])
|
lines.insert(index, snigdhaos_xlrepo[2])
|
||||||
|
|
||||||
if line.strip() == arco_test_repo[0]:
|
if line.strip() == snigdhaos_test_repo[0]:
|
||||||
arco_test_repo_found = True
|
snigdhaos_test_repo_found = True
|
||||||
|
|
||||||
if line.strip() == arco_repo[0]:
|
if line.strip() == snigdhaos_repo[0]:
|
||||||
arco_repo_found = True
|
snigdhaos_repo_found = True
|
||||||
|
|
||||||
if line.strip() == arco_3rd_party_repo[0]:
|
if line.strip() == snigdhaos_3rd_party_repo[0]:
|
||||||
arco_3rd_party_repo_found = True
|
snigdhaos_3rd_party_repo_found = True
|
||||||
|
|
||||||
if line.strip() == arco_xlrepo[0]:
|
if line.strip() == snigdhaos_xlrepo[0]:
|
||||||
arco_xlrepo_found = True
|
snigdhaos_xlrepo_found = True
|
||||||
|
|
||||||
if arco_test_repo_found is False:
|
if snigdhaos_test_repo_found is False:
|
||||||
lines.append("\n")
|
lines.append("\n")
|
||||||
|
|
||||||
for arco_test_repo_line in arco_test_repo:
|
for snigdhaos_test_repo_line in snigdhaos_test_repo:
|
||||||
lines.append(arco_test_repo_line)
|
lines.append(snigdhaos_test_repo_line)
|
||||||
|
|
||||||
if arco_repo_found is False:
|
if snigdhaos_repo_found is False:
|
||||||
lines.append("\n")
|
lines.append("\n")
|
||||||
|
|
||||||
for arco_repo_line in arco_repo:
|
for snigdhaos_repo_line in snigdhaos_repo:
|
||||||
lines.append(arco_repo_line)
|
lines.append(snigdhaos_repo_line)
|
||||||
|
|
||||||
if arco_3rd_party_repo_found is False:
|
if snigdhaos_3rd_party_repo_found is False:
|
||||||
lines.append("\n")
|
lines.append("\n")
|
||||||
|
|
||||||
for arco_3rd_party_repo_line in arco_3rd_party_repo:
|
for snigdhaos_3rd_party_repo_line in snigdhaos_3rd_party_repo:
|
||||||
lines.append(arco_3rd_party_repo_line)
|
lines.append(snigdhaos_3rd_party_repo_line)
|
||||||
|
|
||||||
if arco_xlrepo_found is False:
|
if snigdhaos_xlrepo_found is False:
|
||||||
lines.append("\n")
|
lines.append("\n")
|
||||||
|
|
||||||
for arco_xlrepo_line in arco_xlrepo:
|
for snigdhaos_xlrepo_line in snigdhaos_xlrepo:
|
||||||
lines.append(arco_xlrepo_line)
|
lines.append(snigdhaos_xlrepo_line)
|
||||||
|
|
||||||
logger.info("[Add ArcoLinux repos] Writing to %s" % pacman_conf)
|
logger.info("[Add Snigdha OS repos] Writing to %s" % pacman_conf)
|
||||||
|
|
||||||
if len(lines) > 0:
|
if len(lines) > 0:
|
||||||
with open(pacman_conf, "w", encoding="utf-8") as w:
|
with open(pacman_conf, "w", encoding="utf-8") as w:
|
||||||
@@ -2020,19 +1998,19 @@ def add_arco_repos():
|
|||||||
else:
|
else:
|
||||||
logger.error("Failed to read %s" % pacman_conf)
|
logger.error("Failed to read %s" % pacman_conf)
|
||||||
else:
|
else:
|
||||||
logger.info("ArcoLinux repos already setup inside pacman conf file")
|
logger.info("Snigdha OS repos already setup inside pacman conf file")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in add_arco_repos(): %s" % e)
|
logger.error("Exception in add_snigdhaos_repos(): %s" % e)
|
||||||
return e
|
return e
|
||||||
|
|
||||||
|
|
||||||
def remove_arco_repos():
|
def remove_snigdhaos_repos():
|
||||||
# remove the ArcoLinux repos in /etc/pacman.conf
|
# remove the Snigdha OS repos in /etc/pacman.conf
|
||||||
try:
|
try:
|
||||||
# check for existing ArcoLinux entries and remove
|
# check for existing Snigdha OS entries and remove
|
||||||
if verify_arco_pacman_conf() is True:
|
if verify_snigdhaos_pacman_conf() is True:
|
||||||
if os.path.exists(pacman_conf):
|
if os.path.exists(pacman_conf):
|
||||||
shutil.copy(pacman_conf, pacman_conf_backup)
|
shutil.copy(pacman_conf, pacman_conf_backup)
|
||||||
|
|
||||||
@@ -2047,48 +2025,48 @@ def remove_arco_repos():
|
|||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if arco_test_repo[0] == line.strip().replace(" ", ""):
|
if snigdhaos_test_repo[0] == line.strip().replace(" ", ""):
|
||||||
index = lines.index(line)
|
index = lines.index(line)
|
||||||
|
|
||||||
if index > 0:
|
if index > 0:
|
||||||
if distr != "arcolinux":
|
if distr != "snigdhaos":
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
|
|
||||||
# make sure the arco testing repo is disabled, if absolutely required update the pacman conf file manually and enable them
|
# make sure the snigdhaos testing repo is disabled, if absolutely required update the pacman conf file manually and enable them
|
||||||
|
|
||||||
if "%s" % arco_test_repo[0].replace("#", "") == line.strip():
|
if "%s" % snigdhaos_test_repo[0].replace("#", "") == line.strip():
|
||||||
index = lines.index(
|
index = lines.index(
|
||||||
"%s\n" % arco_test_repo[0].replace("#", "")
|
"%s\n" % snigdhaos_test_repo[0].replace("#", "")
|
||||||
)
|
)
|
||||||
if distr != "arcolinux":
|
if distr != "snigdhaos":
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
else:
|
else:
|
||||||
# comment out the testing repo
|
# comment out the testing repo
|
||||||
|
|
||||||
lines[index] = "%s\n" % arco_test_repo[0]
|
lines[index] = "%s\n" % snigdhaos_test_repo[0]
|
||||||
lines[index + 1] = "%s\n" % arco_test_repo[1]
|
lines[index + 1] = "%s\n" % snigdhaos_test_repo[1]
|
||||||
lines[index + 2] = "%s\n" % arco_test_repo[2]
|
lines[index + 2] = "%s\n" % snigdhaos_test_repo[2]
|
||||||
|
|
||||||
if "%s\n" % arco_repo[0] == line:
|
if "%s\n" % snigdhaos_repo[0] == line:
|
||||||
index = lines.index("%s\n" % arco_repo[0])
|
index = lines.index("%s\n" % snigdhaos_repo[0])
|
||||||
|
|
||||||
if index > 0:
|
if index > 0:
|
||||||
if distr != "arcolinux":
|
if distr != "snigdhaos":
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
else:
|
else:
|
||||||
lines[index] = "#%s\n" % arco_repo[0]
|
lines[index] = "#%s\n" % snigdhaos_repo[0]
|
||||||
lines[index + 1] = "#%s\n" % arco_repo[1]
|
lines[index + 1] = "#%s\n" % snigdhaos_repo[1]
|
||||||
lines[index + 2] = "#%s\n" % arco_repo[2]
|
lines[index + 2] = "#%s\n" % snigdhaos_repo[2]
|
||||||
elif (
|
elif (
|
||||||
"#" in line.strip()
|
"#" in line.strip()
|
||||||
and arco_repo[0] == line.replace("#", "").strip()
|
and snigdhaos_repo[0] == line.replace("#", "").strip()
|
||||||
and distr != "arcolinux"
|
and distr != "snigdhaos"
|
||||||
):
|
):
|
||||||
# check if already commented
|
# check if already commented
|
||||||
|
|
||||||
@@ -2097,22 +2075,22 @@ def remove_arco_repos():
|
|||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
|
|
||||||
if "%s\n" % arco_3rd_party_repo[0] == line:
|
if "%s\n" % snigdhaos_3rd_party_repo[0] == line:
|
||||||
index = lines.index("%s\n" % arco_3rd_party_repo[0])
|
index = lines.index("%s\n" % snigdhaos_3rd_party_repo[0])
|
||||||
|
|
||||||
if index > 0:
|
if index > 0:
|
||||||
if distr != "arcolinux":
|
if distr != "snigdhaos":
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
else:
|
else:
|
||||||
lines[index] = "#%s\n" % arco_3rd_party_repo[0]
|
lines[index] = "#%s\n" % snigdhaos_3rd_party_repo[0]
|
||||||
lines[index + 1] = "#%s\n" % arco_3rd_party_repo[1]
|
lines[index + 1] = "#%s\n" % snigdhaos_3rd_party_repo[1]
|
||||||
lines[index + 2] = "#%s\n" % arco_3rd_party_repo[2]
|
lines[index + 2] = "#%s\n" % snigdhaos_3rd_party_repo[2]
|
||||||
elif (
|
elif (
|
||||||
"#" in line.strip()
|
"#" in line.strip()
|
||||||
and arco_3rd_party_repo[0] == line.replace("#", "").strip()
|
and snigdhaos_3rd_party_repo[0] == line.replace("#", "").strip()
|
||||||
and distr != "arcolinux"
|
and distr != "snigdhaos"
|
||||||
):
|
):
|
||||||
# check if already commented
|
# check if already commented
|
||||||
|
|
||||||
@@ -2121,22 +2099,22 @@ def remove_arco_repos():
|
|||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
|
|
||||||
if "%s\n" % arco_xlrepo[0] == line:
|
if "%s\n" % snigdhaos_xlrepo[0] == line:
|
||||||
index = lines.index("%s\n" % arco_xlrepo[0])
|
index = lines.index("%s\n" % snigdhaos_xlrepo[0])
|
||||||
|
|
||||||
if index > 0:
|
if index > 0:
|
||||||
if distr != "arcolinux":
|
if distr != "snigdhaos":
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
else:
|
else:
|
||||||
lines[index] = "#%s\n" % arco_xlrepo[0]
|
lines[index] = "#%s\n" % snigdhaos_xlrepo[0]
|
||||||
lines[index + 1] = "#%s\n" % arco_xlrepo[1]
|
lines[index + 1] = "#%s\n" % snigdhaos_xlrepo[1]
|
||||||
lines[index + 2] = "#%s\n" % arco_xlrepo[2]
|
lines[index + 2] = "#%s\n" % snigdhaos_xlrepo[2]
|
||||||
elif (
|
elif (
|
||||||
"#" in line.strip()
|
"#" in line.strip()
|
||||||
and arco_xlrepo[0] == line.replace("#", "").strip()
|
and snigdhaos_xlrepo[0] == line.replace("#", "").strip()
|
||||||
and distr != "arcolinux"
|
and distr != "snigdhaos"
|
||||||
):
|
):
|
||||||
# check if already commented
|
# check if already commented
|
||||||
|
|
||||||
@@ -2145,10 +2123,10 @@ def remove_arco_repos():
|
|||||||
del lines[index]
|
del lines[index]
|
||||||
del lines[index]
|
del lines[index]
|
||||||
|
|
||||||
# remove any white spaces from end of the file only if on non arcolinux system
|
# remove any white spaces from end of the file only if on non snigdhaos system
|
||||||
# on any non arcolinux distro lines are deleted which leaves empty lines in the file
|
# on any non snigdhaos distro lines are deleted which leaves empty lines in the file
|
||||||
# causing the file to grow in size
|
# causing the file to grow in size
|
||||||
if distr != "arcolinux":
|
if distr != "snigdhaos":
|
||||||
if lines[-1] == "\n":
|
if lines[-1] == "\n":
|
||||||
del lines[-1]
|
del lines[-1]
|
||||||
|
|
||||||
@@ -2161,7 +2139,7 @@ def remove_arco_repos():
|
|||||||
if lines[-4] == "\n":
|
if lines[-4] == "\n":
|
||||||
del lines[-4]
|
del lines[-4]
|
||||||
|
|
||||||
logger.info("[Remove ArcoLinux Repos] Writing to %s" % pacman_conf)
|
logger.info("[Remove Snigdha OS Repos] Writing to %s" % pacman_conf)
|
||||||
|
|
||||||
if len(lines) > 0:
|
if len(lines) > 0:
|
||||||
with open(pacman_conf, "w") as w:
|
with open(pacman_conf, "w") as w:
|
||||||
@@ -2177,56 +2155,56 @@ def remove_arco_repos():
|
|||||||
else:
|
else:
|
||||||
logger.error("Failed to read %s" % pacman_conf)
|
logger.error("Failed to read %s" % pacman_conf)
|
||||||
else:
|
else:
|
||||||
logger.info("No ArcoLinux repos setup inside pacman conf file")
|
logger.info("No Snigdha OS repos setup inside pacman conf file")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in remove_arco_repos(): %s" % e)
|
logger.error("Exception in remove_snigdhaos_repos(): %s" % e)
|
||||||
return e
|
return e
|
||||||
|
|
||||||
|
|
||||||
# check if pacman.conf has arco repos setup
|
# check if pacman.conf has snigdhaos repos setup
|
||||||
|
|
||||||
|
|
||||||
def verify_arco_pacman_conf():
|
def verify_snigdhaos_pacman_conf():
|
||||||
try:
|
try:
|
||||||
lines = None
|
lines = None
|
||||||
arco_repo_setup = False
|
snigdhaos_repo_setup = False
|
||||||
arco_3rd_party_repo_setup = False
|
snigdhaos_3rd_party_repo_setup = False
|
||||||
arco_xlrepo_setup = False
|
snigdhaos_xlrepo_setup = False
|
||||||
with open(pacman_conf, "r") as r:
|
with open(pacman_conf, "r") as r:
|
||||||
lines = r.readlines()
|
lines = r.readlines()
|
||||||
|
|
||||||
if lines is not None:
|
if lines is not None:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if arco_repo[0] in line.strip():
|
if snigdhaos_repo[0] in line.strip():
|
||||||
if "#" not in line.strip():
|
if "#" not in line.strip():
|
||||||
arco_repo_setup = True
|
snigdhaos_repo_setup = True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if arco_3rd_party_repo[0] in line.strip():
|
if snigdhaos_3rd_party_repo[0] in line.strip():
|
||||||
if "#" not in line.strip():
|
if "#" not in line.strip():
|
||||||
arco_3rd_party_repo_setup = True
|
snigdhaos_3rd_party_repo_setup = True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if arco_xlrepo[0] in line.strip():
|
if snigdhaos_xlrepo[0] in line.strip():
|
||||||
if "#" not in line.strip():
|
if "#" not in line.strip():
|
||||||
arco_xlrepo_setup = True
|
snigdhaos_xlrepo_setup = True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if (
|
if (
|
||||||
arco_repo_setup is True
|
snigdhaos_repo_setup is True
|
||||||
and arco_3rd_party_repo_setup is True
|
and snigdhaos_3rd_party_repo_setup is True
|
||||||
and arco_xlrepo_setup is True
|
and snigdhaos_xlrepo_setup is True
|
||||||
):
|
):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in check_arco_pacman(): %s" % e)
|
logger.error("Exception in check_snigdhaos_pacman(): %s" % e)
|
||||||
|
|
||||||
|
|
||||||
# =====================================================
|
# =====================================================
|
||||||
|
Reference in New Issue
Block a user