Last active 1701126077

a tiny wrapper for xbps utils

celediel's Avatar Lilian Jónsdóttir revised this gist 1701126003. Go to revision

1 file changed, 1 deletion

xb.sh

@@ -83,7 +83,6 @@ whatprovides | wp | locate)
83 83 -h)
84 84 # TODO: proper this
85 85 echo "Try one of these:"
86 - # fd xbps /usr/bin | cut -d'-' -f2-
87 86 find /usr/bin -iname "xbps-*" | cut -d'-' -f2-
88 87 ;;
89 88 *)

celediel's Avatar Lilian Jónsdóttir revised this gist 1701125996. Go to revision

1 file changed, 1 insertion, 1 deletion

xb.sh

@@ -66,7 +66,7 @@ remove | rm | r)
66 66 $ROOT_DOER xbps-remove $args
67 67 ;;
68 68 # alias commands
69 - update | up)
69 + update | upgrade | up)
70 70 $ROOT_DOER xbps-install -Su
71 71 ;;
72 72 search | s)

celediel's Avatar celediel revised this gist 1701125287. Go to revision

1 file changed, 92 insertions

xb.sh(file created)

@@ -0,0 +1,92 @@
1 + #!/bin/sh
2 + # very simple xbps wrapper
3 +
4 + # don't doas or sudo unless it exists
5 + if [ ! -z "$(type doas)" ]; then
6 + ROOT_DOER="$(command -v doas)"
7 + elif [ ! -z "$(type sudo)" ]; then
8 + ROOT_DOER="$(command -v sudo)"
9 + fi
10 +
11 + # don't elevate as root
12 + if [ $(id -u) -eq 0 ]; then
13 + ROOT_DOER=""
14 + fi
15 +
16 + args=$(echo $@ | cut -d' ' -f2-)
17 + case $1 in
18 + # built-in user commands
19 + alternatives | alt)
20 + xbps-alternatives $args
21 + ;;
22 + checkvers | cv)
23 + xbps-checkvers $args
24 + ;;
25 + create | c)
26 + xbps-create $args
27 + ;;
28 + dgraph | dg)
29 + xbps-dgraph $args
30 + ;;
31 + digest | d)
32 + xbps-digest $args
33 + ;;
34 + fbulk | fb)
35 + xbps-fbulk $args
36 + ;;
37 + fetch | f)
38 + xbps-fetch $args
39 + ;;
40 + pkgdb | p | pkg | db)
41 + xbps-pkgdb $args
42 + ;;
43 + query | q)
44 + xbps-query $args
45 + ;;
46 + rindex | ri)
47 + xbps-rindex $args
48 + ;;
49 + uchroot | uc)
50 + xbps-uchroot $args
51 + ;;
52 + uhelper | uh)
53 + xbps-uhelper $args
54 + ;;
55 + uunshare | uu)
56 + xbps-uunshare $args
57 + ;;
58 + # built-in root commands
59 + install | i)
60 + $ROOT_DOER xbps-install $args
61 + ;;
62 + reconfigure | rc | recon)
63 + $ROOT_DOER xbps-reconfigure $args
64 + ;;
65 + remove | rm | r)
66 + $ROOT_DOER xbps-remove $args
67 + ;;
68 + # alias commands
69 + update | up)
70 + $ROOT_DOER xbps-install -Su
71 + ;;
72 + search | s)
73 + xbps-query -Rs "$args"
74 + ;;
75 + show | sh)
76 + xbps-query -RS $args
77 + ;;
78 + # external but relevant
79 + whatprovides | wp | locate)
80 + xlocate $args
81 + ;;
82 + # help and such
83 + -h)
84 + # TODO: proper this
85 + echo "Try one of these:"
86 + # fd xbps /usr/bin | cut -d'-' -f2-
87 + find /usr/bin -iname "xbps-*" | cut -d'-' -f2-
88 + ;;
89 + *)
90 + echo "I dunno about xbps-$1, try again."
91 + ;;
92 + esac
Newer Older