Numeric saçmalıklara babay...
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
|
import pwd
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
@@ -61,11 +62,11 @@ def chmod(sourceFile, mode = 0755):
|
|||||||
else:
|
else:
|
||||||
ctx.ui.error(_(' ActionsAPI [chmod]: File %s doesn\'t exists.') % (file))
|
ctx.ui.error(_(' ActionsAPI [chmod]: File %s doesn\'t exists.') % (file))
|
||||||
|
|
||||||
def chown(sourceFile, uid = 0, gid = 0):
|
def chown(sourceFile, uid = "root", gid = "root"):
|
||||||
'''change the owner and group id of sourceFile to the numeric uid and gid'''
|
'''change the owner and group id of sourceFile to uid and gid'''
|
||||||
if can_access_file(sourceFile):
|
if can_access_file(sourceFile):
|
||||||
try:
|
try:
|
||||||
os.chown(sourceFile, uid, gid)
|
os.chown(sourceFile, pwd.getpwnam(uid)[2], pwd.getpwnam(gid)[3])
|
||||||
except OSError:
|
except OSError:
|
||||||
ctx.ui.error(_(' ActionsAPI [chown]: Operation not permitted: %s (uid: %s, gid: %s)') \
|
ctx.ui.error(_(' ActionsAPI [chown]: Operation not permitted: %s (uid: %s, gid: %s)') \
|
||||||
% (sourceFile, uid, gid))
|
% (sourceFile, uid, gid))
|
||||||
|
|||||||
Reference in New Issue
Block a user