aboutsummaryrefslogtreecommitdiff
path: root/old/lspkg.old
blob: fe28a6546d9e75bda73f2f45a181b8dde7603d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# lspkg
# feedback: rhatto at riseup.net | gpl
#
# todo:
#
#   -r, --remove: remove matching packages
#   -d, --description: show matching packages' descriptions
#   -s, --search: search a file under the matching packages
#   -p, --print: print the contents of a package file
#

function usage {
  echo usage: $0 [-v|-d|-s|-p expression]
  exit 1
}

if [[ "$1" == "-v" ]]; then
  if [[ ! -z "$2" ]]; then
    less $(ls /var/log/packages/$2*)
  else
    usage
  fi
elif [[ $1 = -p ]]; then
  if [ -f $2 ]; then
    tar ztvf $2
  fi
else
  ls /var/log/packages/$1*
fi