def check_md5(pkg_md5, src_file): """MD5 Checksum """ if _meta_.checkmd5 in ["on", "ON"]: print("") md5s = md5(src_file) if pkg_md5 != md5s: Msg().template(78) print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format( src_file.split("/")[-1], _meta_.color["RED"], _meta_.color["ENDC"])) Msg().template(78) print("| Expected: {0}".format(pkg_md5)) print("| Found: {0}".format(md5s)) Msg().template(78) print("") if not Msg().answer() in ["y", "Y"]: raise SystemExit() else: Msg().template(78) print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format( src_file.split("/")[-1], _meta_.color["GREEN"], _meta_.color["ENDC"])) Msg().template(78) print("") # new line after pass checksum
fish_completion = "/etc/fish/completions/" completion_file = ["conf/slpkg.bash-completion", "conf/slpkg.fish"] if not os.path.exists(bash_completion): os.makedirs(bash_completion) print("Installing '{0}' file".format(completion_file[0].split("/")[1])) shutil.copy2(completion_file[0], bash_completion) os.chmod(bash_completion + completion_file[0].split("/")[1], 744) if os.path.exists(fish_completion): print("Installing '{0}' file".format(completion_file[1].split("/")[1])) shutil.copy2(completion_file[1], fish_completion) os.chmod(fish_completion + completion_file[1].split("/")[1], 744) conf_file = [ "conf/slpkg.conf", "conf/repositories.conf", "conf/blacklist", "conf/slackware-mirrors", "conf/default-repositories", "conf/custom-repositories", "conf/rlworkman.deps", "conf/pkg_security" ] if not os.path.exists(_meta_.conf_path): os.makedirs(_meta_.conf_path) for conf in conf_file: filename = conf.split("/")[-1] print("Installing '{0}' file".format(filename)) if os.path.isfile(_meta_.conf_path + filename): old = md5(_meta_.conf_path + filename) new = md5(conf) if old != new: shutil.copy2(conf, _meta_.conf_path + filename + ".new") else: shutil.copy2(conf, _meta_.conf_path) shutil.copy2(conf_file[0], _meta_.conf_path + conf_file[0].split("/")[-1] + ".orig")
if not os.path.exists(bash_completion): os.makedirs(bash_completion) print("Installing '{0}' file".format(completion_file[0].split("/")[1])) shutil.copy2(completion_file[0], bash_completion) os.chmod(bash_completion + completion_file[0].split("/")[1], 744) if os.path.exists(fish_completion): print("Installing '{0}' file".format(completion_file[1].split("/")[1])) shutil.copy2(completion_file[1], fish_completion) os.chmod(fish_completion + completion_file[1].split("/")[1], 744) conf_file = [ "conf/slpkg.conf", "conf/repositories.conf", "conf/blacklist", "conf/slackware-mirrors", "conf/custom-repositories", ] if not os.path.exists(_meta_.conf_path): os.makedirs(_meta_.conf_path) for conf in conf_file: filename = conf.split("/")[-1] print("Installing '{0}' file".format(filename)) if os.path.isfile(_meta_.conf_path + filename): old = md5(_meta_.conf_path + filename) new = md5(conf) if old != new: shutil.copy2(conf, _meta_.conf_path + filename + ".new") else: shutil.copy2(conf, _meta_.conf_path) shutil.copy2(conf_file[0], _meta_.conf_path + conf_file[0].split("/")[-1] + ".orig")