blob: 14d9adf4783f1fe75f9da2b9fcf03218ec3c8d8b (
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
|
#!/bin/sh
list () {
find ${PACKAGES_DIR} -type f | sed "s,${PACKAGES_DIR}/,,"
}
installed () {
ls -1 ${INSTALLED_DIR}
}
list_installed () {
list | while read -r line; do
[ -d ${INSTALLED_DIR}/$line ] \
&& echo $line "[installed]" \
|| echo $line
done
}
search () {
if [ $# = 0 ]; then
list
else
list | grep $(echo $@ | sed "s/ /\\|/g")
fi
}
files () {
for package in $@; do
local file="${INSTALLED_DIR}/$package/files"
[ -f $file ] && cat $file || >&2 printf "${RED}Package ${LIGHT_RED}$package${RED} is not installed\n"
done
}
file_info () {
for file in $@; do
[ ! -f ${SYSROOT}$file ] && file=$(realpath $file)
for pkg in $(list_installed); do
for list in ${INSTALLED_DIR}/$pkg/files; do
grep -q ^${file}$ $list &&
printf "${LIGHT_BLUE}%s${BLUE} belongs to ${LIGHT_BLUE}%s${RESET}\n" $file $pkg
done
done
done
}
|