1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-02-13 09:44:40 +00:00

Fix chmod/chown for single file

This commit is contained in:
verbumfeit 2018-02-27 18:18:15 +01:00 committed by evilhero
parent cd5bbfe74b
commit e1e2916f07

View file

@ -1391,6 +1391,10 @@ def setperms(path, dir=False):
permission = int(mylar.CONFIG.CHMOD_DIR, 8) permission = int(mylar.CONFIG.CHMOD_DIR, 8)
os.chmod(path, permission) os.chmod(path, permission)
os.chown(path, chowner, chgroup) os.chown(path, chowner, chgroup)
elif os.path.isfile(path):
permission = int(mylar.CONFIG.CHMOD_FILE, 8)
os.chown(path, chowner, chgroup)
os.chmod(path, permission)
else: else:
for root, dirs, files in os.walk(path): for root, dirs, files in os.walk(path):
for momo in dirs: for momo in dirs:
@ -1404,6 +1408,9 @@ def setperms(path, dir=False):
logger.fdebug('Successfully changed ownership and permissions [' + str(mylar.CONFIG.CHOWNER) + ':' + str(mylar.CONFIG.CHGROUP) + '] / [' + str(mylar.CONFIG.CHMOD_DIR) + ' / ' + str(mylar.CONFIG.CHMOD_FILE) + ']') logger.fdebug('Successfully changed ownership and permissions [' + str(mylar.CONFIG.CHOWNER) + ':' + str(mylar.CONFIG.CHGROUP) + '] / [' + str(mylar.CONFIG.CHMOD_DIR) + ' / ' + str(mylar.CONFIG.CHMOD_FILE) + ']')
elif os.path.isfile(path):
permission = int(mylar.CONFIG.CHMOD_FILE, 8)
os.chmod(path, permission)
else: else:
for root, dirs, files in os.walk(path): for root, dirs, files in os.walk(path):
for momo in dirs: for momo in dirs: