update explorer for __package_apt and install only if not already installed (same for deinstall)

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-03 09:12:55 +01:00
parent 45d267158f
commit 442a175755
3 changed files with 9 additions and 4 deletions

View file

@ -28,5 +28,6 @@ case "$__target_host" in
# Real machines
ikq*)
__package_apt zsh --state installed
__package_apt apache2 --state deinstalled
;;
esac

View file

@ -27,4 +27,5 @@ else
name="$__object_id"
fi
dpkg -l "$name" 2>/dev/null | awk '{ print $1 }'
# Except dpkg failing, if package is not known / installed
dpkg -s "$name" 2>/dev/null || exit 0

View file

@ -29,15 +29,18 @@ fi
state="$(cat "$__object/parameter/state")"
is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status")"
case "$state" in
installed)
pkg_status="$(cat "$__object/explorer/pkg_status")"
if [ "$pkg_status" != "ii" ]; then
# Install only if non-existent
if [ -z "$is_installed" ]; then
echo apt-get --quiet --yes install \"$name\"
fi
;;
deinstalled)
if [ "$pkg_status" != "un" ]; then
# Remove only if existent
if [ -n "$is_installed" ]; then
echo apt-get --quiet --yes remove \"$name\"
fi
;;