From 87de61f78c571c600d95656731cee9d82914ed1b Mon Sep 17 00:00:00 2001 From: Alad Wenter Date: Tue, 3 Mar 2015 10:28:07 +0300 Subject: [PATCH] support for owner/group permissions in tmpfiles --- rc.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rc.in b/rc.in index 38b3e14..7e270fd 100755 --- a/rc.in +++ b/rc.in @@ -31,13 +31,14 @@ rc.motd() { } rc.tmpfiles() { - printf '%s\n' "${cfg_tmpdirs[@]}" | while IFS=':' read dir perm; do - mkdir -v -m "${perm:-755}" "$dir" + printf '%s\n' "${cfg_tmpdirs[@]}" | while IFS=':' read dir perm own grp; do + install -v -d -m "${perm:-755}" -o "${own:-root}" -g "${grp:-root}" "$dir" 2>/dev/null done - printf '%s\n' "${cfg_tmpfiles[@]}" | while IFS=':' read file perm; do + printf '%s\n' "${cfg_tmpfiles[@]}" | while IFS=':' read file perm own grp; do > "$file" - chmod -v "${perm:-644}" "$file" + chmod -c "${perm:-644}" "$file" + chown -c "${own:-root}:${grp:-root}" "$file" done }