Skip to content

Commit

Permalink
Updates - new futures
Browse files Browse the repository at this point in the history
  • Loading branch information
felipealfonsog committed Feb 21, 2024
1 parent d658556 commit 4880aab
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 6 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ Upd8All is a versatile and comprehensive package update tool meticulously crafte

- Enhanced System Stability and Security: Keeping software up-to-date is crucial for maintaining system stability and security. Upd8All empowers users to stay ahead of potential vulnerabilities by providing timely updates for all installed packages. By ensuring that software components are patched and current, Upd8All contributes to a more secure and reliable computing environment for Arch Linux users.

#### New Features

- Yay and Homebrew Existence Verification: The program now checks if the user has Yay and Homebrew installed. If they are installed, they are offered as options for updating packages.

- Warning Messages if Not Installed: If the user does not have Yay or Homebrew installed, a message is displayed indicating that the corresponding tool is not installed.

- Immediate Exit Option: If the user enters 'q' instead of selecting a package manager, the program exits immediately without waiting for the 1-minute timer.

- Enhanced Package Manager Selection: The user can now select the package manager they want to use to check the version of a package. The available options are adapted based on the package managers installed on the system.

- Output Format Correction: Proper line breaks were added after entering the sudo password and before warning messages and package manager selection.


#### Installation
#### Via AUR using YAY
Expand Down
53 changes: 47 additions & 6 deletions src/upd8all_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import threading
import getpass
import subprocess

# Function to print the welcome message
def print_welcome_message():
Expand Down Expand Up @@ -67,32 +68,72 @@ def main():
# Print welcome message
print_welcome_message()

# Check if the user has yay installed
try:
subprocess.run(["yay", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
has_yay = True
except FileNotFoundError:
has_yay = False

# Check if the user has Homebrew installed
try:
subprocess.run(["brew", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
has_brew = True
except FileNotFoundError:
has_brew = False

# Request sudo password at the start of the program
sudo_password = getpass.getpass(prompt="Enter your sudo password: ")

# Update packages
update_pacman(sudo_password)
update_yay(sudo_password)
update_brew()

if has_yay:
update_yay(sudo_password)
else:
print("You do not have Yay installed.")

if has_brew:
update_brew()
else:
print("You do not have Brew installed.")

# Start timing thread
timer_thread = threading.Timer(60, timeout_warning)
timer_thread.start()

# Request package name and package manager to check its version
package = input("Enter the name of the package to check its version (e.g., gh), or 'q' to quit: ").strip().lower()
print("Select the package manager to check the version:")
print("1. Pacman")
if has_yay:
print("2. Yay")
if has_brew:
print("3. Brew")

selected_option = input("Enter the option number (e.g., 1) or 'q' to quit: ").strip().lower()

# Check if the user wants to quit
if package == 'q':
if selected_option == 'q':
print("Exiting the program.")
timer_thread.cancel() # Cancel timer
sys.exit(0)

package_manager = input("Enter the package manager (pacman, yay, brew): ").strip().lower()
package_manager = ""
if selected_option == '1':
package_manager = "pacman"
elif selected_option == '2' and has_yay:
package_manager = "yay"
elif selected_option == '3' and has_brew:
package_manager = "brew"
else:
print("Invalid option. Exiting the program.")
sys.exit(1)

# Cancel timer if the user provides a package name
timer_thread.cancel()

# Request package name
package = input("Enter the name of the package to check its version (e.g., gh): ").strip().lower()

# Check the version of the specified package
check_package_version(package, package_manager)

Expand Down

0 comments on commit 4880aab

Please sign in to comment.