feat: add dependency check in dotf script and modify package installation command
Some checks failed
Nix Format Check / check-format (push) Failing after 37s

This commit is contained in:
Menno van Leeuwen 2025-03-10 19:35:55 +01:00
parent bfa084fe7f
commit 82ee7361bd
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
3 changed files with 4 additions and 10 deletions

View File

@ -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"""

View File

@ -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}")

View File

@ -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