refactor: systemd units in services/, read with service_file like patches/

This commit is contained in:
theupriser committed 2026-09-27 15:58:41 +02:00
1 parent de70fad000
commit 0883e7a501
20 files changed
+147 -114

No files matched your search

+11
View File
@@ -9,6 +9,17 @@ ok() { echo -e "${c_green}[OK]${c_reset} $*"; }
# patch_file <name>: a file from patches/ (module sources, patches). The
# single-file build replaces this with one that has them embedded.
patch_file() { cat "$SCRIPT_DIR/patches/$1"; }
# service_file <name> [KEY=value...]: a systemd unit from services/, with
# each @KEY@ replaced by its value. The single-file build replaces
# service_raw like patch_file.
service_raw() { cat "$SCRIPT_DIR/services/$1"; }
service_file() {
local name="$1" kv
local -a subst=(-e '')
shift
for kv in "$@"; do subst+=(-e "s|@${kv%%=*}@|${kv#*=}|g"); done
service_raw "$name" | sed "${subst[@]}"
}
warn() { echo -e "${c_yellow}[WARN]${c_reset} $*"; }
err() { echo -e "${c_red}[ERROR] $*${c_reset}" >&2; }
ask_yn() {