Skip to content

Commit

Permalink
RHEL8 spec update to require moby-engine or docker-ce (#7026)
Browse files Browse the repository at this point in the history
* RHEL8 spec update to require moby-engine or docker-ce (#6972)

Co-authored-by: Andrew Smith <andsmi@microsoft.com>
Co-authored-by: Damon Barry <damonbarry@users.noreply.github.com>
  • Loading branch information
3 people authored May 25, 2023
1 parent 238c121 commit 3a2e68e
Showing 1 changed file with 25 additions and 24 deletions.
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

0 comments on commit 3a2e68e

Please sign in to comment.