Add "list" targets, that prints pkg installed + short_desc.

--HG--
extra : convert_revision : dbce561949960303fea46d66b9920eff7e2dd244
This commit is contained in:
Juan RP 2008-09-30 00:45:25 +02:00
parent 71c3216f7a
commit 37210e2d84
2 changed files with 28 additions and 1 deletions

6
README
View file

@ -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.
------------------------------------------------------------------------------

View file

@ -75,6 +75,7 @@ $progname: [-bCef] [-c <config_file>] <target> <tmpl>
Targets
info Show information about <tmpl>.
install Build and install package from <tmpl>.
list Lists and prints short description about installed packages.
remove Remove package completely (unstow and remove from destdir)
stow Create symlinks from <tmpl> in master directory.
unstow Remove symlinks from <tmpl> 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"
;;