Merge pull request #2318 from christophgysin/checkdeps

refactoring checkdeps
This commit is contained in:
MilhouseVH 2018-02-25 14:15:09 +00:00 committed by GitHub
commit 1c7b4786a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,15 +27,19 @@ get_deps() {
for i in "${!deps[@]}"; do
dep=${deps[$i]}
dep_pkg=${deps_pkg[$i]}
[ -z "$(which $dep 2>/dev/null)" ] && need+=($dep) && need_pkg+=("$dep_pkg")
if ! command -v "$dep" >/dev/null; then
need+=($dep)
need_pkg+=("$dep_pkg")
fi
done
for i in "${!files[@]}"; do
file=${files[$i]}
file_pkg=${files_pkg[$i]}
installed=N
[ $installed == N -a -f "$file" ] && installed=Y
[ $installed == N ] && need+=($file) && need_pkg+=("$file_pkg")
if [ ! -f "$file" ]; then
need+=($file)
need_pkg+=("$file_pkg")
fi
done
for i in "${!perl_mod[@]}"; do
@ -59,13 +63,15 @@ get_yes_no()
}
if [ -f /etc/lsb-release ]; then
DISTRO=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr A-Z a-z)
DISTRO=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2)
fi
if [ -f /etc/os-release ]; then
DISTRO=$(grep ^ID= /etc/os-release | cut -d "=" -f 2 | tr A-Z a-z)
DISTRO=$(grep ^ID= /etc/os-release | cut -d "=" -f 2)
fi
DISTRO=${DISTRO,,}
deps=(wget bash bc gcc sed patch lsdiff tar bzip2 gzip perl gawk gperf zip unzip diff lzop)
deps_pkg=(wget bash bc gcc sed patch patchutils tar bzip2 gzip perl gawk gperf zip unzip diffutils lzop)
@ -78,8 +84,14 @@ case "$DISTRO" in
fedora|centos|rhel)
deps+=(g++ mkfontscale mkfontdir bdftopcf xsltproc java python)
deps_pkg+=(gcc-c++ xorg-x11-font-utils xorg-x11-font-utils xorg-x11-font-utils libxslt java-1.7.0-openjdk python2)
[[ ! $(rpm -qa glibc-static) ]] && deps+=(glibc-static) && deps_pkg+=(glibc-static)
[[ ! $(rpm -qa libstdc++-static) ]] && deps+=(libstdc++-static) && deps_pkg+=(libstdc++-static)
if [[ ! $(rpm -qa glibc-static) ]]; then
deps+=(glibc-static)
deps_pkg+=(glibc-static)
fi
if [[ ! $(rpm -qa libstdc++-static) ]]; then
deps+=(libstdc++-static)
deps_pkg+=(libstdc++-static)
fi
files_pkg=(glibc-headers ncurses-devel)
perl_pkg=(perl-JSON perl-XML-parser)
;;
@ -97,7 +109,10 @@ case "$DISTRO" in
opensuse)
deps+=( g++ mkfontscale mkfontdir bdftopcf xsltproc java python)
deps_pkg+=(gcc-c++ mkfontscale mkfontdir bdftopcf libxslt-tools java-1_8_0-openjdk python)
[[ ! $(rpm -qa glibc-devel-static) ]] && deps+=(glibc-devel-static) && deps_pkg+=(glibc-devel-static)
if [[ ! $(rpm -qa glibc-devel-static) ]]; then
deps+=(glibc-devel-static)
deps_pkg+=(glibc-devel-static)
fi
perl_pkg=(perl-JSON perl-XML-Parser)
;;
*)