This allows sysusers to operate with --root that is an empty directory.
It may be useful to, for example, populate the user database before installing
anything else.
firstboot was already doing this, so drop the duplicated call there.
#include "fileio.h"
#include "format-util.h"
#include "macro.h"
+#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "path-util.h"
if (!path)
return log_oom_debug();
+ (void) mkdir_parents(path, 0755);
+
_cleanup_close_ int fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0600);
if (fd < 0)
return log_debug_errno(errno, "Cannot open %s: %m", path);
return 0;
}
- (void) mkdir_parents(etc_passwd, 0755);
-
lock = take_etc_passwd_lock(arg_root);
if (lock < 0)
return log_error_errno(lock, "Failed to take a lock on %s: %m", etc_passwd);