PREIN
/bin/sh
getent group ovirtagent >/dev/null || groupadd -r -g 175 ovirtagent
getent passwd ovirtagent > /dev/null || \
/usr/sbin/useradd -u 175 -g 175 -o -r ovirtagent \
-c "oVirt Guest Agent" -d /usr/share/ovirt-guest-agent -s /sbin/nologin
exit 0
PREUN
/bin/sh
if [ "$1" -eq 0 ]
then
# New macro for F18+
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
systemctl --no-reload disable ovirt-guest-agent.service > /dev/null 2>&1 || :
systemctl stop ovirt-guest-agent.service > /dev/null 2>&1 || :
fi
# Send an "uninstalled" notification to vdsm.
VIRTIO=`grep "^device" /etc/ovirt-guest-agent.conf | awk '{ print $3; }'`
if [ -w $VIRTIO ]
then
# Non blocking uninstalled notification
echo -e '{"__name__": "uninstalled"}\n' | dd of=$VIRTIO \
oflag=nonblock status=noxfer conv=nocreat 1>& /dev/null || :
fi
fi
POSTIN
/bin/sh
/sbin/udevadm trigger --subsystem-match="virtio-ports" \
--attr-match="name=com.redhat.rhevm.vdsm"
# New macro for F18+
if [ $1 -eq 1 ] ; then
# Initial installation
systemctl preset ovirt-guest-agent.service >/dev/null 2>&1 || :
fi
POSTUN
/bin/sh
if [ "$1" -eq 0 ]
then
# Let udev clear access rights
/sbin/udevadm trigger --subsystem-match="virtio-ports" \
--attr-match="name=com.redhat.rhevm.vdsm"
fi
# New macro for F18+
systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
systemctl try-restart ovirt-guest-agent.service >/dev/null 2>&1 || :
fi