basic/user-util: create /etc from take_etc_passwd_lock
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.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#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"
|
||||
@@ -688,6 +689,8 @@ int take_etc_passwd_lock(const char *root) {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user