You are not logged in.

#1 2008-02-04 15:52:49

ibendiben
Member
Registered: 2007-10-10
Posts: 519

Browsing through installed packages, using install-roots by pacman-Ql

Would it be possible (easy) to have a gobolinux-way of displaying installroots, of all installed packages.
What I mean is could I make some folder called say, "usr/progs" and let it display a list of folders for all installed packages and let those folders contain the symbolic links to the install roots of a package (those given by pacman -Ql package), so I can easily browse through the (config/binaries/script) files that were installed by a given package? I think this could be real helpful sometimes: when investigating packages, compiling from source (ie creating pkgbuilds), searching for removal left-overs....
Any thought on this are welcome...

Last edited by ibendiben (2008-02-04 15:56:16)

Offline

#2 2008-02-06 10:03:47

ibendiben
Member
Registered: 2007-10-10
Posts: 519

Re: Browsing through installed packages, using install-roots by pacman-Ql

ay?

Offline

#3 2008-02-06 11:22:01

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: Browsing through installed packages, using install-roots by pacman-Ql

I actually thought your bump was someone else really confused with you post big_smile

I follow what you are meaning having use gobo linux before.  In short, you could probably write a script to do this.  Other than than, if you download the package you want to browse (or get it from your pacman cache) and just extract it in a temporary directory, that should be close enough.

Offline

#4 2008-02-06 12:23:07

ibendiben
Member
Registered: 2007-10-10
Posts: 519

Re: Browsing through installed packages, using install-roots by pacman-Ql

lol I find it hard to describe what I mean sometimes!

Could you tell me more about the possible script you're talking about.
Extracting the package, comes close enough when trying to get an idea what's going to get installed, but you can't actually edit files, or delete or whatever.
snappie?

Offline

#5 2008-02-06 13:08:31

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: Browsing through installed packages, using install-roots by pacman-Ql

I suppose you could write a bash script that gets the output from "pacman -Ql <pkg>" and creates the directory structure and symbolic links...  It should not be too hard (I think - I have been wrong about the difficulty of ideas like this many many times before!)

Offline

#6 2008-02-06 13:19:12

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: Browsing through installed packages, using install-roots by pacman-Ql

Ok here is an oultine bash script

#parses pacman output - notice the fancy use of sed for a grep smile
dir=$(pacman -Ql ${PKG} | cut -f2 -d' ' | sed -n '/\/$/p')
files=$(pacman -Ql ${PKG} | cut -f2 -d' ' | sed -n '/\/$/!p')

#creates directory structure
for i in dir
  mkdir -p ${i}

# creates symlinks to files
# this probably does not work...
for i in files
  ln -s ${i} ./${i}

Last edited by Allan (2008-02-06 13:28:21)

Offline

#7 2008-02-06 16:01:10

ibendiben
Member
Registered: 2007-10-10
Posts: 519

Re: Browsing through installed packages, using install-roots by pacman-Ql

Well here is my script, works a bit better big_smile (thanks for starting me up)

#!/bin/bash
#set pkg to desired pkg you want to investigate
pkg="pacman"
#get install-roots from pacman
pacman -Ql $pkg | \
#cutout first column, containing name of package, we only want the (complete) filepaths
cut -d' ' -f2 | grep -v '/$' | \
#per filepath, create the necesary dirs
while read -r line
do dirs=`echo $line | sed 's#^\(.*\)/[^/]*$#\1#'`
mkdir -p /tmp/progs/$pkg$dirs
#finally create a symlink
ln -s $line /tmp/progs/$pkg$line
done

here's a try-out for the command line. Just copy paste, and you'll be able to see an example of 'pacman' being layed out in /tmp/progs/pacman...

pkg="pacman"; pacman -Ql $pkg | cut -d' ' -f2 | grep -v '/$' | while read -r line; do dirs=`echo $line | sed 's#^\(.*\)/[^/]*$#\1#'`; mkdir -p /tmp/progs/$pkg$dirs; ln -s $line /tmp/progs/$pkg$line; done

I am going to think thing over a little more and decide how I actually want things displayed, but I'm quite happy how this turned out to be very easy doable... hmm

Offline

Board footer

Powered by FluxBB