Entropy/Permissions:
- set proper permissions to the pid file - ignore OSError exceptions on run_sync() when trying to setup database file permissions git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2046 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
@@ -6231,7 +6231,10 @@ class RepoInterface:
|
||||
continue
|
||||
|
||||
if os.path.isfile(dbfile) and os.access(dbfile,os.W_OK):
|
||||
self.Entropy.setup_default_file_perms(dbfile)
|
||||
try:
|
||||
self.Entropy.setup_default_file_perms(dbfile)
|
||||
except OSError: # notification applet
|
||||
pass
|
||||
|
||||
# database is going to be updated
|
||||
self.dbupdated = True
|
||||
|
||||
@@ -1098,6 +1098,10 @@ def const_setupEntropyPid():
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
try:
|
||||
const_chmod_entropy_pid()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
else:
|
||||
#if etpConst['uid'] == 0:
|
||||
@@ -1115,6 +1119,19 @@ def const_setupEntropyPid():
|
||||
f.flush()
|
||||
f.close()
|
||||
|
||||
try:
|
||||
const_chmod_entropy_pid()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def const_chmod_entropy_pid():
|
||||
try:
|
||||
mygid = const_get_entropy_gid()
|
||||
except KeyError:
|
||||
mygid = 0
|
||||
const_setup_file(etpConst['pidfile'], mygid, 0664)
|
||||
|
||||
def const_createWorkingDirectories():
|
||||
|
||||
# handle pid file
|
||||
@@ -1380,15 +1397,18 @@ def const_setup_perms(mydir, gid):
|
||||
for item in files:
|
||||
item = os.path.join(currentdir,item)
|
||||
try:
|
||||
cur_gid = os.stat(item)[stat.ST_GID]
|
||||
if cur_gid != gid:
|
||||
os.chown(item,-1,gid)
|
||||
cur_mod = const_get_chmod(item)
|
||||
if cur_mod != oct(0664):
|
||||
os.chmod(item,0664)
|
||||
const_setup_file(item, gid, 0664)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def const_setup_file(myfile, gid, chmod):
|
||||
cur_gid = os.stat(myfile)[stat.ST_GID]
|
||||
if cur_gid != gid:
|
||||
os.chown(myfile,-1,gid)
|
||||
cur_mod = const_get_chmod(myfile)
|
||||
if cur_mod != oct(chmod):
|
||||
os.chmod(myfile,chmod)
|
||||
|
||||
# you need to convert to int
|
||||
def const_get_chmod(item):
|
||||
st = os.stat(item)[stat.ST_MODE]
|
||||
|
||||
Reference in New Issue
Block a user