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 Aug 29, 2024
1 parent f71c928 commit 8f623dd
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions lxd/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2866,17 +2866,35 @@ if [ ! -d "/run/systemd/system/" ]; then
exit 1
fi
LIB_SYSTEMD="/lib/systemd"
[ -d "${LIB_SYSTEMD}/system/" ] || LIB_SYSTEMD="/usr${LIB_SYSTEMD}"
if [ ! -d "${LIB_SYSTEMD}" ]; then
echo "Could not find path to systemd"
exit 1
fi
LIB_UDEV="/lib/udev"
[ -d "${LIB_UDEV}/rules.d/" ] || LIB_UDEV="/usr${LIB_UDEV}"
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_SYSTEM}" ]; then
cp systemd/lxd-agent.service "${LIB_SYSTEMD}/system/"
else
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 8f623dd

Please sign in to comment.