From 3d60a7ab3142b603cd417b99398f838f5d00c3ad Mon Sep 17 00:00:00 2001 From: axtloss Date: Thu, 20 Oct 2022 19:43:21 +0200 Subject: [PATCH] Create /var/lib/AccountsService before writing into file --- src/functions/users.rs | 1 + src/internal/files.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/functions/users.rs b/src/functions/users.rs index 9cdca2a..335f545 100755 --- a/src/functions/users.rs +++ b/src/functions/users.rs @@ -66,6 +66,7 @@ pub fn new_user(username: &str, hasroot: bool, password: &str, do_hash_pass: boo files::append_file("/mnt/etc/sudoers", "\nDefaults pwfeedback\n"), "Add pwfeedback to sudoers", ); + files::create_directory("/mnt/var/lib/AccountsService"); files::create_file(&format!("/mnt/var/lib/AccountsService/users/{}", username)); files_eval( files::append_file( diff --git a/src/internal/files.rs b/src/internal/files.rs index 6b64484..7a2a687 100755 --- a/src/internal/files.rs +++ b/src/internal/files.rs @@ -46,5 +46,5 @@ pub fn sed_file(path: &str, find: &str, replace: &str) -> std::io::Result<()> { } pub fn create_directory(path: &str) -> std::io::Result<()> { - std::fs::create_dir(path) + std::fs::create_dir_all(path) }