]> git.proxmox.com Git - mirror_ovs.git/commitdiff
rhel: Fix literal dollar sign usage in systemd service files
authorTimothy Redaelli <tredaelli@redhat.com>
Mon, 16 Apr 2018 15:15:47 +0000 (17:15 +0200)
committerBen Pfaff <blp@ovn.org>
Tue, 17 Apr 2018 15:38:54 +0000 (08:38 -0700)
Currently (at least on RHEL 7.5) openvswitch fails to start (with DPDK
enabled) as non-root, since chown fails and "/dev/hugepages" group is not
changed.

Commit tested on Fedora 28 and RHEL 7.5, both as root as non-root user.

From man 5 systemd.service:

  To pass a literal dollar sign, use "$$". Variables whose value is not known
  at expansion time are treated as empty strings. Note that the first argument
  (i.e. the program to execute) may not be a variable.

CC: Aaron Conole <aconole@redhat.com>
Fixes: 4299145c1095 ("rhel: don't drop capabilities when running as root")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
rhel/usr_lib_systemd_system_ovs-vswitchd.service.in
rhel/usr_lib_systemd_system_ovsdb-server.service

index 889740f1a46676b84b24c2108ffbfaab974119e6..11b34c68612dbe08866dadb866b6e4338643720f 100644 (file)
@@ -15,7 +15,7 @@ EnvironmentFile=/etc/openvswitch/default.conf
 EnvironmentFile=-/etc/sysconfig/openvswitch
 EnvironmentFile=-/run/openvswitch/useropts
 @begin_dpdk@
-ExecStartPre=-/bin/sh -c '/usr/bin/chown :${OVS_USER_ID##*:} /dev/hugepages'
+ExecStartPre=-/bin/sh -c '/usr/bin/chown :$${OVS_USER_ID##*:} /dev/hugepages'
 ExecStartPre=-/usr/bin/chmod 0775 /dev/hugepages
 @end_dpdk@
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
index e05742d872dbc39dbdffebdc38857a539a03be46..0fa57a925a92431181f5925500249292d03f9445 100644 (file)
@@ -11,7 +11,7 @@ Restart=on-failure
 EnvironmentFile=/etc/openvswitch/default.conf
 EnvironmentFile=-/etc/sysconfig/openvswitch
 ExecStartPre=/usr/bin/chown ${OVS_USER_ID} /var/run/openvswitch
-ExecStartPre=/bin/sh -c 'rm -f /run/openvswitch/useropts; if [ "${OVS_USER_ID/:*/}" != "root" ]; then /usr/bin/echo "OVSUSER=--ovs-user=${OVS_USER_ID}" > /run/openvswitch/useropts; fi'
+ExecStartPre=/bin/sh -c 'rm -f /run/openvswitch/useropts; if [ "$${OVS_USER_ID/:*/}" != "root" ]; then /usr/bin/echo "OVSUSER=--ovs-user=${OVS_USER_ID}" > /run/openvswitch/useropts; fi'
 EnvironmentFile=-/run/openvswitch/useropts
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
           --no-ovs-vswitchd --no-monitor --system-id=random \