diff --git a/pkgfs.sh b/pkgfs.sh index d83b486b121..01d5cf0e8c6 100755 --- a/pkgfs.sh +++ b/pkgfs.sh @@ -100,6 +100,7 @@ Targets: install Same than \`install-destdirŽ but also stows package. list Lists all currently \`stownedŽ packages. remove Remove package completely (unstow + remove data) + listfiles Lists files installed from . stow Create links in master directory. unstow Remove links in master directory. @@ -1180,6 +1181,28 @@ list_pkgs() done } +# +# Lists files installed by a package. +# +list_pkg_files() +{ + local pkg="$1" + + if [ -z $pkg ]; then + echo "*** ERROR: unexistent package, aborting ***" + exit 1 + fi + + if [ ! -d "$PKGFS_DESTDIR/$pkg" ]; then + echo "*** ERROR: cannot find \`$pkg' in $PKGFS_DESTDIR ***" + exit 1 + fi + + for f in $($find_cmd $PKGFS_DESTDIR/$pkg -type f -print | sort -u); do + echo "${f##$PKGFS_DESTDIR/$pkg/}" + done +} + # # Removes a currently installed package (unstow + removed from destdir). # @@ -1414,6 +1437,9 @@ install) list) list_pkgs ;; +listfiles) + list_pkg_files $2 + ;; remove) remove_pkg $2 ;;