#!/bin/sh # very simple xbps wrapper # don't doas or sudo unless it exists if [ ! -z "$(type doas)" ]; then ROOT_DOER="$(command -v doas)" elif [ ! -z "$(type sudo)" ]; then ROOT_DOER="$(command -v sudo)" fi # don't elevate as root if [ $(id -u) -eq 0 ]; then ROOT_DOER="" fi args=$(echo $@ | cut -d' ' -f2-) case $1 in # built-in user commands alternatives | alt) xbps-alternatives $args ;; checkvers | cv) xbps-checkvers $args ;; create | c) xbps-create $args ;; dgraph | dg) xbps-dgraph $args ;; digest | d) xbps-digest $args ;; fbulk | fb) xbps-fbulk $args ;; fetch | f) xbps-fetch $args ;; pkgdb | p | pkg | db) xbps-pkgdb $args ;; query | q) xbps-query $args ;; rindex | ri) xbps-rindex $args ;; uchroot | uc) xbps-uchroot $args ;; uhelper | uh) xbps-uhelper $args ;; uunshare | uu) xbps-uunshare $args ;; # built-in root commands install | i) $ROOT_DOER xbps-install $args ;; reconfigure | rc | recon) $ROOT_DOER xbps-reconfigure $args ;; remove | rm | r) $ROOT_DOER xbps-remove $args ;; # alias commands update | upgrade | up) $ROOT_DOER xbps-install -Su ;; search | s) xbps-query -Rs "$args" ;; show | sh) xbps-query -RS $args ;; # external but relevant whatprovides | wp | locate) xlocate $args ;; # help and such -h) # TODO: proper this echo "Try one of these:" find /usr/bin -iname "xbps-*" | cut -d'-' -f2- ;; *) echo "I dunno about xbps-$1, try again." ;; esac