Factor out stuff into a shell library
Originally created by Tails on #6145 (Redmine)
Some of our custom shell scripts duplicate code that should be
refactored out to our shell script library
these can included instead, both for improved code clarity and the usual
reasons for avoiding code duplication.
In some cases porting to Python would be better than refactoring shell code, though: #11198.