summaryrefslogtreecommitdiff
path: root/pre-commit.d/30store-metadata
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-02-04 21:13:21 -0500
committerJoey Hess <joey@gnu.kitenet.net>2009-02-04 21:13:21 -0500
commit1c6c74fd2a6a9b9fd0c650f38a4c6b9d0e7b4f79 (patch)
tree791f11aeb82029dd0d66d92b900f64d90c163dee /pre-commit.d/30store-metadata
parent41399646d5177dec6898399f091382b5eb1b5d20 (diff)
avoid hardcoding root user/group
Patch from Tobias Hunger who is trying to use etckeeper with non-root users, outside of /etc.
Diffstat (limited to 'pre-commit.d/30store-metadata')
-rwxr-xr-xpre-commit.d/30store-metadata6
1 files changed, 3 insertions, 3 deletions
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