Add a library file containing common logic to be sourced by individual backup scripts
This commit refactors the codebase in order to make the shellcheck workflow pass.