summary refs log tree commit diff
path: root/xi
blob: 6ad01701bf2fa8e99fb3809c00f02e6e41d324c6 (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
29
30
31
32
33
34
#!/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/$BRANCH/debug
	--repository=../hostdir/binpkgs/$BRANCH/debug
	--repository=../../hostdir/binpkgs/$BRANCH/debug
	--repository=hostdir/binpkgs
	--repository=../hostdir/binpkgs
	--repository=../../hostdir/binpkgs
	--repository=hostdir/binpkgs/nonfree
	--repository=../hostdir/binpkgs/nonfree
	--repository=../../hostdir/binpkgs/nonfree
	--repository=hostdir/binpkgs/debug
	--repository=../hostdir/binpkgs/debug
	--repository=../../hostdir/binpkgs/debug
"

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