fix: replace lastlog2 with lastlog for SSH login information and clean up related dependencies
Some checks failed
Nix Format Check / check-format (push) Failing after 38s

This commit is contained in:
Menno van Leeuwen 2025-03-10 20:28:05 +01:00
parent ee064f521b
commit 132b7b1b66
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
4 changed files with 5 additions and 4 deletions

View File

@ -12,8 +12,7 @@ from helpers.functions import printfe, logo, _rainbow_color, COLORS
def get_last_ssh_login(): def get_last_ssh_login():
"""Get information about the last SSH login""" """Get information about the last SSH login"""
try: try:
# Using lastlog2 to get the last login information result = subprocess.run(['lastlog', '-u', os.environ.get("USER", "")],
result = subprocess.run(['lastlog2', '-u', os.environ.get("USER", "")],
capture_output=True, text=True) capture_output=True, text=True)
if result.returncode == 0: if result.returncode == 0:
lines = result.stdout.strip().split('\n') lines = result.stdout.strip().split('\n')

View File

@ -80,6 +80,7 @@ def logo(continue_after=False):
sys.exit(0) sys.exit(0)
except Exception as e: except Exception as e:
printfe("red", f"Error displaying logo: {e}") printfe("red", f"Error displaying logo: {e}")
def run_command(command, shell=False): def run_command(command, shell=False):
"""Run a shell command and return the result""" """Run a shell command and return the result"""
try: try:
@ -93,7 +94,6 @@ def run_command(command, shell=False):
return False, e.stderr.strip() return False, e.stderr.strip()
except FileNotFoundError: except FileNotFoundError:
return False, f"Command '{command[0]}' not found" return False, f"Command '{command[0]}' not found"
return False, e.stderr.strip()
def ensure_dependencies(): def ensure_dependencies():
"""Check and install required dependencies for the dotfiles system""" """Check and install required dependencies for the dotfiles system"""

View File

@ -39,7 +39,6 @@
- python3 - python3
- python3-pip - python3-pip
- python3-venv - python3-venv
- lastlog2 # Used for displaying last login information
state: present state: present
become: true become: true

View File

@ -32,6 +32,9 @@
pipx pipx
devbox devbox
# OS independent and secure pty/tty and utmp/wtmp/lastlog
libptytty
# Development SDKs/Toolkits # Development SDKs/Toolkits
gcc gcc
pkg-config pkg-config