TN CORE - approaching sell by date - scripts

My child was in first grade doing distance learning, during the pandemic, learning to read which made things extra difficult. So to help him I spun up a quick FAMP and took a crash course in M4. I used M4 to generate webpages quickly.

My input looked like this.

MATH(Addition, 1 + 1 = , 2)
MATH(Addition, 1 + 2 = , 3)
MATH(Addition, 2 + 1 = , 3)

Which got inserted into m4 template and output html pages I uploaded to my web server. Fast and easy.

I imagine whatever my setup is after “that-date-which-may-or-may-not-be-here-sometime” setup will require a few configuration scripts for setup, cleanup, services, etc.

To keep my script writing down to a maintainable level, I am dusting off those limited M4 skills and getting setup to automate some script setups. I am envisioning creating regular scripts and rc.d type stuff with some m4 templates. This way, if I need to change from a regular script to a rc.d type I can do so with less effort.

Thoughts, ideas, script ideas/concepts I’ll need? I will take whatever advice/pointers/comments/etc. you may have (I am only in the framework stage of this idea).

rcdscript.sh.m4

define([RCDSCRIPT], [
divert(0)dnl
[name="$1"

start_cmd="${name}_start" 
stop_cmd=":" 

$1_start() 
{
        echo "$2"
}]
divert(-1)
])

divert(0)dnl
#!/bin/sh 

. /etc/rc.subr 

divert(1)dnl

load_rc_config $name 
run_rc_command "$1"
divert(-1)

helloworld.mc

RCDSCRIPT(dummy, Hello World!)

Call m4 to make hello world rc.d script.

#!/bin/sh 

. /etc/rc.subr 

name="dummy"

start_cmd="${name}_start" 
stop_cmd=":" 

dummy_start() 
{
        echo "Hello World!"
}

load_rc_config $name 
run_rc_command "$1"

Wasnt stated outright but of course, I’ll share results/setups/etc. once I get some traction under this effort.

UPDATE: I got a few minutes to expand on this idea but it wasn’t working as I expected/wanted. I started down a path of some makefile type automation but that would be geared more for updating personal type dotfiles -i.e. not system configs.

However, I did find this last night: GitHub - BastilleBSD/rocinante: Rosinante is lightweight configuration management software.
which I think may have potential. I whipped up a simple test template, created a jail and ran a successful test. But, again this is sort of one sided being mostly for packages and whatnot.