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["CONTINOUS_AUDIOSPEC"] = dict(kind="mpd", howmany=1)
|
||||||
conf["MPD_HOST"] = os.getenv("MPD_HOST", "localhost")
|
conf["MPD_HOST"] = os.getenv("MPD_HOST", "localhost")
|
||||||
conf["MPD_PORT"] = int(os.getenv("MPD_PORT", "6600"))
|
conf["MPD_PORT"] = int(os.getenv("MPD_PORT", "6600"))
|
||||||
|
conf["UMASK"] = None
|
||||||
conf["CACHING_TIME"] = 10
|
conf["CACHING_TIME"] = 10
|
||||||
conf["DB_URI"] = os.path.join(conf_dir, "db.json")
|
conf["DB_URI"] = os.path.join(conf_dir, "db.json")
|
||||||
conf["SCRIPTS_PATH"] = os.path.join(conf_dir, "scripts")
|
conf["SCRIPTS_PATH"] = os.path.join(conf_dir, "scripts")
|
||||||
|
|
|
@ -60,12 +60,6 @@ def sd_notify(ready=False, status=None):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
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"]:
|
if get_conf()["LOG_CONFIG"]:
|
||||||
logging.config.fileConfig(
|
logging.config.fileConfig(
|
||||||
get_conf()["LOG_CONFIG"], disable_existing_loggers=True
|
get_conf()["LOG_CONFIG"], disable_existing_loggers=True
|
||||||
|
@ -91,6 +85,20 @@ def main():
|
||||||
"Starting larigira with this conf:\n%s",
|
"Starting larigira with this conf:\n%s",
|
||||||
json.dumps(get_conf(), indent=2),
|
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"]:
|
if get_conf()["MPD_WAIT_START"]:
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in a new issue