Draft: add .shellcheckrc after changing code using its warnings
Add .shellcheckrc after changing the code in order to handle shellcheck's warnings.
I didn't find issues while doing this but there are at least three issues that I've had in the past and that shellcheck would have identified or helped identify. The goal of this MR it to make it easier for everyone to use shellcheck by devising a good set of options and avoiding being flooded by warnings when we can avoid them.
There are a few warnings left. Most are easy to fix but can wait a bit. They're not issues but we will benefit if everyone runs shellcheck and spots issues earlier on.
This is a draft MR which depends on my branch from yesterday to fix processing after virtual packages.