![]() |
I have been toying with this all night now and cannot seem to get it to work, so I came to you for some aid. I recently discovered the wonders of the AWK programming language and how it can be useful of UNIX system administratioin, especially directly from and interacitive interpreter (ala sh).
The FreeBSD development team made it very easy to install pre-compiled binary packages remotely via the pkg_add -r directive which gives you functionality and facility very similiar to that of Debian's famed APT. When issuing a fetch, you do not have to give a specific version number along with the package name in the string, so something such as this will work fine: :
# pkg_add -r <package>One little incovinience that I did come across is, of course, having to look for specific version numbers each time I want to remove a package via the pkg system. This process was tedious and involved looking through pkg_info output for your program and maybe piping it to 'more' or 'less' to scroll through a long list of packages: :
# pkg_info | lessThis might not seem like a lot to the naked eye, and indeed, it takes but a minute to accomplish, but it does get rather boring and is a minute that could have been well spent elsewhere. I was thinking about how I might accomplish this more time effective. I needed pkg_info's output to accomplish the bulk of this, so that goes first. I would then have to pipe it to some pattern matching utility and search for my program, which, of course, would not have to be specific. Their is two options here, and my first was the less efficient, but the first to come to mind. The second saves a process. The third will eliminate the need for yet another process. The problem with this and what I need help with will unfold: :
# pkg_info | grep xchat | awk '{ print $1 }' | xargs pkg_deleteThis little timeline was how I wrote this in the exact order. The last one is what I stuck with, though. The basic operation of this script is as follows: output package information, look for records with the string "xchat", extract only the first field from the output, and delete the package. Here is my problem. I have a gnome installation that I would like to get rid of via package managment for the sake of cleanliness. I could do this manually, though it would take me ages to go through every single package with the method above. I tried the following to delete the bulk of the gnome packages: :
# pkg_info | awk '/gnome/ { print $1 }' For all of the above package, I got the a message similar to the following for each: :
After a minute or two, I ran this and got the same message as above: :
# pkg_info | awk '/gnome/ { print $1; system("pkg_delete" $1); }'This is the end of the road, and I hope someone might have a solution to this. I was thinking it was going to be something recursive, but i'm studying up on awk a bit more. Thanks in advance... EDIT: I just did "man pkg_delete" and came across the -x switch. Here's what it does, which is what the above does too: :
-x Treat the pkg-name as a regular expression and delete all pack-I ran "pkg_delete -x gnome" and got the same errors i got early, plus a new one: :
pkg_delete: couldn't entirely delete package (perhaps the packing list isAnd that's the update. |
well, it looks like your awk manipulation was correct, and now that your using the -x option for pkg_delete it seems that the problem risides in pkg_delete. while i have no experience with the package manager your talking about, the first thing that came to mind when i read your first error (pkg_delete: file '.*' doesn't really exsist), was that the file could actually be a symbolic link or a link? just a thought, im not sure why this would cause a problem, but its possible.
|
| All times are GMT -5. The time now is 12:31 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC