mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-22 07:10:19 +00:00
Shellcheck files and source checker
This commit is contained in:
parent
2c55b92453
commit
e2037819ac
1 changed files with 7 additions and 4 deletions
|
@ -141,11 +141,10 @@ version_check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
files_check() {
|
files_check() {
|
||||||
#Check non-zero length existence of ${1}
|
|
||||||
header_write "Detecting existence of ${1}:"
|
header_write "Detecting existence of ${1}:"
|
||||||
local search_file="${1}"
|
local search_file="${1}"
|
||||||
if [[ -s ${search_file} ]]; then
|
if [[ -s ${search_file} ]]; then
|
||||||
echo "::: File exists"
|
log_echo "File exists"
|
||||||
file_parse "${search_file}"
|
file_parse "${search_file}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
@ -156,9 +155,13 @@ files_check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
source_file() {
|
source_file() {
|
||||||
local file_found=$(files_check "${1}") \
|
local file_found
|
||||||
&& (source "${1}" &> /dev/null && echo "${file_found} and was successfully sourced") \
|
|
||||||
|
file_found=$(files_check "${1}")
|
||||||
|
if [[ "${file_found}" ]]; then
|
||||||
|
(source "${1}" &> /dev/null && echo "${file_found} and was successfully sourced") \
|
||||||
|| log_echo -l "${file_found} and could not be sourced"
|
|| log_echo -l "${file_found} and could not be sourced"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
distro_check() {
|
distro_check() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue