summary refs log tree commit diff
path: root/xi
blob: 8cf9c731e2c9391d363abd57c10d0c2f6b1fa0ad (plain) (blame)
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
#!/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/$BRANCH/nonfree
	--repository=../hostdir/binpkgs/$BRANCH/nonfree
	--repository=../../hostdir/binpkgs/$BRANCH/nonfree
	--repository=hostdir/binpkgs
	--repository=../hostdir/binpkgs
	--repository=../../hostdir/binpkgs
	--repository=hostdir/binpkgs/nonfree
	--repository=../hostdir/binpkgs/nonfree
	--repository=../../hostdir/binpkgs/nonfree
"

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 $ADDREPO -S "$@"