#Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
#Requires: kernel >= 3.15.0-0
+Requires(post): /usr/bin/getent
+Requires(post): /usr/sbin/useradd
+Requires(post): /usr/bin/sed
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
%post
+if [ $1 -eq 1 ]; then
+ getent passwd openvswitch >/dev/null || \
+ useradd -r -d / -s /sbin/nologin -c "Open vSwitch Daemons" openvswitch
+
+ sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
+
+ # In the case of upgrade, this is not needed.
+ chown -R openvswitch:openvswitch /etc/openvswitch
+fi
+
%if 0%{?systemd_post:1}
%systemd_post %{name}.service
%else
Restart=on-failure
EnvironmentFile=/etc/openvswitch/default.conf
EnvironmentFile=-/etc/sysconfig/openvswitch
+ExecStartPre=/usr/bin/chown ${OVS_USER_ID} /var/run/openvswitch
ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
--no-ovs-vswitchd --no-monitor --system-id=random \
--ovs-user=${OVS_USER_ID} \