summaryrefslogtreecommitdiffstats
path: root/daemon/lua/distro-preconfig.lua.in
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/lua/distro-preconfig.lua.in')
-rw-r--r--daemon/lua/distro-preconfig.lua.in16
1 files changed, 16 insertions, 0 deletions
diff --git a/daemon/lua/distro-preconfig.lua.in b/daemon/lua/distro-preconfig.lua.in
new file mode 100644
index 0000000..a27974a
--- /dev/null
+++ b/daemon/lua/distro-preconfig.lua.in
@@ -0,0 +1,16 @@
+-- SPDX-License-Identifier: GPL-3.0-or-later
+local id = os.getenv('SYSTEMD_INSTANCE')
+if not id then
+ warn('environment variable $SYSTEMD_INSTANCE not set')
+else
+ -- Bind to control socket in run_dir
+ worker.control_path = '@run_dir@/control/'
+ local path = worker.control_path..id
+ local ok, err = pcall(net.listen, path, nil, { kind = 'control' })
+ if not ok then
+ warn('bind to '..path..' failed '..err)
+ end
+end
+
+-- Set cache location
+rawset(cache, 'current_storage', 'lmdb://@systemd_cache_dir@')