finish __package_pacman

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-02 21:23:43 +01:00
parent ddbcaf5152
commit 34fa8260f5
3 changed files with 11 additions and 8 deletions

View file

@ -27,4 +27,4 @@ else
name="$__object_id"
fi
dpkg -l "$name" 2>/dev/null | awk '{ print $1 }'
pacman -Q "$name" 2>/dev/null | awk '{ print $2 }'

View file

@ -18,9 +18,11 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Manage packages on Debian and co.
# Manage packages with Pacman (mostly archlinux)
#
pacopts="--noconfirm --noprogressbar"
if [ -f "$__object/parameter/name" ]; then
name="$__object/parameter/name"
else
@ -31,14 +33,16 @@ state="$(cat "$__object/parameter/state")"
case "$state" in
installed)
pkg_status="$(cat "$__object/explorer/pkg_status")"
if [ "$pkg_status" != "ii" ]; then
echo apt-get --quiet --yes install \"$name\"
pkg_version="$(cat "$__object/explorer/pkg_version")"
# Empty? Not installed.
if [ -z "$pkg_version" ]; then
echo pacman "$pacopts" -S \"$name\"
fi
;;
deinstalled)
if [ "$pkg_status" != "un" ]; then
echo apt-get --quiet --yes remove \"$name\"
if [ "$pkg_version" ]; then
echo pacman "$pacopts" -R \"$name\"
fi
;;
esac

View file

@ -1,2 +1 @@
name
version