Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/checkdeps: fix library test #1799

Merged
merged 2 commits into from Jul 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 31 additions & 16 deletions scripts/checkdeps
Expand Up @@ -20,6 +20,20 @@

. config/options $1

get_yes_no()
{
local ans
read -p "Would you like to install the needed tools ? (y/n) " ans
[ "${ans,,}" == "y" ] && return 0
[ "${ans,,}" == "yes" ] && return 0
return 1
}

test_libjson-perl()
{
perl -MJSON -e 'exit(0);' 2>/dev/null
}

if [ -f /etc/lsb-release ]; then
DISTRO=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr A-Z a-z)
fi
Expand Down Expand Up @@ -62,7 +76,7 @@ case "$DISTRO" in
;;
esac

if ! perl -MJSON -e 'exit(0);' 2>/dev/null; then
if ! test_libjson-perl; then
files="$files perl/JSON.pm"
files_pkg="$files_pkg libjson-perl"
fi
Expand Down Expand Up @@ -95,7 +109,11 @@ done

i=0
while file=`getarg $i $files` && [ -n "$file" ]; do
[ ! -f $file ] && need="$need $file" && need_pkg="$need_pkg `getarg $i $files_pkg`"
installed=N
file_pkg=`getarg $i $files_pkg`
[ "$(type -t "test_$file_pkg")" == "function" ] && test_$file_pkg && installed=Y
[ $installed == N -a -f $file ] && installed=Y
[ $installed == N ] && need="$need $file" && need_pkg="$need_pkg $file_pkg"
i=$(($i+1))
done

Expand All @@ -106,29 +124,23 @@ if [ -n "$need" ]; then

case "$DISTRO" in
ubuntu|debian|\"elementary\")
read -p "would you like to install the needed tools ? (y/n) " ans
[ "$ans" = "y" ] && sudo apt-get install $need_pkg
get_yes_no && sudo apt-get install $need_pkg
;;
fedora|centos|rhel)
if [ `which dnf` ]; then YUM=dnf; else YUM=yum; fi
read -p "would you like to install the needed tools ? (y/n) " ans
[ "$ans" = "y" ] && sudo $YUM install $need_pkg
get_yes_no && sudo $YUM install $need_pkg
;;
gentoo)
read -p "would you like to install the needed tools ? (y/n) " ans
[ "$ans" = "y" ] && sudo emerge --ask --deep $need_pkg
get_yes_no && sudo emerge --ask --deep $need_pkg
;;
mageia)
read -p "would you like to install the needed tools ? (y/n) " ans
[ "$ans" = "y" ] && sudo urpmi $need_pkg
get_yes_no && sudo urpmi $need_pkg
;;
arch)
read -p "would you like to install the needed tools ? (y/n) " ans
[ "$ans" = "y" ] && sudo pacman -Sy $need_pkg
get_yes_no && sudo pacman -Sy $need_pkg
;;
opensuse)
read -p "would you like to install the needed tools ? (y/n) " ans
[ "$ans" = "y" ] && sudo zypper install -y --no-recommends $need_pkg
get_yes_no && sudo zypper install -y --no-recommends $need_pkg
;;
*)
echo "**** unsupported distro $DISTRO ****"
Expand All @@ -137,7 +149,6 @@ if [ -n "$need" ]; then
esac
fi


need=""
need_pkg=""

Expand All @@ -149,7 +160,11 @@ done

i=0
while file=`getarg $i $files` && [ -n "$file" ]; do
[ ! -f $file ] && need="$need $file" && need_pkg="$need_pkg `getarg $i $files_pkg`"
installed=N
file_pkg=`getarg $i $files_pkg`
[ "$(type -t "test_$file_pkg")" == "function" ] && test_$file_pkg && installed=Y
[ $installed == N -a -f $file ] && installed=Y
[ $installed == N ] && need="$need $file" && need_pkg="$need_pkg $file_pkg"
i=$(($i+1))
done

Expand Down
1 change: 1 addition & 0 deletions scripts/create_addon
Expand Up @@ -42,6 +42,7 @@ if [ -n "$PKG_ADDON_PROJECTS" -a ! "$PKG_ADDON_PROJECTS" = "any" ]; then
fi
fi

$SCRIPTS/checkdeps

pack_addon() {
IFS=" "
Expand Down