You are not logged in.

#1 2006-08-30 17:55:25

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Another pacman script.

I just created a wiki entry for a script I wrote that manipulates pacman's -Ss output. Check it out here here. Any feedback is appreciated. 8)


psearch - manipulate and refine pacman searches

Offline

#2 2006-08-30 19:44:04

wain
Member
From: France
Registered: 2005-05-01
Posts: 289
Website

Re: Another pacman script.

nice script smile

A small error:

wain ~ $ pak -l openbox
 > Searching... /home/wain/scripts/pak: line 100: [: /var/lib/pacman/local/openbox-cvs-20060822-2: binary operator expected
 
 > 3 matches found for key term [ openbox ]
....

Offline

#3 2006-08-30 21:45:06

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

wain wrote:

nice script smile

A small error:

wain ~ $ pak -l openbox
 > Searching... /home/wain/scripts/pak: line 100: [: /var/lib/pacman/local/openbox-cvs-20060822-2: binary operator expected
 
 > 3 matches found for key term [ openbox ]
....

Thanks for trying it out. smile Strange error, though. Does it do it every time, or only when searching for openbox? Would you mind posting your pacman.conf so I can take a look at it?


psearch - manipulate and refine pacman searches

Offline

#4 2006-08-30 21:53:16

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Another pacman script.

Sounds like you need quotes in a [] test.  Make sure to _always_ do:

if [ "$some_var" == "blah" ];

instead of

if [ $some_var == "blah" ];

Offline

#5 2006-08-30 23:04:27

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

phrakture wrote:

Sounds like you need quotes in a [] test.  Make sure to _always_ do:

if [ "$some_var" == "blah" ];

instead of

if [ $some_var == "blah" ];

Nice catch. My bash skills are crude, I must admit. I'll fix it in a few hours when I get home.


psearch - manipulate and refine pacman searches

Offline

#6 2006-08-30 23:06:09

Thalassinus
Member
Registered: 2006-08-29
Posts: 55

Re: Another pacman script.

This script is useful, because it's easier to fsearch if you get colored output

Offline

#7 2006-08-31 02:20:56

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

wain wrote:

A small error:

wain ~ $ pak -l openbox
 > Searching... /home/wain/scripts/pak: line 100: [: /var/lib/pacman/local/openbox-cvs-20060822-2: binary operator expected

I updated the code.. see if it works now.


psearch - manipulate and refine pacman searches

Offline

#8 2006-08-31 09:36:34

Insane-Boy
Member
Registered: 2006-02-27
Posts: 243

Re: Another pacman script.

Can you post screens?

Offline

#9 2006-08-31 11:40:43

wain
Member
From: France
Registered: 2005-05-01
Posts: 289
Website

Re: Another pacman script.

wrythe wrote:
wain wrote:

A small error:

wain ~ $ pak -l openbox
 > Searching... /home/wain/scripts/pak: line 100: [: /var/lib/pacman/local/openbox-cvs-20060822-2: binary operator expected

I updated the code.. see if it works now.

same problem at line 104:
please replace the line with:

   elif [ -d "/var/lib/pacman/local/${repNames[$i]}-*" ]; then

@Insane-Boy:
pack.png

Offline

#10 2006-08-31 13:49:27

Insane-Boy
Member
Registered: 2006-02-27
Posts: 243

Re: Another pacman script.

Looks very nice:) Thanks

Offline

#11 2006-08-31 14:54:48

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

wain wrote:

same problem at line 104:
please replace the line with:

   elif [ -d "/var/lib/pacman/local/${repNames[$i]}-*" ]; then

Done. Thanks smile


psearch - manipulate and refine pacman searches

Offline

#12 2006-08-31 18:44:32

Pierluigi
Member
Registered: 2004-04-10
Posts: 90
Website

Re: Another pacman script.

i've added this great script to pactools --> http://aur.archlinux.org/packages.php?d … =1&ID=5907

hope you like to have all pacman related scripts in a single package  wink

Offline

#13 2006-08-31 19:12:54

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

Pierluigi wrote:

i've added this great script to pactools --> http://aur.archlinux.org/packages.php?d … =1&ID=5907

hope you like to have all pacman related scripts in a single package  wink

Oh, cool. 8) Thanks!


psearch - manipulate and refine pacman searches

Offline

#14 2006-09-02 02:52:05

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

wain wrote:

[
please replace the line with:

   elif [ -d "/var/lib/pacman/local/${repNames[$i]}-*" ]; then

Putting quotes around the wildcard killed the installed version check. The original code worked (?) on most systems, but since some people were having problems with it I rewote the code for that section using strictly pacman to verify a local install of the package. It should be solid now.


psearch - manipulate and refine pacman searches

Offline

#15 2006-09-06 18:41:35

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

Pak recieved a recent update that allows the user to search only installed packages, not installed packages, or upgradeable packages. I also replaced all 'awk' commands with 'cut' commands in an effort to speed it up a little, though it didn't really do much. If anyone else has any suggestions as to get to moving faster then I'm all ears.

Also, if you use this script I suggest you check the wiki (link is in my sig) periodically for updates. All bug fixes and updates are tracked at the bottom of the page.

Thanks again for all of your guys' feedback and suggestions.


psearch - manipulate and refine pacman searches

Offline

#16 2006-09-08 20:46:00

Janitux
Member
Registered: 2006-03-30
Posts: 24
Website

Re: Another pacman script.

looks nice,a good idea should be add support to do aur search
btw really good work

Offline

#17 2006-09-08 20:56:33

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Another pacman script.

wrythe wrote:
wain wrote:
   elif [ -d "/var/lib/pacman/local/${repNames[$i]}-*" ]; then

Putting quotes around the wildcard killed the installed version check.

You could safely do something like:

found=0
for x in /var/lib/pacman/local/${repNames[$i]}-*; do
   [ -d "$x" ] && found=1
done
if [ $found -eq 1 ]; then

Offline

#18 2006-09-09 02:03:49

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

phrakture wrote:

You could safely do something like:

found=0
for x in /var/lib/pacman/local/${repNames[$i]}-*; do
   [ -d "$x" ] && found=1
done
if [ $found -eq 1 ]; then

Excellent idea. Once again, you come to my rescue. I'm officially adopting you as my go-to Arch dev.

I'm thinking of looking into reprogramming this thing outside of bash so it can speed up a bit. Unfortunately, the only programming language I have much experience with is Java, so we'll see if that works out.


psearch - manipulate and refine pacman searches

Offline

#19 2006-09-25 05:02:17

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

Janitux wrote:

looks nice,a good idea should be add support to do aur search
btw really good work

It supports aur seaches now.


psearch - manipulate and refine pacman searches

Offline

#20 2006-09-26 08:28:56

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: Another pacman script.

Something is wrong ...

$ pak -l kernel
 > Search complete...
ERROR: Please execute this file using the pak script.

Offline

#21 2006-09-26 14:29:06

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

Purch wrote:

Something is wrong ...

$ pak -l kernel
 > Search complete...
ERROR: Please execute this file using the pak script.

Did you install it with the PKGBUILD? It gives that error if the Java files isn't given enough arguments. Hm.


psearch - manipulate and refine pacman searches

Offline

#22 2006-09-26 15:14:45

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

Purch wrote:

Something is wrong ...

$ pak -l kernel
 > Search complete...
ERROR: Please execute this file using the pak script.

Actually, can you do me a favor? Change the first line of /usr/bin/pak from #/bin/bash to:

#/bin/bash -x

.. and post the big chunk of output that starts with "+ java -cp". That'll help determine exactly what's missing from the java execution.


psearch - manipulate and refine pacman searches

Offline

#23 2006-09-26 18:20:45

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: Another pacman script.

This is weird. Pak works from console, ssh and xfce4. when I got the error I was using KDE. I have to check my KDE settings when I have time.[/url]

Offline

#24 2006-09-27 01:10:38

wrythe
Member
From: Seattle, WA
Registered: 2006-08-15
Posts: 80

Re: Another pacman script.

Purch wrote:

This is weird. Pak works from console, ssh and xfce4. when I got the error I was using KDE. I have to check my KDE settings when I have time.[/url]

That is strange. The only argument that is passed to the Java file that isn't explicitly declared as a variable in the script is $COLUMNS. Try `echo $COLUMNS` from Konsole (if that's what you're using in KDE) and see if it gives any output.


psearch - manipulate and refine pacman searches

Offline

#25 2006-09-27 07:20:31

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: Another pacman script.

I did more tests with two arch32 machines.

KDE - does not work (konsole, terminal)
gnome - does not work (urxvt, terminal, gnome-terminal)
E17 - does not work (xterm, terminal)
xfce OK (terminal)
consoles (ctrl+alt+F1) OK
ssh remote login OK

Amount of columns (tested with 80 and 209) in the terminal wont affect the result. Gnome and kde may have some java settings that makes pak crash.

Offline

Board footer

Powered by FluxBB