Skip to content

Commit

Permalink
lxd/instance/drivers/qemu: compat with SUSE paths
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed Sep 3, 2024
1 parent dac3e2b commit 516c04d
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions lxd/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2866,17 +2866,44 @@ if [ ! -d "/run/systemd/system/" ]; then
exit 1
fi
for path in "/lib/systemd" "/usr/lib/systemd"; do
[ -d "${path}/system" ] || continue
LIB_SYSTEMD="${path}"
break
done
if [ ! -d "${LIB_SYSTEMD:-}" ]; then
echo "Could not find path to systemd"
exit 1
fi
for path in "/lib/udev" "/usr/lib/udev"; do
[ -d "${path}/rules.d/" ] || continue
LIB_UDEV="${path}"
break
done
if [ ! -d "${LIB_UDEV:-}" ]; then
echo "Could not find path to udev"
exit 1
fi
# Cleanup former units.
rm -f /lib/systemd/system/lxd-agent-9p.service \
/lib/systemd/system/lxd-agent-virtiofs.service \
rm -f "${LIB_SYSTEMD}/system/lxd-agent-9p.service" \
"${LIB_SYSTEMD}/system/lxd-agent-virtiofs.service" \
/etc/systemd/system/multi-user.target.wants/lxd-agent-9p.service \
/etc/systemd/system/multi-user.target.wants/lxd-agent-virtiofs.service \
/etc/systemd/system/multi-user.target.wants/lxd-agent.service
# Install the units.
cp udev/99-lxd-agent.rules /lib/udev/rules.d/
cp systemd/lxd-agent.service /lib/systemd/system/
cp systemd/lxd-agent-setup /lib/systemd/
cp udev/99-lxd-agent.rules "${LIB_UDEV}/rules.d/"
cp systemd/lxd-agent-setup "${LIB_SYSTEMD}/"
if [ "/lib/systemd" = "${LIB_SYSTEMD}" ]; then
cp systemd/lxd-agent.service "${LIB_SYSTEMD}/system/"
else
# Adapt paths for systemd's lib location
sed "/=\/lib\/systemd/ s|=/lib/systemd|=${LIB_SYSTEMD}|" systemd/lxd-agent.service > "${LIB_SYSTEMD}/system/lxd-agent.service"
fi
systemctl daemon-reload
# SELinux handling.
Expand Down

0 comments on commit 516c04d

Please sign in to comment.