blob: 2cc80aac1869f37acc1d8378939fd7dc562c246d (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/sh
# wtf <file identifier>
#
# or
#
# wtf $arch <file identifier>
#
# where <file identifier> is on of:
#
# $filename
# /$full/$path/$to/$file
# $partial/$path/$to/$file
base_dir=$(
readlink -f "${0%/*}/.."
)
search="$*"
case ${search%% *} in
'i486')
arch='i486'
search="${search#* }"
;;
'i686')
arch='i686'
search="${search#* }"
;;
'pentium4')
arch='pentium4'
search="${search#* }"
;;
*)
arch='i686'
;;
esac
pkgfile -w \
-C "${base_dir}/misc/pacman-${arch}.conf" \
-D "${base_dir}/work/pkgfile-${arch}.cache" \
-s "${search##*/}" | \
xargs -rn1 \
pkgfile -w \
-C "${base_dir}/misc/pacman-${arch}.conf" \
-D "${base_dir}/work/pkgfile-${arch}.cache" \
-l | \
if printf '%s\n' "${search}" | \
grep -q '^/'; then
grep -w "${search}"
else
grep "/${search}\$"
fi | \
sort -k2,2 | \
sed '
s,^\([^/[:space:]]\+\)/\([^/[:space:]]\+\)\s\(\S.*\)$,\2 [\1]: \3,
' | \
sed '
:a
$!N
s#^\(\([^/:[:space:]]\+ [^/:[:space:]]\+, \)*[^/:[:space:]]\+ [^/:[:space:]]\+\): \([^\n]\+\)\n\([^/:[:space:]]\+ [^/:[:space:]]\+\): \3$#\1, \4: \3#
ta
P
D
'
|