mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-21 03:40:39 +00:00
changes to jq install logic
Will fall back to static binary if pkgmanager install fails or no distribution matches.
This commit is contained in:
+5
-3
@@ -195,7 +195,7 @@ distro_checker() {
|
|||||||
elif [[ -f /etc/redhat-release ]] ; then PkgInstaller="dnf install"
|
elif [[ -f /etc/redhat-release ]] ; then PkgInstaller="dnf install"
|
||||||
elif [[ -f /etc/SuSE-release ]] ; then PkgInstaller="zypper install"
|
elif [[ -f /etc/SuSE-release ]] ; then PkgInstaller="zypper install"
|
||||||
elif [[ -f /etc/debian_version ]] ; then PkgInstaller="apt-get install"
|
elif [[ -f /etc/debian_version ]] ; then PkgInstaller="apt-get install"
|
||||||
else PkgInstaller="ERROR"
|
else PkgInstaller="ERROR" ; printf "%s\n" "No distribution could be determined, falling back to static binary."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,8 +209,10 @@ else
|
|||||||
if [[ "$GetJq" =~ [yYsS] ]] ; then
|
if [[ "$GetJq" =~ [yYsS] ]] ; then
|
||||||
[[ "$GetJq" =~ [yY] ]] && distro_checker
|
[[ "$GetJq" =~ [yY] ]] && distro_checker
|
||||||
if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then
|
if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then
|
||||||
(sudo $PkgInstaller jq) # is this the best way? Rewrite so that if it fails it goes to static
|
(sudo $PkgInstaller jq) ; PkgExitcode="$?"
|
||||||
else
|
[[ "$PkgExitcode" != 0 ]] && printf "%s\n" "Packagemanager install failed, falling back to static binary."
|
||||||
|
fi
|
||||||
|
if [[ "$GetJq" =~ [nN] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then
|
||||||
binary_downloader "jq" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP"
|
binary_downloader "jq" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP"
|
||||||
[[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq"
|
[[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user