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
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
This commit is contained in:
parent
ee064f521b
commit
132b7b1b66
@ -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')
|
||||||
|
@ -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"""
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user