From 37210e2d843858e79b86fa0e430451af0fd6c387 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 30 Sep 2008 00:45:25 +0200 Subject: [PATCH] Add "list" targets, that prints pkg installed + short_desc. --HG-- extra : convert_revision : dbce561949960303fea46d66b9920eff7e2dd244 --- README | 6 +++++- pkgfs.sh | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README b/README index 0091a188fad..d76954b67fc 100644 --- a/README +++ b/README @@ -57,7 +57,11 @@ You can also print some stuff about any template, e.g: $ pkgfs.sh info templates/glib-2.18.1.tmpl -That's all for now. I hope you find it useful as I do. +To list installed (stowned) packages, use this: + + $ pkgfs.sh -c pkgfs.conf list + +That's all for now folks. I hope you find it useful, as I do. ------------------------------------------------------------------------------ diff --git a/pkgfs.sh b/pkgfs.sh index f7f0c7269ab..80c80f6b61e 100755 --- a/pkgfs.sh +++ b/pkgfs.sh @@ -75,6 +75,7 @@ $progname: [-bCef] [-c ] Targets info Show information about . install Build and install package from . + list Lists and prints short description about installed packages. remove Remove package completely (unstow and remove from destdir) stow Create symlinks from in master directory. unstow Remove symlinks from in master directory. @@ -737,6 +738,25 @@ install_tmpl() stow_tmpl ${pkgname} } +list_tmpls() +{ + local reg_pkgdb="$PKGFS_DESTDIR/$PKGFS_REGISTERED_PKG_DB" + + if [ ! -r "$reg_pkgdb" ]; then + echo "*** ERROR: couldn't find the $reg_pkgdb, aborting ***" + exit 1 + fi + + for i in $($db_cmd btree $reg_pkgdb); do + # Skip stowned value + [ "$i" = "stowned" ] && continue + # Run file to get short_desc and print something useful + run_file ${PKGFS_TEMPLATESDIR}/$i.tmpl + echo "$i $short_desc" + reset_tmpl_vars + done +} + remove_tmpl() { local pkg="$1" @@ -808,6 +828,9 @@ info) install) install_tmpl "$2" ;; +list) + list_tmpls + ;; remove) remove_tmpl "$2" ;;