-
Notifications
You must be signed in to change notification settings - Fork 5
/
xlpm
executable file
·69 lines (67 loc) · 1.28 KB
/
xlpm
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
66
67
68
69
#!/bin/sh
# xbps on top of slpm wrapper
whereami() {
for a in $PWD `echo $PATH | sed 's,:, ,g'` ; do
if [ -e "$a/$1" ]; then
echo "$a/$1"
return
fi
done
echo $1
}
BIN="`readlink $0`"
ARG0="`whereami $BIN`"
ROOT="`dirname $ARG0`"
ROOTDIR="${ROOT}/_xbps"
show_help() {
echo "Usage: xlpm [-action] [args]"
echo " -i [pkgname] install package"
echo " -r [pkgname] remove package"
echo " -s [pkgname] search package"
echo " -l [pkgname] list packages or files"
echo " -c clear binpkgs, orphans.."
echo " -x [cmd] enter chroot or run command"
echo " -v show version"
exit 0
}
[ -z "$1" ] && show_help
while [ -n "$1" ]; do
case "$1" in
-x)
shift
if [ -z "$1" ]; then
sudo chroot ${ROOTDIR}
else
sudo chroot ${ROOTDIR} $@
fi
;;
-h)
show_help
;;
-i)
shift
exec slpm -x xbps-install -r ${ROOTDIR} -y $@
;;
-s)
shift
exec slpm -x xbps-query -r ${ROOTDIR} -s $@
;;
-l)
if [ -n "$2" ]; then
exec slpm -x xbps-query -r ${ROOTDIR} -f "$2"
fi
exec slpm -x xbps-query -r ${ROOTDIR} -l |awk '{print $1}'
;;
-r)
shift
exec slpm -x xbps-remove -r ${ROOTDIR} -y $@
;;
-c)
slpm -x xbps-remove -Ooyv -r ${ROOTDIR}
;;
-v)
exec slpm -x xbps-install -V
;;
esac
shift
done