3 ms·
I addressed this in my packages with a roughly declarative language that turned into shell functions in a Debian, Arch, or FreeBSD package (by dint of prefixing
by JdeBP 8y ago
I addressed this in my packages with a roughly declarative language that turned into shell functions in a Debian, Arch, or FreeBSD package (by dint of prefixing with a shell function library) and into the packing list format for OpenBSD (by dint of an awk script). Examples:
# dedicated user accounts
file_owning_user "cron" "/var/spool/cron"
directory "cron" "/var/spool/cron" "0755"
directory "cron" "/var/spool/cron/tmp" "0700"
directory "cron" "/var/spool/cron/crontabs" "0700"
# bcron services
service_with_dedicated_logger "bcron-start"
service_with_dedicated_logger "bcron-update"
socket_with_dedicated_logger "bcron-spool"
# user-mode TTYs
user_tty "vc1-tty"
user_tty "vc2-tty"
user_tty "vc3-tty"
service_with_dedicated_logger "terminal-emulator@vc1"
service_with_dedicated_logger "terminal-emulator@vc2"
service_with_dedicated_logger "terminal-emulator@vc3"
login_service_with_dedicated_logger "vc1-tty"
login_service_with_dedicated_logger "vc2-tty"
login_service_with_dedicated_logger "vc3-tty"
# TTY ancillaries
service_with_dedicated_logger "console-input-method@head0"
service_with_dedicated_logger "console-multiplexor@head0"
service_with_dedicated_logger "console-fb-realizer@head0"
There are different shell function mappings for pre/post-install/remove/update, making what (say) "login_service_with_dedicated_logger" does vary according to the action being taken and whether the package is a "tools" package or a "run" package. In the post-install of a "tools" package it creates dedicated user accounts and log file directories. In the post-install of a "run" package it conditionally enables and starts services.
It still needed the ability to run general-purpose commands here and there, especially to perform tidying up as things were renamed and errors were corrected over the years, and the number of declarative verbs that one turns out to need in practice is quite large.