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 # Real machines
ikq*) ikq*)
__package_apt zsh --state installed __package_apt zsh --state installed
__package_apt apache2 --state deinstalled
;; ;;
esac esac

View File

@ -27,4 +27,5 @@ else
name="$__object_id" name="$__object_id"
fi 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")" state="$(cat "$__object/parameter/state")"
is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status")"
case "$state" in case "$state" in
installed) installed)
pkg_status="$(cat "$__object/explorer/pkg_status")" # Install only if non-existent
if [ "$pkg_status" != "ii" ]; then if [ -z "$is_installed" ]; then
echo apt-get --quiet --yes install \"$name\" echo apt-get --quiet --yes install \"$name\"
fi fi
;; ;;
deinstalled) deinstalled)
if [ "$pkg_status" != "un" ]; then # Remove only if existent
if [ -n "$is_installed" ]; then
echo apt-get --quiet --yes remove \"$name\" echo apt-get --quiet --yes remove \"$name\"
fi fi
;; ;;