Browse Source

impove dep checking logic for unsupported distros

pull/3568/head
Daniel Gibbs 4 years ago
parent
commit
69268ee673
  1. 22
      lgsm/functions/check_deps.sh
  2. 1
      lgsm/functions/core_dl.sh

22
lgsm/functions/check_deps.sh

@ -306,24 +306,30 @@ fn_deps_detector(){
info_distro.sh
if [ ! -f "${datadir}/${distroid}-${distroversion}.csv" ]; then
if [ ! -f "${tmpdir}/dependency-no-check.tmp" ]&&[ ! -f "${datadir}/${distroid}-${distroversion}.csv" ]; then
# Check that the disto dependency csv file exists and if it does download it.
fn_check_file_github "lgsm/data" "${distroid}-${distroversion}.csv"
fi
# Select Distro
if [ "${checkflag}" == "0" ]; then
# If the file successfully downloaded run the dependency check.
if [ -n "${checkflag}" ]||[ "${checkflag}" == "0" ]; then
dependencyinstall=$(awk -F, '$1=="install" {$1=""; print $0}' "${datadir}/${distroid}-${distroversion}.csv")
dependencyall=$(awk -F, '$1=="all" {$1=""; print $0}' "${datadir}/${distroid}-${distroversion}.csv")
dependencyshortname=$(awk -v shortname="$shortname" -F, '$1==shortname {$1=""; print $0}' "${datadir}/${distroid}-${distroversion}.csv")
# dev code
echo "${dependencyinstall}${dependencyall}${dependencyshortname}"
# Generate array of missing deps.
array_deps_missing=()
array_deps_required=(${dependencyall} ${dependencyshortname})
fn_check_loop
else
# Warn the user that dependency checking is unavailable for their distro.
elif [ -n "${checkflag}" ]||[ "${checkflag}" != "0" ]; then
fn_print_warning_nl "LinuxGSM dependency checking currently unavailable for ${distroname}."
# Prevent future dependency checking if unavailable for the distro.
echo "${version}" > "${tmpdir}/dependency-no-check.tmp"
elif [ -f "${tmpdir}/dependency-no-check.tmp" ]; then
# Allow LinuxGSM to try a dependency check if LinuxGSM has been recently updated.
nocheckversion=$(cat "${tmpdir}/dependency-no-check.tmp" )
if [ "${version}" != "${nocheckversion}" ]; then
rm -f "${tmpdir:?}/dependency-no-check.tmp"
fi
fi

1
lgsm/functions/core_dl.sh

@ -252,6 +252,7 @@ fn_fetch_trap(){
core_exit.sh
}
# Will check a file exists and download it. Will not exit if fails to download.
fn_check_file(){
remote_fileurl="${1}"
remote_fileurl_backup="${2}"

Loading…
Cancel
Save