harden runtime config and docs
This commit is contained in:
@@ -19,10 +19,23 @@ CONFIG_DEST="/etc/uce/settings.cfg"
|
||||
|
||||
action="${1:-setup}"
|
||||
|
||||
render_runtime_file() {
|
||||
local source="$1"
|
||||
local destination="$2"
|
||||
local mode="$3"
|
||||
local tmp
|
||||
tmp="$(mktemp)"
|
||||
trap 'rm -f "$tmp"' RETURN
|
||||
sed "s#/Code/uce.openfu.com/uce#$REPO_ROOT#g" "$source" > "$tmp"
|
||||
install -D -m "$mode" "$tmp" "$destination"
|
||||
rm -f "$tmp"
|
||||
trap - RETURN
|
||||
}
|
||||
|
||||
install_unit() {
|
||||
install -D -m 0644 "$UNIT_SOURCE" "$UNIT_DEST"
|
||||
render_runtime_file "$UNIT_SOURCE" "$UNIT_DEST" 0644
|
||||
if [[ ! -f "$CONFIG_DEST" ]]; then
|
||||
install -D -m 0644 "$CONFIG_SOURCE" "$CONFIG_DEST"
|
||||
render_runtime_file "$CONFIG_SOURCE" "$CONFIG_DEST" 0644
|
||||
fi
|
||||
systemctl daemon-reload
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user