Browse Source

Tools: fix install-prereqs-ubuntu

make a function to return 1 if a dpkg find that a package is installed, O otherwise
zr-v5.1
Pierre Kancir 5 years ago committed by Andrew Tridgell
parent
commit
f199ca54bd
  1. 8
      Tools/environment_install/install-prereqs-ubuntu.sh

8
Tools/environment_install/install-prereqs-ubuntu.sh

@ -40,8 +40,12 @@ fi @@ -40,8 +40,12 @@ fi
# update apt package list
$APT_GET update
function package_is_installed() {
return $(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")
}
# Install lsb-release as it is needed to check Ubuntu version
if ! dpkg-query -l "lsb-release"; then
if package_is_installed "lsb-release" -ne 1; then
echo "$sep"
echo "Installing lsb-release"
echo "$sep"
@ -150,7 +154,7 @@ echo "Done!" @@ -150,7 +154,7 @@ echo "Done!"
echo "$sep"
echo "Removing modemmanager package that could conflict with firmware uploading"
echo "$sep"
if dpkg-query -l "modemmanager"; then
if package_is_installed "modemmanager" -ne 1; then
$APT_GET remove modemmanager
fi
echo "Done!"

Loading…
Cancel
Save