feat: add dependency check in dotf script and modify package installation command
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
This commit is contained in:
parent
bfa084fe7f
commit
82ee7361bd
4
bin/dotf
4
bin/dotf
@ -12,7 +12,9 @@ DOTFILES_PATH = DOTFILES_ROOT # For compatibility with the original scripts
|
|||||||
|
|
||||||
# Import helper functions
|
# Import helper functions
|
||||||
sys.path.append(DOTFILES_BIN)
|
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):
|
def run_script(script_path, args):
|
||||||
"""Run an action script with the given arguments"""
|
"""Run an action script with the given arguments"""
|
||||||
|
@ -109,16 +109,9 @@ def ensure_dependencies():
|
|||||||
printfe("cyan", "Installing missing dependencies...")
|
printfe("cyan", "Installing missing dependencies...")
|
||||||
for package in missing_packages:
|
for package in missing_packages:
|
||||||
printfe("blue", f"Installing {package}...")
|
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:
|
if success:
|
||||||
printfe("green", f"Successfully installed {package}")
|
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:
|
else:
|
||||||
printfe("red", f"Failed to install {package}: {output}")
|
printfe("red", f"Failed to install {package}: {output}")
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
validate: '/usr/sbin/sshd -t -f %s'
|
validate: '/usr/sbin/sshd -t -f %s'
|
||||||
notify: Restart SSH service
|
|
||||||
register: ssh_config
|
register: ssh_config
|
||||||
|
|
||||||
- name: Ensure SSH service is enabled and running
|
- name: Ensure SSH service is enabled and running
|
||||||
|
Loading…
x
Reference in New Issue
Block a user