From 3b903c5c46287cc6f453b3138842715a467c57fb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 2 Sep 2010 14:50:04 +0200 Subject: Set correct group after touching the db file * When writing the db file ensure that it has write permission of the group which owns the parent directory. * This should make the adjust-permissions cron job obsolete. --- db-functions | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'db-functions') diff --git a/db-functions b/db-functions index 28928da..7a751bf 100644 --- a/db-functions +++ b/db-functions @@ -387,3 +387,17 @@ check_repo_permission() { return 0 } + +set_repo_permission() { + local repo=$1 + local arch=$2 + local dbfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" + + if [ -w "${dbfile}" ]; then + local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") + chgrp $group "${dbfile}" || error "Could not change group of ${dbfile} to $group" + chmod g+w "${dbfile}" || error "Could not set write permission for group $group to ${dbfile}" + else + error "You don't have permission to change ${dbfile}" + fi +} -- cgit v1.2.3-24-g4f1b