From 6a5e9b27c8d6d137d50886559f9cd06d049ca05a Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 13 Oct 2008 05:50:40 +0200 Subject: [PATCH] pkgfs.sh: add a new target 'listfiles'. This target lists the files (sorted) installed by a package. Please note that package must be available in destdir and that you must specify pkgname-version as argument. --HG-- extra : convert_revision : 0e9010a41e4cb658403bc21226bf985fe21b8907 --- pkgfs.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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 ;;