about summary refs log tree commit diff
path: root/xi
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-09-23 15:14:18 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-09-23 15:14:18 +0200
commit4fc6fbf76f1b9ed06c281b314925f694f7ece72a (patch)
tree3edb05da4b418d31b32f6b1d87794bbb2d7bf614 /xi
parent4ed63d17a32b2f8c3939f0465adb00b1f07c018a (diff)
downloadxtools-4fc6fbf76f1b9ed06c281b314925f694f7ece72a.tar.gz
xtools-4fc6fbf76f1b9ed06c281b314925f694f7ece72a.tar.xz
xtools-4fc6fbf76f1b9ed06c281b314925f694f7ece72a.zip
add xi
Diffstat (limited to 'xi')
-rwxr-xr-xxi20
1 files changed, 20 insertions, 0 deletions
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 "$@"