diff --git a/README b/README index 0091a188fa..d76954b67f 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 f7f0c7269a..80c80f6b61 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" ;;