Template directories are Makefile-configured.

This commit is contained in:
Luka Vandervelden 2019-10-24 00:41:55 +02:00
parent 0c3a61f58d
commit f40dbccc1f
2 changed files with 6 additions and 4 deletions

View File

@ -5,6 +5,8 @@ RC_DIRECTORY = "@SYSCONFDIR@/rc/services"
LOG_DIRECTORY = "@VARSTATEDIR@/log"
SERVICES_DIRECTORY = "@SHAREDIR@/services"
ENVIRONMENTS_DIRECTORY = "@SYSCONFDIR@/rc/environments"
SYSTEM_CONFIGURATION_DIRECTORY = "@SYSCONFDIR@"
SHARED_DATA_DIRECTORY = "@SHAREDIR@"
OWN_LIBEXEC_DIR = "@LIBEXECDIR@/service"
CACHE_DIRECTORY = "@VARSTATEDIR@/cache"

View File

@ -1,5 +1,7 @@
require "crinja"
require "./config.cr"
def sanitize_path(path)
path.gsub /\/\/+/, "/"
end
@ -41,11 +43,9 @@ class Configure::Context
def generate(template, target : String, options : Hash(String, String | Array(String) | Crinja::Callable::Instance | Hash(String, String)))
target_file = File.open target, "w"
# FIXME: Alter default sources at build-time.
# FIXME: Well want a way to alter those context-wide.
sources = [
"/etc/templates",
"/usr/share/templates"
"#{SYSTEM_CONFIGURATION_DIRECTORY}/templates",
"#{SHARED_DATA_DIRECTORY}/templates"
]
sources = sources