condition Y/n update (#559)

This commit is contained in:
Devesh Sharma 2023-09-21 10:51:56 +05:30 committed by GitHub
parent 7f3b3e1fc1
commit cc410dad1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -249,13 +249,12 @@ def main(config, daemon, debug, update, install, remove, live, log, monitor, sta
print("Arch-based distribution with AUR support detected. Please refresh auto-cpufreq using your AUR helper.") print("Arch-based distribution with AUR support detected. Please refresh auto-cpufreq using your AUR helper.")
else: else:
verify_update() verify_update()
ans = input ("Do you want to update auto-cpufreq to the latest release? [y/n]: ") ans = input("Do you want to update auto-cpufreq to the latest release? [Y/n]: ").strip().lower()
valid_options = ['y', 'Y', 'yes', 'YES', 'Yes']
if not os.path.exists(custom_dir): if not os.path.exists(custom_dir):
os.makedirs(custom_dir) os.makedirs(custom_dir)
if os.path.exists(os.path.join(custom_dir, "auto-cpufreq")): if os.path.exists(os.path.join(custom_dir, "auto-cpufreq")):
shutil.rmtree(os.path.join(custom_dir, "auto-cpufreq")) shutil.rmtree(os.path.join(custom_dir, "auto-cpufreq"))
if ans.lower() in valid_options: if ans in ['', 'y', 'yes']:
remove_daemon() remove_daemon()
remove_complete_msg() remove_complete_msg()
new_update(custom_dir) new_update(custom_dir)
@ -264,7 +263,6 @@ def main(config, daemon, debug, update, install, remove, live, log, monitor, sta
print("auto-cpufreq is installed with the latest version") print("auto-cpufreq is installed with the latest version")
run(["auto-cpufreq", "--version"]) run(["auto-cpufreq", "--version"])
else: else:
print("incorrect input\n")
print("Aborted") print("Aborted")
if __name__ == "__main__": if __name__ == "__main__":