fix various shellcheck violations

This commit is contained in:
Jérémy Lecour 2022-04-25 10:08:14 +02:00 committed by Jérémy Lecour
parent e1bafc2a0a
commit f5b19ad656
2 changed files with 9 additions and 5 deletions

View file

@ -7,6 +7,8 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
### Changed ### Changed
* fix various shellcheck violations
### Deprecated ### Deprecated
### Removed ### Removed

View file

@ -596,7 +596,7 @@ check_evobackup() {
} }
# Vérification de l'exclusion des montages (NFS) dans les sauvegardes # Vérification de l'exclusion des montages (NFS) dans les sauvegardes
check_evobackup_exclude_mount() { check_evobackup_exclude_mount() {
excludes_file=$(mktemp --tmpdir=${TMPDIR:-/tmp} "evocheck.evobackup_exclude_mount.XXXXX") excludes_file=$(mktemp --tmpdir="${TMPDIR:-/tmp}" "evocheck.evobackup_exclude_mount.XXXXX")
files_to_cleanup="${files_to_cleanup} ${excludes_file}" files_to_cleanup="${files_to_cleanup} ${excludes_file}"
# shellcheck disable=SC2044 # shellcheck disable=SC2044
@ -1074,7 +1074,7 @@ check_duplicate_fs_label() {
# Do it only if thereis blkid binary # Do it only if thereis blkid binary
BLKID_BIN=$(command -v blkid) BLKID_BIN=$(command -v blkid)
if [ -n "$BLKID_BIN" ]; then if [ -n "$BLKID_BIN" ]; then
tmpFile=$(mktemp --tmpdir=${TMPDIR:-/tmp} "evocheck.duplicate_fs_label.XXXXX") tmpFile=$(mktemp --tmpdir="${TMPDIR:-/tmp}" "evocheck.duplicate_fs_label.XXXXX")
files_to_cleanup="${files_to_cleanup} ${tmpFile}" files_to_cleanup="${files_to_cleanup} ${tmpFile}"
parts=$($BLKID_BIN -c /dev/null | grep -ve raid_member -e EFI_SYSPART | grep -Eo ' LABEL=".*"' | cut -d'"' -f2) parts=$($BLKID_BIN -c /dev/null | grep -ve raid_member -e EFI_SYSPART | grep -Eo ' LABEL=".*"' | cut -d'"' -f2)
@ -1473,7 +1473,7 @@ add_to_path() {
echo "$PATH" | grep -qF "${new_path}" || export PATH="${PATH}:${new_path}" echo "$PATH" | grep -qF "${new_path}" || export PATH="${PATH}:${new_path}"
} }
check_versions() { check_versions() {
versions_file=$(mktemp --tmpdir=${TMPDIR:-/tmp} "evocheck.versions.XXXXX") versions_file=$(mktemp --tmpdir="${TMPDIR:-/tmp}" "evocheck.versions.XXXXX")
files_to_cleanup="${files_to_cleanup} ${versions_file}" files_to_cleanup="${files_to_cleanup} ${versions_file}"
download_versions "${versions_file}" download_versions "${versions_file}"
@ -1501,7 +1501,7 @@ main() {
# Detect operating system name, version and release # Detect operating system name, version and release
detect_os detect_os
main_output_file=$(mktemp --tmpdir=${TMPDIR:-/tmp} "evocheck.main.XXXXX") main_output_file=$(mktemp --tmpdir="${TMPDIR:-/tmp}" "evocheck.main.XXXXX")
files_to_cleanup="${files_to_cleanup} ${main_output_file}" files_to_cleanup="${files_to_cleanup} ${main_output_file}"
#----------------------------------------------------------- #-----------------------------------------------------------
@ -1733,7 +1733,9 @@ main() {
fi fi
if [ -f "${main_output_file}" ]; then if [ -f "${main_output_file}" ]; then
if [ $(cat "${main_output_file}" | wc -l) -gt 0 ]; then lines_found=$(wc -l < "${main_output_file}")
# shellcheck disable=SC2086
if [ ${lines_found} -gt 0 ]; then
cat "${main_output_file}" 2>&1 cat "${main_output_file}" 2>&1
fi fi