Skip to contentSkip to conversation

Fix error message when using RHEL init script

PATCH In review Richard van den Berg 3 participants 4 messages Dec 21, 2018 – Dec 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix error message when using RHEL init script

In RHEL 7 /etc/sysconfig/network is no longer used (still there but empty). This results in the following error when openvpn starts:

Dec 20 09:01:25 localhost openvpn: /etc/rc.d/init.d/openvpn: line 94: [: =: unary operator expected
---
 distro/rpm/openvpn.init.d.rhel | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
distro/rpm/openvpn.init.d.rhel +1 -1
index cdf3e9de..bfde2216 100755
@@ -91,7 +91,7 @@ work=/etc/openvpn
 . /etc/sysconfig/network
 
 # Check that networking is up.
-if [ ${NETWORKING} = "no" ]
+if [ "${NETWORKING}" = "no" ]
 then
   echo "Networking is down"
   exit 0
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw

Whatever the future might bring for this script (like "going away in favour of systemd units"), this is a reasonable fix for now - never rely on shell variables to be non-empty in script comparisons.

Your patch has been applied to the master and release/2.4 branch.

As a side note: please use "git send-email" to avoid your patch getting broken by your mail client (it was whitespace-massacred so needed manual adjustment) and use "git commit -s" so we have a proper signed-off-by:
line. No hard requirements for a mini-fix, but for the next and bigger one you'll hopefully send one day :-)

commit 7e711035f12a25199c3a04193ee4e22e43930f6a (master) commit d18fa4aab1b73074d71a4d8cbf894c73c689d2ec (release/2.4)

Author: Richard van den Berg via Openvpn-devel
Date:   Fri Dec 21 07:43:28 2018 +0100
     Fix error message when using RHEL init script

     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg18057.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#2 lore raw
In reply to Richard van den Berg
Quoted 5 lines · Richard van den Berg via Openvpn-devel

In RHEL 7 /etc/sysconfig/network is no longer used (still there but empty). This results in the following error when openvpn starts:

Dec 20 09:01:25 localhost openvpn: /etc/rc.d/init.d/openvpn: line 94: [: =:

unary operator expected

Not related to this fix, but we really need to get rid of the distro/rpm folder. These init script should NOT be used on any systemd based systems at all.

The complete distro/rpm folder is essentially unmaintained, as the .spec file here most likely breaks any modern packaging guidelines. If you want the proper maintained .spec file, look at the ones in the Fedora EPEL repository [0].

As we don't here much from the upstream SUSE package maintainers, I don't have a good pointer for that RPM flavour. But I presume their spec file is also far better maintained than the one we ship here.

[0] <https://src.fedoraproject.org/rpms/openvpn/tree/epel7>

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#3 lore raw

Hi,

Quoted 9 lines · David Sommerseth
Quoted 5 lines · Richard van den Berg via Openvpn-devel

In RHEL 7 /etc/sysconfig/network is no longer used (still there but empty). This results in the following error when openvpn starts:

Dec 20 09:01:25 localhost openvpn: /etc/rc.d/init.d/openvpn: line 94: [: =:

unary operator expected

Not related to this fix, but we really need to get rid of the distro/rpm folder. These init script should NOT be used on any systemd based systems at all.

I've expected a comment along that lines :-) - and I'm not objecting to a massive cleanup here.

But as long as we keep the script, it should better be well-behaved, thus, my ACK :-)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...