Fix commands for apt package manager.

Force yes when performing apt-get install. Even though we provide
noninteractive, apt still prompts in some situations.

Grep dpkg-query when checking if package is installed. In some cases,
dpkg -l will exit 0 if the package exists, but is not in an installed
state.
This commit is contained in:
Adam Daniels 2013-02-23 11:20:14 -05:00
parent 3f93010eaa
commit 5c11895dd7

View File

@ -163,7 +163,7 @@ package () {
fi fi
if [ "$PACKAGE_MANAGER" == 'apt-get' ]; then if [ "$PACKAGE_MANAGER" == 'apt-get' ]; then
DEBIAN_FRONTEND=noninteractive apt-get install -y $1 DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes $1
elif [ "$PACKAGE_MANAGER" == 'yum' ]; then elif [ "$PACKAGE_MANAGER" == 'yum' ]; then
yum install -y $1 yum install -y $1
elif [ "$PACKAGE_MANAGER" == 'brew' ]; then elif [ "$PACKAGE_MANAGER" == 'brew' ]; then
@ -193,7 +193,7 @@ test_package_installed () {
fi fi
if [ "$PACKAGE_MANAGER" == 'apt-get' ]; then if [ "$PACKAGE_MANAGER" == 'apt-get' ]; then
dpkg -l $1 dpkg-query -l "$1" | grep -q ^.i
return $? return $?
fi fi