distgit: Ensure the hardlinked sources all belong to apache
Without this, client uploads and downloads aren't working any more.
This commit is contained in:
parent
25fee56c80
commit
af02e32085
1 changed files with 9 additions and 0 deletions
|
@ -19,8 +19,10 @@
|
|||
|
||||
import argparse
|
||||
import errno
|
||||
from grp import getgrnam
|
||||
import hashlib
|
||||
import os
|
||||
from pwd import getpwnam
|
||||
import sys
|
||||
|
||||
|
||||
|
@ -128,6 +130,9 @@ def hardlink(src, dst):
|
|||
|
||||
|
||||
def main(root, link_hashtype, perform=False):
|
||||
ownerid = getpwnam('apache').pw_uid
|
||||
groupid = getgrnam('apache').gr_gid
|
||||
|
||||
try:
|
||||
os.chdir(root)
|
||||
info("All future paths relative to %s" % root)
|
||||
|
@ -181,6 +186,10 @@ def main(root, link_hashtype, perform=False):
|
|||
|
||||
if perform:
|
||||
hardlink(source_path, new_path)
|
||||
segments = new_path.split('/')
|
||||
|
||||
for i in range(1, len(segments) + 1):
|
||||
os.chown('/'.join(segments[:i], ownerid, groupid)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue