You are not logged in.
Hi,
is it possible to check installed packages for integrity - i.e. missing/changed files, etc. I looked at pacman man, but found nothing ...
Last edited by drakosha (2007-06-18 17:53:24)
Offline
#!/bin/bash
PACKAGE = $1
for file in $( pacman -Ql ${PACKAGE} | cut -d' ' -f2 ); do
if [ "${test:$(( ${#test} - 1 ))" == "/" ]; then
if [ ! -d ${file} ]; then
echo "Directory missing: ${file}"
fi
else
if [ ! -f ${file} ]; then
echo "File missing: ${file}"
fi
fi
done
might work to check for missing files, but i've got no way to test this as i'm not at home... Maybe someone else can spot some problems?
it should work like this:
# paccheck [packagename]
Untested...
[edit]: pacman -Ql instead of -QL
[edit2]: take 2nd field of output from pacman -Ql.
Last edited by klixon (2007-06-18 10:55:13)
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
Have you coded these lines right now?
celestary
Intel Core2Duo E6300 @ 1.86 GHz
kernel26
KDEmod current repository
Offline
nice idea
Offline
Have you coded these lines right now?
yep
Last edited by klixon (2007-06-18 10:18:37)
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
i'm not a bash wizard, so i used awk, this looks to be working:
#!/bin/bash
PACKAGE=$1
for file in $( pacman -Ql ${PACKAGE} | awk '{print $2}'); do
if [ "${test:$(( ${#test} - 1 ))}" == "/" ]; then
if [ ! -d ${file} ]; then
echo "Directory missing: ${file}"
fi
else
if [ ! -f ${file} ]; then
echo "File missing: ${file}"
fi
fi
done
Offline
...and this will check all installed packages:
for p in `pacman -Q | awk '{print $1}'`; do bash paccheck.bash $p; done
Offline
dang... you're right... fix in original script...
i had no connection to home, so i checked the filelists at the arch-homepage...
does pacman -Ql ever output directory-entries? Or is it only filenames?
If it's only filenames, we could make the script a bit simpler
Last edited by klixon (2007-06-18 11:00:08)
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
looks like only files...
Offline
does pacman -Ql ever output directory-entries? Or is it only filenames?
I'm wondering the same, see the beginning of my comment there:
http://bbs.archlinux.org/viewtopic.php? … 87#p258887
Last edited by shining (2007-06-18 11:24:40)
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
I guess it uses a directory name for empty directories that are required, so the [ ! -d ] check is still valid...
I'm glad i'm doing the opposite of what you're trying to do... That looks a bit more hairy.
Last edited by klixon (2007-06-18 11:46:02)
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
I guess it uses a directory name for empty directories that are required, so the [ ! -d ] check is still valid...
Oh no, finally it's a little bug in pacman (src/pacman/package.c)
225 if(!stat(path, &buf) && S_ISDIR(buf.st_mode)) {
226 /* if we stat it and it is a dir, don't print */
227 } else {
228 fprintf(stdout, "%s %s\n", pkgname, path);
229 }
If a directory doesn't exist, or is only readable by root, it can't stat it and detect it's a directory, so it'll print it
As root, the only directory it prints is the one which doesn't exist, ie /tmp/ttf-ms-fonts/
because of the special status of the ttf-ms-fonts package.
And as user, it also prints /var/spool/cups/tmp/ , because it doesn't have the right to stat it I guess.
I'm glad i'm doing the opposite of what you're trying to do... That looks a bit more hairy.
lol indeed, that's why I gave up
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
1000
Offline