Skip to content

Commit af65ae7

Browse files
committed
fix(agent): adding checks for session and explicit systemd requirement
1 parent d7fb2f6 commit af65ae7

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

installer/linux/agent-installer-service-user.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if [ -z "${home_dir}" ]; then
5858
fi
5959

6060
os=$(uname | tr '[:upper:]' '[:lower:]')
61-
systemd_status=$(systemctl is-system-running)
61+
systemd_status=$(systemctl is-system-running 2>/dev/null || true)
6262
install_dir="${home_dir}/${OPENAEV_INSTALL_DIR}-${user}"
6363
service_name="${user}-${OPENAEV_SERVICE_NAME}"
6464
tenant_id="${OPENAEV_TENANT_ID}"
@@ -71,6 +71,7 @@ fi
7171

7272
if [ "$systemd_status" != "running" ] && [ "$systemd_status" != "degraded" ]; then
7373
echo "Systemd is in unexpected state: $systemd_status. Installation is not supported."
74+
echo "Prerequisite: an active systemd system manager is required for service-user mode." >&2
7475
exit 1
7576
else
7677
echo "Systemd is in acceptable state: $systemd_status"

installer/linux/agent-installer-session-user.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
base_url=${OPENAEV_URL}
55
architecture=$(uname -m)
6-
systemd_status=$(systemctl is-system-running)
6+
systemd_status=$(systemctl is-system-running 2>/dev/null || true)
77

88
os=$(uname | tr '[:upper:]' '[:lower:]')
99
install_dir="$HOME/${OPENAEV_INSTALL_DIR}"
@@ -24,6 +24,12 @@ else
2424
echo "Systemd is in acceptable state: $systemd_status"
2525
fi
2626

27+
if ! systemctl --user show-environment >/dev/null 2>&1; then
28+
echo "Error: systemd user manager is not available in this session." >&2
29+
echo "Prerequisite: an active systemd user manager is required for session-user mode." >&2
30+
exit 1
31+
fi
32+
2733
echo "Starting install script for ${os} | ${architecture}"
2834

2935
echo "01. Stopping existing ${session_name}..."

installer/linux/agent-installer.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
base_url=${OPENAEV_URL}
55
architecture=$(uname -m)
6-
systemd_status=$(systemctl is-system-running)
6+
systemd_status=$(systemctl is-system-running 2>/dev/null || true)
77

88
os=$(uname | tr '[:upper:]' '[:lower:]')
99
install_dir="${OPENAEV_INSTALL_DIR}"
@@ -17,6 +17,7 @@ fi
1717

1818
if [ "$systemd_status" != "running" ] && [ "$systemd_status" != "degraded" ]; then
1919
echo "Systemd is in unexpected state: $systemd_status. Installation is not supported."
20+
echo "Prerequisite: an active systemd system manager is required for service mode." >&2
2021
exit 1
2122
else
2223
echo "Systemd is in acceptable state: $systemd_status"

0 commit comments

Comments
 (0)