From 82ee7361bda0e8dcd4328bfe18cf10207500cd33 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Mon, 10 Mar 2025 19:35:55 +0100 Subject: [PATCH] feat: add dependency check in dotf script and modify package installation command --- bin/dotf | 4 +++- bin/helpers/functions.py | 9 +-------- config/ansible/tasks/global/openssh-server.yml | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/bin/dotf b/bin/dotf index 9668d81..c4f6d9a 100755 --- a/bin/dotf +++ b/bin/dotf @@ -12,7 +12,9 @@ DOTFILES_PATH = DOTFILES_ROOT # For compatibility with the original scripts # Import helper functions sys.path.append(DOTFILES_BIN) -from helpers.functions import printfe, logo +from helpers.functions import printfe, ensure_dependencies + +ensure_dependencies() def run_script(script_path, args): """Run an action script with the given arguments""" diff --git a/bin/helpers/functions.py b/bin/helpers/functions.py index 1401f00..8581707 100644 --- a/bin/helpers/functions.py +++ b/bin/helpers/functions.py @@ -109,16 +109,9 @@ def ensure_dependencies(): printfe("cyan", "Installing missing dependencies...") for package in missing_packages: printfe("blue", f"Installing {package}...") - success, output = run_command(['pip', 'install', '--user', package]) + success, output = run_command(['pip', 'install', '--user', package, '--break-system-packages']) if success: printfe("green", f"Successfully installed {package}") - # Attempt to import the newly installed package - if package == 'pyfiglet': - try: - global pyfiglet - import pyfiglet - except ImportError: - printfe("red", f"Failed to import {package} after installation") else: printfe("red", f"Failed to install {package}: {output}") diff --git a/config/ansible/tasks/global/openssh-server.yml b/config/ansible/tasks/global/openssh-server.yml index 0f9e500..d81b417 100644 --- a/config/ansible/tasks/global/openssh-server.yml +++ b/config/ansible/tasks/global/openssh-server.yml @@ -12,7 +12,6 @@ group: root mode: '0644' validate: '/usr/sbin/sshd -t -f %s' - notify: Restart SSH service register: ssh_config - name: Ensure SSH service is enabled and running