From 1c6c74fd2a6a9b9fd0c650f38a4c6b9d0e7b4f79 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 4 Feb 2009 21:13:21 -0500 Subject: avoid hardcoding root user/group Patch from Tobias Hunger who is trying to use etckeeper with non-root users, outside of /etc. --- pre-commit.d/30store-metadata | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pre-commit.d/30store-metadata') diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata index cfa05ce..a481c8f 100755 --- a/pre-commit.d/30store-metadata +++ b/pre-commit.d/30store-metadata @@ -37,11 +37,11 @@ generate_metadata() { sort | sed -e "s/^/mkdir -p '/" -e "s/\$/'/" fi - # Find all files and directories that don't have root as the owner - find $NOVCS \! -user root -exec stat --format="maybe chown %U '{}'" {} \; \ + # Find all files and directories that don't have the current user as the owner + find $NOVCS \! -user "$USER" -exec stat --format="maybe chown %U '{}'" {} \; \ | sort | filter_unknown 'maybe chown' owner # Find all files and directories that don't have root as the group - find $NOVCS \! -group root -exec stat --format="maybe chgrp %G '{}'" {} \; \ + find $NOVCS \! -group $(id -g) -exec stat --format="maybe chgrp %G '{}'" {} \; \ | sort | filter_unknown 'maybe chgrp' group # Find all directories that aren't 0755 -- cgit v1.2.3