diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2023-06-08 09:22:40 +0300 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2023-06-13 00:53:07 +0300 |
commit | 1dc30e8b30f95f6c5a4fbe91ec6e68857857c320 (patch) | |
tree | 6965215e1c4d2074b335f44003614e57fc0d22fc | |
parent | b5251ae29cc31b078c6b8ca00aaa441a20710596 (diff) | |
download | openbmc-1dc30e8b30f95f6c5a4fbe91ec6e68857857c320.tar.xz |
meta-ibm: first-boot-disable-ipmi-net: Fix unit condition
The [Service] section specifies:
```
ExecStart=/bin/touch /var/lib/ipmi-net-disable-one-time
```
However, the [Unit] section specifies the following condition:
```
ConditionFileNotEmpty=!/var/lib/ipmi-net-disable-one-time
```
The documentation for ConditionFileNotEmpty[1] states:
> ConditionFileNotEmpty= is similar to ConditionPathExists= but verifies
> that a certain path exists and refers to a regular file with a
> non-zero size.
[1]: https://www.freedesktop.org/software/systemd/man/systemd.unit.html#ConditionFileNotEmpty=
And the documentation for `touch`[2] states:
> A FILE argument that does not exist is created empty, unless -c or -h
> is supplied.
[2]: https://www.man7.org/linux/man-pages/man1/touch.1.html
Neither `-c` nor `-h` are supplied, therefore the ExecStart= directive
will create an empty file. As the ConditionFileNotEmpty= directive is
negated the condition will always pass: Either the file doesn't exist,
or it does exist and is empty. Therefore, as configured, this unit
always runs.
Always running the unit is counter to its 'one-time' name. Switch to
`ConditionPathExists=`[3] to enforce the one-time nature.
[3]: https://www.freedesktop.org/software/systemd/man/systemd.unit.html#ConditionPathExists=
Change-Id: I1a8418a03c4fb9c6754f72f8651384b2f7e17715
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r-- | meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-net/first-boot-disable-ipmi-net.service | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-net/first-boot-disable-ipmi-net.service b/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-net/first-boot-disable-ipmi-net.service index 92b8c3fb54..2c72a2a758 100644 --- a/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-net/first-boot-disable-ipmi-net.service +++ b/meta-ibm/recipes-phosphor/ipmi/phosphor-ipmi-net/first-boot-disable-ipmi-net.service @@ -5,7 +5,7 @@ After=phosphor-ipmi-net@eth1.service After=phosphor-ipmi-net@eth0.socket After=phosphor-ipmi-net@eth1.socket Before=srvcfg-manager.service -ConditionFileNotEmpty=!/var/lib/ipmi-net-disable-one-time +ConditionPathExists=!/var/lib/ipmi-net-disable-one-time [Service] ExecStart=/bin/systemctl stop phosphor-ipmi-net@eth0.socket @@ -16,7 +16,6 @@ ExecStart=/bin/systemctl stop phosphor-ipmi-net@eth1.socket ExecStart=/bin/systemctl disable phosphor-ipmi-net@eth1.socket ExecStart=/bin/systemctl stop phosphor-ipmi-net@eth1.service ExecStart=/bin/systemctl disable phosphor-ipmi-net@eth1.service -ExecStart=/bin/systemctl --no-reload disable first-boot-disable-ipmi-net.service ExecStart=/bin/touch /var/lib/ipmi-net-disable-one-time SyslogIdentifier=first-boot-disable-ipmi-net Type=oneshot |