Merge pull request #688 from thriqon/improve-package-apt
Improve __package_apt
This commit is contained in:
commit
690b63081f
2 changed files with 5 additions and 3 deletions
|
@ -30,7 +30,7 @@ fi
|
|||
# Except dpkg failing, if package is not known / installed
|
||||
packages="$(apt-cache showpkg "$name" | sed -e "1,/Reverse Provides:/d" | cut -d ' ' -f 1) $name"
|
||||
for p in $packages; do
|
||||
if [ -n "$(dpkg -s "$p" 2>/dev/null | grep "^Status: install ok installed$")" ]; then
|
||||
if dpkg -s "$p" 2>/dev/null | grep --quiet "^Status: install ok installed$" ; then
|
||||
version=$(dpkg -s "$p" 2>/dev/null | grep "^Version:" | cut -d ' ' -f 2)
|
||||
echo "present $p $version"
|
||||
exit 0
|
||||
|
|
|
@ -77,10 +77,12 @@ case "$state_should" in
|
|||
if [ -n "$version" ]; then
|
||||
name="${name}=${version}"
|
||||
fi
|
||||
echo $aptget install $target_release \"$name\"
|
||||
echo "$aptget install $target_release \"$name\""
|
||||
echo "installed" >> "$__messages_out"
|
||||
;;
|
||||
absent)
|
||||
echo $aptget remove $purgeparam \"$name\"
|
||||
echo "$aptget remove $purgeparam \"$name\""
|
||||
echo "removed" >> "$__messages_out"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown state: $state_should" >&2
|
||||
|
|
Loading…
Reference in a new issue