Silence shellcheck warnings (#255)

* Made more specific shellcheck disables
* Fixed variable quoting (SC2086,SC2064)
* Use `$*` expansion instead of `$@` when not using arrays (SC2124)
* Use cleaner `$()` syntax instead of back quotes (SC2006)
* Improved comparator (SC2166)
* Minor improvements in coding style

Tested clean output using: `find -name "*.sh" | xargs -n1 shellcheck -x`.
This commit is contained in:
Hugo Hromic
2019-02-18 12:54:15 +00:00
committed by XECDesign
parent 7068086c94
commit 564f8ef1b8
4 changed files with 21 additions and 15 deletions

View File

@@ -3,6 +3,7 @@
set -ex
# shellcheck disable=SC2154
if [ -z "$part1" ] || [ -z "$part2" ]; then
printf "Error: missing environment variable part1 or part2\n" 1>&2
exit 1
@@ -17,7 +18,8 @@ sed /tmp/1/cmdline.txt -i -e "s|root=[^ ]*|root=${part2}|"
sed /tmp/2/etc/fstab -i -e "s|^[^#].* / |${part2} / |"
sed /tmp/2/etc/fstab -i -e "s|^[^#].* /boot |${part1} /boot |"
if [ -z $restore ]; then
# shellcheck disable=SC2154
if [ -z "$restore" ]; then
if [ -f /mnt/ssh ]; then
cp /mnt/ssh /tmp/1/
fi