mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
Tools: fix install-prereqs-ubuntu
make a function to return 1 if a dpkg find that a package is installed, O otherwise
This commit is contained in:
parent
a8c8f192b4
commit
f199ca54bd
@ -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!"
|
||||
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…
Reference in New Issue
Block a user