diff options
-rw-r--r-- | README | 1 | ||||
-rwxr-xr-x | xi | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/README b/README index 8debe7b..c915e18 100644 --- a/README +++ b/README @@ -14,6 +14,7 @@ https://github.com/voidlinux/xbps xgensum [-f] [-i] TEMPLATE - update SHA256 sums in templates xgrep PATTERN PKGS... - search files limited to XBPS package contents xhog - list installed XBPS packages ordered by size + xi PKGS... - like xbps-install -S, but take cwd repo and sudo/su into account xlg PKG - open short commit log for XBPS template xlint TEMPLATE - scan XBPS template for common mistakes xlocate [-u | PATTERN] - locate files in all XBPS packages diff --git a/xi b/xi new file mode 100755 index 0000000..63a6db3 --- /dev/null +++ b/xi @@ -0,0 +1,20 @@ +#!/bin/sh +# xi PKGS... - like xbps-install -S, but take cwd repo and sudo/su into account + +BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null) +ADDREPO="--repository=hostdir/binpkgs/$BRANCH + --repository=../hostdir/binpkgs/$BRANCH + --repository=../../hostdir/binpkgs/$BRANCH + --repository=hostdir/binpkgs + --repository=../hostdir/binpkgs + --repository=../../hostdir/binpkgs" + +SUDO= +if command -v sudo >/dev/null && + sudo -l | grep -q -e ' ALL$' -e xbps-install; then + SUDO=sudo +elif [ "$(whoami)" != root ]; then + SUDO='su root -c '\''"$@"'\'' -- -' +fi + +$SUDO xbps-install -S "$@" |