Modernize the bootup sequence

This commit is contained in:
Nick Chambers 2021-11-17 16:36:25 -06:00
parent e42a2b248f
commit c33ebdd52c
1 changed files with 11 additions and 18 deletions

29
rowbot
View File

@ -488,31 +488,24 @@ on_sys_exit_999_log() {
# bootup/shutdown sequence
###
on_sys_first_001_bootup() {
on_sys_init_010_bootup() {
DEFAULT=${USER:-uplime} state_resolve owner
DEFAULT=\` state_resolve trigger
DEFAULT=yes state_resolve dev
}
on_sys_first_005_bootup() {
log_info "rowbot's pid is %d" "$$"
}
on_sys_before_999_bootup() {
local setting setting_name
on_sys_before_995_bootup() {
log_debug "storing the config"
for setting in "${!config[@]}"; do
setting_name=${setting//-/_}
export "CONFIG_${setting_name^^}=${config[$setting]}"
log_trace "storing config key %s with value %s" "CONFIG_${setting_name^^}" "${config[$setting]}"
done
put_assoc_array config
}
on_sys_after_001_bootup() {
on_sys_after_005_bootup() {
log_debug "reloading the config"
local setting setting_name
while IFS= read -r setting; do
setting_name=${setting#CONFIG_} setting_name=${setting_name//_/-}
config[${setting_name,,}]=${!setting}
unset "$setting"
log_trace "getting config key %s with value %s" "CONFIG_${setting_name^^}" "${config[$setting]}"
done < <(compgen -e CONFIG_)
get_assoc_array config
}
on_sys_exit_999_bootup() {