Created
October 8, 2014 14:55
-
-
Save meunierd/788f8dd377af9e10eb1f to your computer and use it in GitHub Desktop.
S3FS Wrapper -- sets file permissions properly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import sys | |
from subprocess import check_output, call | |
def current_uid_gid(): | |
user = check_output(['id']).split()[:2] | |
digit = lambda id_: int(re.search(r'\d+', id_).group()) | |
return map(digit, user) | |
def main(): | |
uid, gid = current_uid_gid() | |
args = ['s3fs'] + sys.argv[1:] + ['-ouid=%d' % uid, '-ogid=%d' % gid] | |
call(args) | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment