Replace crude sed encoding scheme with robust forkless scheme that
cannot lead to evaluated code when trying to set status vars.
Whitespace, control characters, redirects, exclamations, backticks,
dollars, globs, and more could be injected into an eval statement
through DISTRIBUTIONS. Using f_str2varname on the remaining invalid
varname chars makes it safe but use setvar builtin anyways.
Replace shell variable indirection with f_getvar for readability.
Comment status number meanings while here.
Fixes: 47d669f10ea3 (bsdinstall: Encode dists to valid variable names in checksum script)
MFC after: 2 weeks