Add optional per-service companion doc files to write_readme
Any services/<name>.md next to services/<name>.sh gets appended to the generated ~/docker/<name>/README.md automatically, with no changes needed to the calling install_<name>() function. Keeps install-time-invariant walkthroughs (third-party UI linking steps, multi-account setup) out of the compose/README heredocs, which should stay focused on values chosen during install. Add services/traccar.md as the reference example: documents the per-user Connections-tab linking needed for ntfy notifications to reach non-admin accounts, and why TEST CHANNELS can return success without actually sending anything (Traccar's SMS notificator silently no-ops when the logged-in user's Phone field is empty).
This commit is contained in:
@@ -472,6 +472,13 @@ prompt_reinstall_mode() {
|
||||
# # Title
|
||||
# ...
|
||||
# MD
|
||||
#
|
||||
# If services/<name>.md exists next to the calling services/<name>.sh, its
|
||||
# contents are appended automatically. That file is optional and untouched by
|
||||
# setup.sh's services/*.sh glob (doesn't register, doesn't run) — it's just a
|
||||
# place for install-time-invariant walkthroughs (multi-step UI instructions,
|
||||
# third-party linking, etc.) that would otherwise bloat the heredoc above with
|
||||
# content that doesn't depend on any variable chosen during install.
|
||||
write_readme() {
|
||||
local dir="$1"
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
@@ -481,6 +488,16 @@ write_readme() {
|
||||
fi
|
||||
mkdir -p "$dir"
|
||||
cat > "$dir/README.md"
|
||||
|
||||
local caller_script="${BASH_SOURCE[1]:-}"
|
||||
if [ -n "$caller_script" ]; then
|
||||
local companion_doc="${caller_script%.sh}.md"
|
||||
if [ -f "$companion_doc" ]; then
|
||||
printf '\n' >> "$dir/README.md"
|
||||
cat "$companion_doc" >> "$dir/README.md"
|
||||
fi
|
||||
fi
|
||||
|
||||
chown "$ACTUAL_USER:$ACTUAL_USER" "$dir/README.md" 2>/dev/null || true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user