Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHEL8 spec update to require moby-engine or docker-ce #7026

Merged
merged 5 commits into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions edgelet/contrib/enterprise-linux/aziot-edge.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ URL: https://github.com/azure/iotedge
%{?systemd_requires}
BuildRequires: systemd
Requires(pre): shadow-utils
Requires: (moby-engine or docker-ce)
Requires: aziot-identity-service = 1.4.4-1%{?dist}
Source0: aziot-edge-%{version}.tar.gz

Expand Down Expand Up @@ -62,19 +63,6 @@ make \
rm -rf $RPM_BUILD_ROOT

%pre
# Check for container runtime
if ! /usr/bin/getent group docker >/dev/null; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
echo " ERROR: No container runtime detected."
echo ""
echo " Please install a container runtime and run this install again."
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

exit 1
fi

# Create iotedge group
if ! /usr/bin/getent group iotedge >/dev/null; then
%{_sbindir}/groupadd -r %{iotedge_group}
Expand All @@ -85,16 +73,6 @@ if ! /usr/bin/getent passwd iotedge >/dev/null; then
%{_sbindir}/useradd -r -g %{iotedge_group} -c "iotedge user" -s /sbin/nologin -d %{iotedge_home} %{iotedge_user}
fi

# Add iotedge user to moby-engine group
if /usr/bin/getent group docker >/dev/null; then
%{_sbindir}/usermod -aG docker %{iotedge_user}
fi

# Add iotedge user to systemd-journal group so it can get system logs
if /usr/bin/getent group systemd-journal >/dev/null; then
%{_sbindir}/usermod -aG systemd-journal %{iotedge_user}
fi

# Create an edgeagentuser and add it to iotedge group
if ! /usr/bin/getent passwd %{iotedge_agent_user} >/dev/null; then
%{_sbindir}/useradd -r -g %{iotedge_group} -c "edgeAgent user" -s /sbin/nologin -u %{iotedge_agent_uid} %{iotedge_agent_user} || true
Expand All @@ -116,8 +94,31 @@ if /usr/bin/getent group aziotid >/dev/null; then
%{_sbindir}/usermod -aG aziotid %{iotedge_user}
fi
exit 0

%post
# Check for container runtime
if ! /usr/bin/getent group docker >/dev/null; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
echo " ERROR: No container runtime detected."
echo ""
echo " Please install a container runtime and run this install again."
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

exit 1
fi

# Add iotedge user to moby-engine group
if /usr/bin/getent group docker >/dev/null; then
%{_sbindir}/usermod -aG docker %{iotedge_user}
fi

# Add iotedge user to systemd-journal group so it can get system logs
if /usr/bin/getent group systemd-journal >/dev/null; then
%{_sbindir}/usermod -aG systemd-journal %{iotedge_user}
fi


if [ ! -f '/etc/aziot/config.toml' ]; then
echo "==============================================================================="
echo ""
Expand Down