]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: env: use /run to store lockfile
authorTim Lee <timlee660101@gmail.com>
Fri, 10 Feb 2023 09:05:39 +0000 (17:05 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 6 Apr 2023 23:10:05 +0000 (19:10 -0400)
According this issue https://github.com/ppp-project/ppp/issues/339.
Eventually, the dt-utils changed lock directory to fix missing /var/lock
directory error then make dt-utils can run normally.

We also have a similar issue with these two utilities fw_printenv and
fw_setenv will failed when the directory /var/lock is non-existent.

We have a custom linux distribution built with yocto (OpenBMC) that
use systemd and it deprecated the /var/lock directory.
More discussion in systemd/systemd#15668.

Thus, we sync with community's solution for uboot/tools/env utilities:
The current location /var/lock is considered legacy (at least by systemd).
Just use /run to store the lockfile and append the usual .lock suffix.

Tested:
Verified /run/lock is now present and fw_printenv can work in OpenBMC.

Signed-off-by: Tim Lee <timlee660101@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
tools/env/fw_env_main.c

index 1d193bd437d83ddfd78508765959f1c4561923c7..0b201b9e6243269ca72c1b9dcd84fa9289bb2353 100644 (file)
@@ -73,7 +73,7 @@ void usage_printenv(void)
                " -c, --config         configuration file, default:" CONFIG_FILE "\n"
 #endif
                " -n, --noheader       do not repeat variable name in output\n"
-               " -l, --lock           lock node, default:/var/lock\n"
+               " -l, --lock           lock node, default:/run\n"
                "\n");
 }
 
@@ -88,7 +88,7 @@ void usage_env_set(void)
 #ifdef CONFIG_FILE
                " -c, --config         configuration file, default:" CONFIG_FILE "\n"
 #endif
-               " -l, --lock           lock node, default:/var/lock\n"
+               " -l, --lock           lock node, default:/run\n"
                " -s, --script         batch mode to minimize writes\n"
                "\n"
                "Examples:\n"
@@ -206,7 +206,7 @@ int parse_setenv_args(int argc, char *argv[])
 
 int main(int argc, char *argv[])
 {
-       char *lockname = "/var/lock/" CMD_PRINTENV ".lock";
+       char *lockname = "/run/" CMD_PRINTENV ".lock";
        int lockfd = -1;
        int retval = EXIT_SUCCESS;
        char *_cmdname;