umask support
This commit is contained in:
parent
ea04da9bd3
commit
d69352076e
2 changed files with 15 additions and 6 deletions
|
@ -16,6 +16,7 @@ def get_conf(prefix="LARIGIRA_"):
|
|||
conf["CONTINOUS_AUDIOSPEC"] = dict(kind="mpd", howmany=1)
|
||||
conf["MPD_HOST"] = os.getenv("MPD_HOST", "localhost")
|
||||
conf["MPD_PORT"] = int(os.getenv("MPD_PORT", "6600"))
|
||||
conf["UMASK"] = None
|
||||
conf["CACHING_TIME"] = 10
|
||||
conf["DB_URI"] = os.path.join(conf_dir, "db.json")
|
||||
conf["SCRIPTS_PATH"] = os.path.join(conf_dir, "scripts")
|
||||
|
|
|
@ -60,12 +60,6 @@ def sd_notify(ready=False, status=None):
|
|||
|
||||
|
||||
def main():
|
||||
tempfile.tempdir = os.environ["TMPDIR"] = os.path.join(
|
||||
os.getenv("TMPDIR", "/tmp"), "larigira.%d" % os.getuid()
|
||||
)
|
||||
if not os.path.isdir(os.environ["TMPDIR"]):
|
||||
os.makedirs(os.environ["TMPDIR"])
|
||||
|
||||
if get_conf()["LOG_CONFIG"]:
|
||||
logging.config.fileConfig(
|
||||
get_conf()["LOG_CONFIG"], disable_existing_loggers=True
|
||||
|
@ -91,6 +85,20 @@ def main():
|
|||
"Starting larigira with this conf:\n%s",
|
||||
json.dumps(get_conf(), indent=2),
|
||||
)
|
||||
|
||||
if get_conf()["UMASK"]:
|
||||
umask = int(get_conf()["UMASK"], base=8)
|
||||
logging.debug(
|
||||
"Setting umask %s (decimal: %d)", get_conf()["UMASK"], umask
|
||||
)
|
||||
os.umask(umask)
|
||||
|
||||
tempfile.tempdir = os.environ["TMPDIR"] = os.path.join(
|
||||
os.getenv("TMPDIR", "/tmp"), "larigira.%d" % os.getuid()
|
||||
)
|
||||
if not os.path.isdir(os.environ["TMPDIR"]):
|
||||
os.makedirs(os.environ["TMPDIR"])
|
||||
|
||||
if get_conf()["MPD_WAIT_START"]:
|
||||
|
||||
while True:
|
||||
|
|
Loading…
Reference in a new issue