mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Tabs and debug.sh
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
57e65dd5c0
commit
623ce1fe18
2 changed files with 34 additions and 37 deletions
|
@ -396,28 +396,25 @@ check_critical_program_versions() {
|
||||||
os_check() {
|
os_check() {
|
||||||
# This function gets a list of supported OS versions from a TXT record at versions.pi-hole.net
|
# This function gets a list of supported OS versions from a TXT record at versions.pi-hole.net
|
||||||
# and determines whether or not the script is running on one of those systems
|
# and determines whether or not the script is running on one of those systems
|
||||||
local remote_os_domain valid_os valid_version detected_os_pretty detected_os detected_version
|
local remote_os_domain valid_os valid_version detected_os detected_version
|
||||||
remote_os_domain="versions.pi-hole.net"
|
remote_os_domain="versions.pi-hole.net"
|
||||||
valid_os=false
|
|
||||||
valid_version=false
|
|
||||||
|
|
||||||
detected_os_pretty=$(cat /etc/*release | grep PRETTY_NAME | cut -d '=' -f2- | tr -d '"')
|
detected_os=$(grep "\bID\b" /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
||||||
detected_os="${detected_os_pretty%% *}"
|
detected_version=$(grep VERSION_ID /etc/os-release | cut -d '=' -f2 | tr -d '"')
|
||||||
detected_version=$(cat /etc/*release | grep VERSION_ID | cut -d '=' -f2- | tr -d '"')
|
|
||||||
|
|
||||||
IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} | tr -d '"')
|
IFS=" " read -r -a supportedOS < <(dig +short -t txt ${remote_os_domain} @ns1.pi-hole.net | tr -d '"')
|
||||||
|
|
||||||
for i in "${supportedOS[@]}"
|
for distro_and_versions in "${supportedOS[@]}"
|
||||||
do
|
do
|
||||||
os_part=$(echo "$i" | cut -d '=' -f1)
|
distro_part="${distro_and_versions%%=*}"
|
||||||
versions_part=$(echo "$i" | cut -d '=' -f2-)
|
versions_part="${distro_and_versions##*=}"
|
||||||
|
|
||||||
if [[ "${detected_os}" =~ ${os_part} ]]; then
|
if [[ "${detected_os^^}" =~ ${distro_part^^} ]]; then
|
||||||
valid_os=true
|
valid_os=true
|
||||||
IFS="," read -r -a supportedVer <<<"${versions_part}"
|
IFS="," read -r -a supportedVer <<<"${versions_part}"
|
||||||
for x in "${supportedVer[@]}"
|
for version in "${supportedVer[@]}"
|
||||||
do
|
do
|
||||||
if [[ "${detected_version}" =~ $x ]];then
|
if [[ "${detected_version}" =~ $version ]]; then
|
||||||
valid_version=true
|
valid_version=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue