fix: improve abra systemd service environment and PATH persistence

This commit is contained in:
2025-08-19 17:40:23 +02:00
parent 45f2e6c230
commit 1cc2c3f680

View File

@@ -353,6 +353,10 @@ isoConfig // {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
User = "root"; User = "root";
Environment = [
"TERM=xterm-256color"
"HOME=/root"
];
}; };
}; };
@@ -362,13 +366,17 @@ isoConfig // {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "workshop-system-setup.service" ]; after = [ "workshop-system-setup.service" ];
wants = [ "workshop-system-setup.service" ]; wants = [ "workshop-system-setup.service" ];
path = with pkgs; [ bash wget curl coreutils gnutar ncurses gzip file gnugrep ]; path = with pkgs; [ bash wget curl coreutils gnutar ncurses gzip file gnugrep docker ];
script = '' script = ''
# Set proper environment
export TERM=xterm-256color
export HOME=/root
# Check if abra is already installed # Check if abra is already installed
if command -v abra >/dev/null 2>&1; then if [ -x "/root/.local/bin/abra" ]; then
echo " abra already installed at $(which abra)" echo " abra already installed"
abra --version /root/.local/bin/abra --version
exit 0 exit 0
fi fi
@@ -377,24 +385,15 @@ isoConfig // {
# Install to /usr/local/bin (default behavior) # Install to /usr/local/bin (default behavior)
curl -fsSL https://install.abra.coopcloud.tech | bash curl -fsSL https://install.abra.coopcloud.tech | bash
# Add abra to $PATH # Add to bashrc only once
echo PATH=$PATH:/root/.local/bin >> /root/.profile if ! grep -q "/root/.local/bin" /root/.bashrc 2>/dev/null; then
echo 'export PATH="$PATH:/root/.local/bin"' >> /root/.bashrc
echo " Added /root/.local/bin to PATH in /root/.bashrc"
fi
# Evaluate bashrc # Verify
source /root/.profile if [ -x "/root/.local/bin/abra" ]; then
echo " abra installed to /root/.local/bin/abra"
# Set autocomplete properly
source <(abra autocomplete bash)
# Verify installation
if command -v abra >/dev/null 2>&1; then
echo " abra installed successfully at $(which abra)"
abra --version
else
echo " abra installation failed."
echo "Checking common locations..."
ls -la /root/.local/bin/abra 2>/dev/null || echo "Not in /root/.local/bin"
fi fi
''; '';
@@ -402,6 +401,10 @@ isoConfig // {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
User = "root"; User = "root";
Environment = [
"TERM=xterm-256color"
"HOME=/root"
];
}; };
}; };